All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jamal Hadi Salim <jhs@mojatatu.com>
To: Jiri Pirko <jiri@resnulli.us>, Cong Wang <cwang@twopensource.com>
Cc: netdev <netdev@vger.kernel.org>,
	David Miller <davem@davemloft.net>,
	Pravin B Shelar <pshelar@nicira.com>,
	Tom Herbert <therbert@google.com>,
	Eric Dumazet <edumazet@google.com>,
	willemb@google.com, Daniel Borkmann <dborkman@redhat.com>,
	mst@redhat.com, Florian Westphal <fw@strlen.de>,
	Paul.Durrant@citrix.com, Thomas Graf <tgraf@suug.ch>
Subject: Re: [patch net-next 2/2] sched: introduce vlan action
Date: Wed, 12 Nov 2014 08:03:40 -0500	[thread overview]
Message-ID: <54635AAC.3080600@mojatatu.com> (raw)
In-Reply-To: <20141112123445.GE1882@nanopsycho.orion>

On 11/12/14 07:34, Jiri Pirko wrote:
> Tue, Nov 11, 2014 at 11:33:21PM CET, cwang@twopensource.com wrote:
>> On Tue, Nov 11, 2014 at 2:13 AM, Jiri Pirko <jiri@resnulli.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

  reply	other threads:[~2014-11-12 13:03 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-11 10:13 [patch net-next 1/2] net: move vlan pop/push functions into common code Jiri Pirko
2014-11-11 10:13 ` [patch net-next 2/2] sched: introduce vlan action Jiri Pirko
2014-11-11 12:34   ` Jamal Hadi Salim
2014-11-11 22:33   ` Cong Wang
2014-11-12 12:34     ` Jiri Pirko
2014-11-12 13:03       ` Jamal Hadi Salim [this message]
2014-11-12 13:06         ` Jamal Hadi Salim
2014-11-11 23:18   ` Cong Wang
2014-11-12  7:47     ` Jiri Pirko
2014-11-12 12:27       ` Jamal Hadi Salim
2014-11-13 17:06         ` Cong Wang
2014-11-11 13:06 ` [patch net-next 1/2] net: move vlan pop/push functions into common code Eric Dumazet
2014-11-11 15:00   ` Jiri Pirko
2014-11-11 17:24 ` Pravin Shelar
2014-11-12 11:59   ` Jiri Pirko
2014-11-12 19:11     ` David Miller
2014-11-12 19:20     ` Pravin Shelar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54635AAC.3080600@mojatatu.com \
    --to=jhs@mojatatu.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=cwang@twopensource.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=jiri@resnulli.us \
    --cc=mst@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@nicira.com \
    --cc=tgraf@suug.ch \
    --cc=therbert@google.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.