On Thu, 2015-03-26 at 14:01 +0900, Toshiaki Makita wrote: > To allow drivers to handle the features check for multiple tags, > move the check to ndo_features_check(). > As no drivers currently handle multiple tagged TSO, introduce > dflt_features_check() and call it if the driver does not have > ndo_features_check(). > > Signed-off-by: Toshiaki Makita <makita.toshi...@lab.ntt.co.jp> > ---
> diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h > index bc649dd..5ceb38f 100644 > --- a/include/linux/if_vlan.h > +++ b/include/linux/if_vlan.h > @@ -606,4 +606,26 @@ static inline bool skb_vlan_tagged_multi(struct sk_buff > *skb) > return true; > } > > +/** > + * vlan_features_check - drop unsafe features for skb with multiple tags. > + * @skb: skbuff to query > + * @features: features to be checked > + * > + * Returns features without unsafe ones if the skb has multiple tags. > + */ > +static inline netdev_features_t vlan_features_check(struct sk_buff *skb, const struct sk_buff *skb > + netdev_features_t features) > +{ > + if (skb_vlan_tagged_multi(skb)) > + features = netdev_intersect_features(features, > + NETIF_F_SG | > + NETIF_F_HIGHDMA | > + NETIF_F_FRAGLIST | > + NETIF_F_GEN_CSUM | > + NETIF_F_HW_VLAN_CTAG_TX | > + NETIF_F_HW_VLAN_STAG_TX); > + > + return features; > +} > + > #endif /* !(_LINUX_IF_VLAN_H_) */ > diff --git a/net/core/dev.c b/net/core/dev.c > index 04bffcd..41d0db55 100644 > --- a/net/core/dev.c > +++ b/net/core/dev.c > @@ -2562,6 +2562,13 @@ static netdev_features_t harmonize_features(struct > sk_buff *skb, > return features; > } > > +static netdev_features_t dflt_features_check(struct sk_buff *skb, const struct sk_buff *skb > + struct net_device *dev, > + netdev_features_t features) > +{ > + return vlan_features_check(skb, features); > +} > + ------------------------------------------------------------------------------ Dive into the World of Parallel Programming The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ E1000-devel mailing list E1000-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/e1000-devel To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired