On Wed, Jul 13, 2016 at 01:36:30AM +0800, Johnson Li wrote: > Parse the Network Service Header to fullfill the fields in the > struct sw_flow_key. > > Signed-off-by: Johnson Li <johnson...@intel.com> > > diff --git a/datapath/flow.c b/datapath/flow.c > index fd09cec..debac6f 100644 > --- a/datapath/flow.c > +++ b/datapath/flow.c > @@ -44,6 +44,7 @@ > #include <net/ipv6.h> > #include <net/mpls.h> > #include <net/ndisc.h> > +#include <net/nsh.h> > > #include "datapath.h" > #include "conntrack.h" > @@ -296,6 +297,45 @@ static bool icmp6hdr_ok(struct sk_buff *skb) > sizeof(struct icmp6hdr)); > } > > +static int parse_nsh(struct sk_buff *skb, struct sw_flow_key *key) > +{ > + struct nsh_hdr *nsh_hdr = (struct nsh_hdr *)skb_mac_header(skb);
I'm a little surprised to see the NSH header be accessed via skb_mac_header() here. I would have expected the skb_mac_header() to point to any Ethernet header that is present. > + uint16_t retval = -1; I don't think there is any need to initialise retval above as it is initialised before use below. > + // uint16_t length = 0; /* For MD type 2 support */ Please remove or use this and other unused code. > + > + retval = nsh_hdr->base.length << 2; > + if (retval > NSH_LEN_MAX) > + return -EINVAL; Perhaps the local retval variable could be removed as its only set and then compared above. [...] _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev