From: "Yang, Yi" <yi.y.yang@intel.com>
To: Eric Garver <e@erig.me>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"dev@openvswitch.org" <dev@openvswitch.org>,
"jbenc@redhat.com" <jbenc@redhat.com>,
"pshelar@ovn.org" <pshelar@ovn.org>,
"davem@davemloft.net" <davem@davemloft.net>
Subject: Re: [PATCH net-next v14] openvswitch: enable NSH support
Date: Wed, 1 Nov 2017 12:04:36 +0800 [thread overview]
Message-ID: <20171101040435.GA66272@localhost.localdomain> (raw)
In-Reply-To: <20171031195741.GR22092@dev-rhel7>
On Wed, Nov 01, 2017 at 03:57:41AM +0800, Eric Garver wrote:
> On Mon, Oct 30, 2017 at 09:29:34AM +0800, Yi Yang wrote:
> [...]
> > +int nsh_pop(struct sk_buff *skb)
> > +{
> > + struct nshhdr *nh;
> > + size_t length;
> > + __be16 inner_proto;
> > +
> > + if (!pskb_may_pull(skb, NSH_BASE_HDR_LEN))
> > + return -ENOMEM;
> > + nh = (struct nshhdr *)(skb->data);
> > + length = nsh_hdr_len(nh);
> > + if (!pskb_may_pull(skb, length))
> > + return -ENOMEM;
> > +
> > + nh = (struct nshhdr *)(skb->data);
> > + inner_proto = tun_p_to_eth_p(nh->np);
>
> If you fetch inner_proto before the second pskb_may_pull then there is
> no need to reload the nh pointer as you won't use it later.
>
> > + if (!inner_proto)
> > + return -EAFNOSUPPORT;
> > +
> > + length = nsh_hdr_len(nh);
>
> You already have the length from above. No need to get it again.
Good catch, fixed in v15.
next prev parent reply other threads:[~2017-11-01 4:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-30 1:29 [PATCH net-next v14] openvswitch: enable NSH support Yi Yang
2017-10-31 19:57 ` Eric Garver
2017-10-31 20:02 ` Jiri Benc
2017-11-01 4:04 ` Yang, Yi [this message]
2017-10-31 20:08 ` Jiri Benc
2017-11-01 4:07 ` Yang, Yi
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=20171101040435.GA66272@localhost.localdomain \
--to=yi.y.yang@intel.com \
--cc=davem@davemloft.net \
--cc=dev@openvswitch.org \
--cc=e@erig.me \
--cc=jbenc@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pshelar@ovn.org \
/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.