"net: Add support for hardware-offloaded encapsulation" introduced the encapsulation field of struct skb, which when set provides hints that GSO should handle an skb that encapsulates a packet.
This patch adds an encapsulation_features field which provides a hint to dev dev_hard_start_xmit() that harware-offload encapsulation features should be used. Previously this hint was provided by the encapsulation field. The other uses of the encapsulation field are left unchanged. The two in-tree locations that set the encapsulation have been updated to also set encapsulation_field. The motivation for this is to provide support segmentation of GSO MPLS skbs. This may be necessary when a non-MPLS GSO skb is turned into an MPLS GSO skb by Open vSwtich and its MPLS push action. In this case it harware-offload encapsulation features should be used, actually to be more exact software segmentation should be selected, but other hints provided by the encapsulation field are not applicable. Cc: Joseph Gasparakis <joseph.gaspara...@intel.com> Cc: Peter P Waskiewicz Jr <peter.p.waskiewicz...@intel.com> Cc: Alexander Duyck <alexander.h.du...@intel.com> Signed-off-by: Simon Horman <ho...@verge.net.au> --- include/linux/skbuff.h | 9 ++++++++- net/core/dev.c | 2 +- net/core/skbuff.c | 1 + net/ipv4/gre.c | 1 + net/ipv4/ipip.c | 1 + 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h index e27d1c7..42e61c1 100644 --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h @@ -492,7 +492,14 @@ struct sk_buff { * headers if needed */ __u8 encapsulation:1; - /* 7/9 bit hole (depending on ndisc_nodetype presence) */ + /* Encapsulation protocol and NIC drivers should use + * this flag to indicate to each other if the skb contains + * encapsulated packet and GSO should use encapsulation features + * instead of standard features for the netdev. This is typically + * a subset of cases where skb->encapsulation is set. + */ + __u8 encapsulation_features:1; + /* 6/8 bit hole (depending on ndisc_nodetype presence) */ kmemcheck_bitfield_end(flags2); #ifdef CONFIG_NET_DMA diff --git a/net/core/dev.c b/net/core/dev.c index 3655ff9..ca81ac8 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2494,7 +2494,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev, * hardware encapsulation features instead of standard * features for the netdev */ - if (skb->encapsulation) + if (skb->encapsulation_features) features &= dev->hw_enc_features; if (netif_needs_gso(skb, features)) { diff --git a/net/core/skbuff.c b/net/core/skbuff.c index ba64614..7504371 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -680,6 +680,7 @@ static void __copy_skb_header(struct sk_buff *new, const struct sk_buff *old) new->l4_rxhash = old->l4_rxhash; new->no_fcs = old->no_fcs; new->encapsulation = old->encapsulation; + new->encapsulation_features = old->encapsulation_features; #ifdef CONFIG_XFRM new->sp = secpath_get(old->sp); #endif diff --git a/net/ipv4/gre.c b/net/ipv4/gre.c index 0ae998b..8420f29 100644 --- a/net/ipv4/gre.c +++ b/net/ipv4/gre.c @@ -157,6 +157,7 @@ static struct sk_buff *gre_gso_segment(struct sk_buff *skb, } skb->encapsulation = 0; + skb->encapsulation_features = 0; if (unlikely(!pskb_may_pull(skb, ghl))) goto out; diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c index 77bfcce..a6db3c0 100644 --- a/net/ipv4/ipip.c +++ b/net/ipv4/ipip.c @@ -220,6 +220,7 @@ static netdev_tx_t ipip_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) if (likely(!skb->encapsulation)) { skb_reset_inner_headers(skb); skb->encapsulation = 1; + skb->encapsulation_features = 1; } ip_tunnel_xmit(skb, dev, tiph); -- 1.7.10.4 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev