net: Add a skb_gro_flush_final helper.
authorSteffen Klassert <steffen.klassert@secunet.com>
Wed, 15 Feb 2017 08:39:39 +0000 (09:39 +0100)
committerSteffen Klassert <steffen.klassert@secunet.com>
Wed, 15 Feb 2017 08:39:39 +0000 (09:39 +0100)
Add a skb_gro_flush_final helper to prepare for  consuming
skbs in call_gro_receive. We will extend this helper to not
touch the skb if the skb is consumed by a gro callback with
a followup patch. We need this to handle the upcomming IPsec
ESP callbacks as they reinject the skb to the napi_gro_receive
asynchronous. The handler is used in all gro_receive functions
that can call the ESP gro handlers.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
include/linux/netdevice.h
net/ethernet/eth.c
net/ipv4/af_inet.c
net/ipv6/ip6_offload.c

index 58afbd1cc6597695da1d61cfa86f790a2379a49f..f9da3acfee9ac6d6eed0e023cb7daa2cb9e3c6a1 100644 (file)
@@ -2661,6 +2661,11 @@ static inline void skb_gro_remcsum_cleanup(struct sk_buff *skb,
        remcsum_unadjust((__sum16 *)ptr, grc->delta);
 }
 
+static inline void skb_gro_flush_final(struct sk_buff *skb, struct sk_buff **pp, int flush)
+{
+       NAPI_GRO_CB(skb)->flush |= flush;
+}
+
 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
                                  unsigned short type,
                                  const void *daddr, const void *saddr,
index efdaaab735fced4a3ed2ab38620d6f4d4de1566e..c666ff0dd88b26f32441cfc24f7d438fffe575f5 100644 (file)
@@ -474,7 +474,7 @@ struct sk_buff **eth_gro_receive(struct sk_buff **head,
 out_unlock:
        rcu_read_unlock();
 out:
-       NAPI_GRO_CB(skb)->flush |= flush;
+       skb_gro_flush_final(skb, pp, flush);
 
        return pp;
 }
index 685ba53df2d1ed9ff7a0d8386667635340102e57..602d40f43687c91db7250822439bacbe85318fa3 100644 (file)
@@ -1423,7 +1423,7 @@ out_unlock:
        rcu_read_unlock();
 
 out:
-       NAPI_GRO_CB(skb)->flush |= flush;
+       skb_gro_flush_final(skb, pp, flush);
 
        return pp;
 }
index fc7b4017ba241f9dd39d49bd6258ecd4a16e3a3a..0838e6d01d2e4979559cae63a20ca339a3e2c22c 100644 (file)
@@ -253,7 +253,7 @@ out_unlock:
        rcu_read_unlock();
 
 out:
-       NAPI_GRO_CB(skb)->flush |= flush;
+       skb_gro_flush_final(skb, pp, flush);
 
        return pp;
 }