[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54635AAC.3080600@mojatatu.com>
Date: Wed, 12 Nov 2014 08:03:40 -0500
From: Jamal Hadi Salim <jhs@...atatu.com>
To: Jiri Pirko <jiri@...nulli.us>, Cong Wang <cwang@...pensource.com>
CC: netdev <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
Pravin B Shelar <pshelar@...ira.com>,
Tom Herbert <therbert@...gle.com>,
Eric Dumazet <edumazet@...gle.com>, willemb@...gle.com,
Daniel Borkmann <dborkman@...hat.com>, mst@...hat.com,
Florian Westphal <fw@...len.de>, Paul.Durrant@...rix.com,
Thomas Graf <tgraf@...g.ch>
Subject: Re: [patch net-next 2/2] sched: introduce vlan action
On 11/12/14 07:34, Jiri Pirko wrote:
> Tue, Nov 11, 2014 at 11:33:21PM CET, cwang@...pensource.com wrote:
>> On Tue, Nov 11, 2014 at 2:13 AM, Jiri Pirko <jiri@...nulli.us> wrote:
>>> +static int tcf_vlan_init(struct net *net, struct nlattr *nla,
>>> + struct nlattr *est, struct tc_action *a,
>>> + int ovr, int bind)
>>> +{
>>> + struct nlattr *tb[TCA_VLAN_MAX + 1];
>>> + struct tc_vlan *parm;
>>> + struct tcf_vlan *v;
>>> + int action;
>>> + __be16 push_vid = 0;
>>> + __be16 push_proto = 0;
>>> + int ret = 0;
>>> + int err;
>>> +
>>> + if (!nla)
>>> + return -EINVAL;
>>> +
>>> + err = nla_parse_nested(tb, TCA_VLAN_MAX, nla, vlan_policy);
>>> + if (err < 0)
>>> + return err;
>>> +
>>> + if (!tb[TCA_VLAN_PARMS])
>>> + return -EINVAL;
>>> + parm = nla_data(tb[TCA_VLAN_PARMS]);
>>> + switch (parm->v_action) {
>>> + case TCA_VLAN_ACT_POP:
>>> + break;
>>> + case TCA_VLAN_ACT_PUSH:
>>> + if (!tb[TCA_VLAN_PUSH_VLAN_ID])
>>> + return -EINVAL;
>>> + push_vid = nla_get_u16(tb[TCA_VLAN_PUSH_VLAN_ID]);
>>
>> nla_get_be16() ?
>
> No. I made this the same as it is done in net/8021q/vlan_netlink.c
>
It just happens that user space passes it to you in BE already.
So this works out because skb_vlan_push expects that to be in BE
as in:
int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci)
cheers,
jamal
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists