Skip to contentSkip to conversation

gro: get out of core files

PATCH Applied Eric Dumazet 3 participants 7 messages Nov 15, 2021 – Nov 19, 2021

Subsystems (13)
lore
Share & tools
lore
#0 lore raw

cover gro: get out of core files

From: Eric Dumazet <[email protected]>

Move GRO related content into net/core/gro.c
and include/net/gro.h.

This reduces GRO scope to where it is really needed, and shrinks too big files (include/linux/netdevice.h and net/core/dev.c)

Eric Dumazet (4):
net: move gro definitions to include/net/gro.h
net: gro: move skb_gro_receive_list to udp_offload.c
net: gro: move skb_gro_receive into net/core/gro.c
net: gro: populate net/core/gro.c

 .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.c   |   1 +
 drivers/net/ethernet/broadcom/bnxt/bnxt.c     |   1 +
 .../net/ethernet/hisilicon/hns3/hns3_enet.c   |   1 +
 .../net/ethernet/mellanox/mlx5/core/en_rx.c   |   1 +
 drivers/net/ethernet/qlogic/qede/qede_fp.c    |   1 +
 drivers/net/geneve.c                          |   1 +
 drivers/net/vxlan.c                           |   1 +
 include/linux/netdevice.h                     | 351 +-------
 include/net/gro.h                             | 420 +++++++++-
 include/net/ip.h                              |   8 -
 include/net/ip6_checksum.h                    |   8 -
 include/net/udp.h                             |  24 -
 net/core/Makefile                             |   2 +-
 net/core/dev.c                                | 668 +--------------
 net/core/gro.c                                | 766 ++++++++++++++++++
 net/core/skbuff.c                             | 142 ----
 net/ipv4/af_inet.c                            |   1 +
 net/ipv4/esp4_offload.c                       |   1 +
 net/ipv4/fou.c                                |   1 +
 net/ipv4/gre_offload.c                        |   1 +
 net/ipv4/tcp_offload.c                        |   1 +
 net/ipv4/udp_offload.c                        |  28 +
 net/ipv6/esp6_offload.c                       |   1 +
 net/ipv6/tcpv6_offload.c                      |   1 +
 net/ipv6/udp_offload.c                        |   1 +
 25 files changed, 1230 insertions(+), 1202 deletions(-)
 create mode 100644 net/core/gro.c
Signature · 1 line
2.34.0.rc1.387.gb447b232ab-goog
#1 lore raw

PATCH 1/4 net: move gro definitions to include/net/gro.h

From: Eric Dumazet <[email protected]>

include/linux/netdevice.h became too big, move gro stuff into include/net/gro.h

---
 .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.c   |   1 +
 drivers/net/ethernet/broadcom/bnxt/bnxt.c     |   1 +
 .../net/ethernet/hisilicon/hns3/hns3_enet.c   |   1 +
 .../net/ethernet/mellanox/mlx5/core/en_rx.c   |   1 +
 drivers/net/ethernet/qlogic/qede/qede_fp.c    |   1 +
 drivers/net/geneve.c                          |   1 +
 drivers/net/vxlan.c                           |   1 +
 include/linux/netdevice.h                     | 348 ---------------
 include/net/gro.h                             | 396 +++++++++++++++++-
 include/net/ip.h                              |   8 -
 include/net/ip6_checksum.h                    |   8 -
 include/net/udp.h                             |  24 --
 net/core/skbuff.c                             |   1 +
 net/ipv4/af_inet.c                            |   1 +
 net/ipv4/esp4_offload.c                       |   1 +
 net/ipv4/fou.c                                |   1 +
 net/ipv4/gre_offload.c                        |   1 +
 net/ipv4/tcp_offload.c                        |   1 +
 net/ipv4/udp_offload.c                        |   1 +
 net/ipv6/esp6_offload.c                       |   1 +
 net/ipv6/tcpv6_offload.c                      |   1 +
 net/ipv6/udp_offload.c                        |   1 +
 22 files changed, 411 insertions(+), 390 deletions(-)
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c +1 -0
index e8e8c2d593c558f15a9282c424ed23db7a256e71..54a2334dee56336a611a2410dc43a78eea83467b 100644
@@ -25,6 +25,7 @@
 #include <linux/ip.h>
 #include <linux/crash_dump.h>
 #include <net/tcp.h>
+#include <net/gro.h>
 #include <net/ipv6.h>
 #include <net/ip6_checksum.h>
 #include <linux/prefetch.h>
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -0
index c04ea83188e22d36e23c8262331aad26a4c1dc86..c057b1df86a9c9103ee8a682cb87ab92def5eed4 100644
@@ -37,6 +37,7 @@
 #include <linux/if_bridge.h>
 #include <linux/rtc.h>
 #include <linux/bpf.h>
+#include <net/gro.h>
 #include <net/ip.h>
 #include <net/tcp.h>
 #include <net/udp.h>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +1 -0
index 9ccebbaa0d696e748636a508053aa957c43841ae..13835a37b3a2fd13d557750fb3943172fc2eb700 100644
@@ -17,6 +17,7 @@
 #include <linux/skbuff.h>
 #include <linux/sctp.h>
 #include <net/gre.h>
+#include <net/gro.h>
 #include <net/ip6_checksum.h>
 #include <net/pkt_cls.h>
 #include <net/tcp.h>
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c +1 -0
index 96967b0a24418c5aa4018f5396a4a73f731a0c37..e384f6458c063b36faae8cf81910476c10fbd88b 100644
@@ -37,6 +37,7 @@
 #include <net/ip6_checksum.h>
 #include <net/page_pool.h>
 #include <net/inet_ecn.h>
+#include <net/gro.h>
 #include <net/udp.h>
 #include <net/tcp.h>
 #include "en.h"
drivers/net/ethernet/qlogic/qede/qede_fp.c +1 -0
index 065e9004598ee8f37e4669f48b5239a39426d62b..e113fbd56e869dee0ef7dc087d28907747a038b1 100644
@@ -10,6 +10,7 @@
 #include <linux/bpf_trace.h>
 #include <net/udp_tunnel.h>
 #include <linux/ip.h>
+#include <net/gro.h>
 #include <net/ipv6.h>
 #include <net/tcp.h>
 #include <linux/if_ether.h>
drivers/net/geneve.c +1 -0
index 1ab94b5f9bbf4a4402ddf0ea6e5b49004b1ff6f2..9d26d1b965d221c7eefbce47fc5e504b7f35cff6 100644
@@ -17,6 +17,7 @@
 #include <net/gro_cells.h>
 #include <net/rtnetlink.h>
 #include <net/geneve.h>
+#include <net/gro.h>
 #include <net/protocol.h>
 
 #define GENEVE_NETDEV_VER	"0.6"
drivers/net/vxlan.c +1 -0
index 141635a35c28a236f33c180dc2868c64338eccb1..563f86de0e0dce0ab994b5d8ec7cf59133c8dd38 100644
@@ -17,6 +17,7 @@
 #include <linux/ethtool.h>
 #include <net/arp.h>
 #include <net/ndisc.h>
+#include <net/gro.h>
 #include <net/ipv6_stubs.h>
 #include <net/ip.h>
 #include <net/icmp.h>
include/linux/netdevice.h +0 -348

360 lines not on this page · raw message

include/net/gro.h +394 -2

413 lines not on this page · raw message

include/net/ip.h +0 -8
index b71e88507c4a0907011c41e1ed0148eb873b5186..7d1088888c10c973a3f99802aaab566d0f07afbb 100644
@@ -568,14 +568,6 @@ static inline void iph_to_flow_copy_v4addrs(struct flow_keys *flow,
 	flow->control.addr_type = FLOW_DISSECTOR_KEY_IPV4_ADDRS;
 }
 
-static inline __wsum inet_gro_compute_pseudo(struct sk_buff *skb, int proto)
-{
-	const struct iphdr *iph = skb_gro_network_header(skb);
-
-	return csum_tcpudp_nofold(iph->saddr, iph->daddr,
-				  skb_gro_len(skb), proto, 0);
-}
-
 /*
  *	Map a multicast IP onto multicast MAC for type ethernet.
  */
include/net/ip6_checksum.h +0 -8
index b3f4eaa88672a2e64ec3fbb3e77a60fe383e59d9..a279e8ac730900fa473590f0c347e589c30a3274 100644
@@ -43,14 +43,6 @@ static inline __wsum ip6_compute_pseudo(struct sk_buff *skb, int proto)
 					    skb->len, proto, 0));
 }
 
-static inline __wsum ip6_gro_compute_pseudo(struct sk_buff *skb, int proto)
-{
-	const struct ipv6hdr *iph = skb_gro_network_header(skb);
-
-	return ~csum_unfold(csum_ipv6_magic(&iph->saddr, &iph->daddr,
-					    skb_gro_len(skb), proto, 0));
-}
-
 static __inline__ __sum16 tcp_v6_check(int len,
 				   const struct in6_addr *saddr,
 				   const struct in6_addr *daddr,
include/net/udp.h +0 -24
index 909ecf447e0fb2abaedf4d8954d2824c746fb251..f1c2a88c9005a86bc6e3dc35bdd0e8f7d3b3fe4a 100644
@@ -167,36 +167,12 @@ static inline void udp_csum_pull_header(struct sk_buff *skb)
 typedef struct sock *(*udp_lookup_t)(const struct sk_buff *skb, __be16 sport,
 				     __be16 dport);
 
-INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp4_gro_receive(struct list_head *,
-							   struct sk_buff *));
-INDIRECT_CALLABLE_DECLARE(int udp4_gro_complete(struct sk_buff *, int));
-INDIRECT_CALLABLE_DECLARE(struct sk_buff *udp6_gro_receive(struct list_head *,
-							   struct sk_buff *));
-INDIRECT_CALLABLE_DECLARE(int udp6_gro_complete(struct sk_buff *, int));
 INDIRECT_CALLABLE_DECLARE(void udp_v6_early_demux(struct sk_buff *));
 INDIRECT_CALLABLE_DECLARE(int udpv6_rcv(struct sk_buff *));
 
-struct sk_buff *udp_gro_receive(struct list_head *head, struct sk_buff *skb,
-				struct udphdr *uh, struct sock *sk);
-int udp_gro_complete(struct sk_buff *skb, int nhoff, udp_lookup_t lookup);
-
 struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
 				  netdev_features_t features, bool is_ipv6);
 
-static inline struct udphdr *udp_gro_udphdr(struct sk_buff *skb)
-{
-	struct udphdr *uh;
-	unsigned int hlen, off;
-
-	off  = skb_gro_offset(skb);
-	hlen = off + sizeof(*uh);
-	uh   = skb_gro_header_fast(skb, off);
-	if (skb_gro_header_hard(skb, hlen))
-		uh = skb_gro_header_slow(skb, hlen, off);
-
-	return uh;
-}
-
 /* hash routines shared between UDPv4/6 and UDP-Litev4/6 */
 static inline int udp_lib_hash(struct sock *sk)
 {
net/core/skbuff.c +1 -0
index ba2f38246f07e5ba5a4f97922b4be33bdb8ad6d6..1c4f2a2e52550eef6eb6002314813983abb2e266 100644
@@ -64,6 +64,7 @@
 
 #include <net/protocol.h>
 #include <net/dst.h>
+#include <net/gro.h>
 #include <net/sock.h>
 #include <net/checksum.h>
 #include <net/ip6_checksum.h>
net/ipv4/af_inet.c +1 -0
index 0189e3cd4a7df2dc2ea7121182ee290e0164df90..6d52b6491255b3452eb70373a36a602488e5f381 100644
@@ -99,6 +99,7 @@
 #include <net/route.h>
 #include <net/ip_fib.h>
 #include <net/inet_connection_sock.h>
+#include <net/gro.h>
 #include <net/tcp.h>
 #include <net/udp.h>
 #include <net/udplite.h>
net/ipv4/esp4_offload.c +1 -0
index 8e4e9aa12130dfdd2bcb52442fe688d03ddf4fae..d87f02a6e9346ad0dddcd1177664079140c468d8 100644
@@ -16,6 +16,7 @@
 #include <crypto/authenc.h>
 #include <linux/err.h>
 #include <linux/module.h>
+#include <net/gro.h>
 #include <net/ip.h>
 #include <net/xfrm.h>
 #include <net/esp.h>
net/ipv4/fou.c +1 -0
index 8fcbc6258ec527f3069f7a525d33929c0ffa1bdf..b56d6b40c0a26f3b70226937779e355b504b79bd 100644
@@ -9,6 +9,7 @@
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <net/genetlink.h>
+#include <net/gro.h>
 #include <net/gue.h>
 #include <net/fou.h>
 #include <net/ip.h>
net/ipv4/gre_offload.c +1 -0
index 1121a9d5fed921abddd0d04cbef9b406b6b86ab5..740298dac7d32f7bef1d69214d65c665c18b649c 100644
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <net/protocol.h>
 #include <net/gre.h>
+#include <net/gro.h>
 
 static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
 				       netdev_features_t features)
net/ipv4/tcp_offload.c +1 -0
index fc61cd3fea652b04ea1fe62972510dc0fd66a6da..30abde86db45e560680669ddfb533bcf12deacb0 100644
@@ -8,6 +8,7 @@
 
 #include <linux/indirect_call_wrapper.h>
 #include <linux/skbuff.h>
+#include <net/gro.h>
 #include <net/tcp.h>
 #include <net/protocol.h>
 
net/ipv4/udp_offload.c +1 -0
index 86d32a1e62ac969fae1879c8cb5f992c1b026987..7fbf9975e8c0e9f0aa6a707bb63b55628ca6add8 100644
@@ -7,6 +7,7 @@
  */
 
 #include <linux/skbuff.h>
+#include <net/gro.h>
 #include <net/udp.h>
 #include <net/protocol.h>
 #include <net/inet_common.h>
net/ipv6/esp6_offload.c +1 -0
index a349d479807764f0ec32789b1676def4259d08a0..ba5e81cd569c8a0128d00c0e6e4eb0dadabb246d 100644
@@ -16,6 +16,7 @@
 #include <crypto/authenc.h>
 #include <linux/err.h>
 #include <linux/module.h>
+#include <net/gro.h>
 #include <net/ip.h>
 #include <net/xfrm.h>
 #include <net/esp.h>
net/ipv6/tcpv6_offload.c +1 -0
index 1796856bc24f55c6d9b35b9aa2fbf3892f16dd9b..39db5a2268550b54da126e59ea6b6f6c0fc24b1c 100644
@@ -7,6 +7,7 @@
  */
 #include <linux/indirect_call_wrapper.h>
 #include <linux/skbuff.h>
+#include <net/gro.h>
 #include <net/protocol.h>
 #include <net/tcp.h>
 #include <net/ip6_checksum.h>
net/ipv6/udp_offload.c +1 -0
index b3d9ed96e5ea56bf75b8cc10a28027c961a296e9..50a8a65fad2324d124bcd26eaa93b1ffb9cccc7f 100644
@@ -13,6 +13,7 @@
 #include <net/udp.h>
 #include <net/ip6_checksum.h>
 #include "ip6_offload.h"
+#include <net/gro.h>
 
 static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
 					 netdev_features_t features)
Signature · 1 line
2.34.0.rc1.387.gb447b232ab-goog
#2 lore raw

Re: [PATCH net-next 1/4] net: move gro definitions to include/net/gro.h

I love your patch! Yet something to improve:

Hi Eric,

I love your patch! Yet something to improve:

[auto build test ERROR on net-next/master]

url:    https://github.com/0day-ci/linux/commits/Eric-Dumazet/gro-get-out-of-core-files/20211116-010906
base:   https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 1274a4eb318debe33e395bb8bcf8b98e6eb4670f
config: csky-defconfig (attached as .config)
compiler: csky-linux-gcc (GCC) 11.2.0

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/4a142ba0812a293afcb259b08c89ab80cb3dac6d
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Eric-Dumazet/gro-get-out-of-core-files/20211116-010906 git checkout 4a142ba0812a293afcb259b08c89ab80cb3dac6d
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=csky

If you fix the issue, kindly add following tag as appropriate

All errors (new ones prefixed by >>):

In file included from net/ipv4/af_inet.c:102:
include/net/gro.h: In function 'ip6_gro_compute_pseudo':
include/net/gro.h:413:29: error: implicit declaration of function 'csum_ipv6_magic'; did you mean 'csum_tcpudp_magic'? [-Werror=implicit-function-declaration]

     413 |         return ~csum_unfold(csum_ipv6_magic(&iph->saddr, &iph->daddr,
         |                             ^~~~~~~~~~~~~~~
         |                             csum_tcpudp_magic
   In file included from include/net/udplite.h:8,
                    from net/ipv4/af_inet.c:105:
   include/net/ip6_checksum.h: At top level:
>> include/net/ip6_checksum.h:34:9: error: conflicting types for 'csum_ipv6_magic'; have '__sum16(const struct in6_addr *, const struct in6_addr *, __u32,  __u8,  __wsum)' {aka 'short unsigned int(const struct in6_addr *, const struct in6_addr *, unsigned int,  unsigned char,  unsigned int)'}
      34 | __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
         |         ^~~~~~~~~~~~~~~
   In file included from net/ipv4/af_inet.c:102:
   include/net/gro.h:413:29: note: previous implicit declaration of 'csum_ipv6_magic' with type 'int()'
     413 |         return ~csum_unfold(csum_ipv6_magic(&iph->saddr, &iph->daddr,
         |                             ^~~~~~~~~~~~~~~

cc1: some warnings being treated as errors

vim +34 include/net/ip6_checksum.h

^1da177e4c3f41 Linus Torvalds  2005-04-16  32  
^1da177e4c3f41 Linus Torvalds  2005-04-16  33  #ifndef _HAVE_ARCH_IPV6_CSUM
acb3e04119fbf9 Cong Wang       2013-01-07 @34  __sum16 csum_ipv6_magic(const struct in6_addr *saddr,
56649d5d3c4cb0 Al Viro         2006-11-14  35  			const struct in6_addr *daddr,
1e94082963747b Alexander Duyck 2016-03-11  36  			__u32 len, __u8 proto, __wsum csum);
^1da177e4c3f41 Linus Torvalds  2005-04-16  37  #endif
8663e02aba154e Vlad Yasevich   2012-11-15  38  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

#3 lore raw

PATCH 2/4 net: gro: move skb_gro_receive_list to udp_offload.c

In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>

This helper is used once, no need to keep it in fat net/core/skbuff.c

---
 include/linux/netdevice.h |  1 -
 net/core/skbuff.c         | 26 --------------------------
 net/ipv4/udp_offload.c    | 27 +++++++++++++++++++++++++++
 3 files changed, 27 insertions(+), 27 deletions(-)
include/linux/netdevice.h +0 -1
index d95c9839ce90d611f4b729c7c54e277446259c7a..ce6ee1453dbc3691fab13ee079347fbd49e587d3 100644
@@ -2903,7 +2903,6 @@ struct net_device *dev_get_by_napi_id(unsigned int napi_id);
 int netdev_get_name(struct net *net, char *name, int ifindex);
 int dev_restart(struct net_device *dev);
 int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb);
-int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb);
 
 
 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
net/core/skbuff.c +0 -26
index 1c4f2a2e52550eef6eb6002314813983abb2e266..68b13bc77b749dbacf739a71ef7a1b5f48d89e0c 100644
@@ -3920,32 +3920,6 @@ struct sk_buff *skb_segment_list(struct sk_buff *skb,
 }
 EXPORT_SYMBOL_GPL(skb_segment_list);
 
-int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb)
-{
-	if (unlikely(p->len + skb->len >= 65536))
-		return -E2BIG;
-
-	if (NAPI_GRO_CB(p)->last == p)
-		skb_shinfo(p)->frag_list = skb;
-	else
-		NAPI_GRO_CB(p)->last->next = skb;
-
-	skb_pull(skb, skb_gro_offset(skb));
-
-	NAPI_GRO_CB(p)->last = skb;
-	NAPI_GRO_CB(p)->count++;
-	p->data_len += skb->len;
-
-	/* sk owenrship - if any - completely transferred to the aggregated packet */
-	skb->destructor = NULL;
-	p->truesize += skb->truesize;
-	p->len += skb->len;
-
-	NAPI_GRO_CB(skb)->same_flow = 1;
-
-	return 0;
-}
-
 /**
  *	skb_segment - Perform protocol segmentation on skb.
  *	@head_skb: buffer to segment
net/ipv4/udp_offload.c +27 -0
index 7fbf9975e8c0e9f0aa6a707bb63b55628ca6add8..cbeb8965d1b771b4d50c888a42279287904304e9 100644
@@ -425,6 +425,33 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
 	return segs;
 }
 
+static int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb)
+{
+	if (unlikely(p->len + skb->len >= 65536))
+		return -E2BIG;
+
+	if (NAPI_GRO_CB(p)->last == p)
+		skb_shinfo(p)->frag_list = skb;
+	else
+		NAPI_GRO_CB(p)->last->next = skb;
+
+	skb_pull(skb, skb_gro_offset(skb));
+
+	NAPI_GRO_CB(p)->last = skb;
+	NAPI_GRO_CB(p)->count++;
+	p->data_len += skb->len;
+
+	/* sk owenrship - if any - completely transferred to the aggregated packet */
+	skb->destructor = NULL;
+	p->truesize += skb->truesize;
+	p->len += skb->len;
+
+	NAPI_GRO_CB(skb)->same_flow = 1;
+
+	return 0;
+}
+
+
 #define UDP_GRO_CNT_MAX 64
 static struct sk_buff *udp_gro_receive_segment(struct list_head *head,
 					       struct sk_buff *skb)
Signature · 1 line
2.34.0.rc1.387.gb447b232ab-goog
#4 lore raw

PATCH 3/4 net: gro: move skb_gro_receive into net/core/gro.c

In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>

net/core/gro.c will contain all core gro functions, to shrink net/core/skbuff.c and net/core/dev.c

---
 include/linux/netdevice.h |   1 -
 include/net/gro.h         |   2 +
 net/core/Makefile         |   2 +-
 net/core/gro.c            | 118 ++++++++++++++++++++++++++++++++++++++
 net/core/skbuff.c         | 117 -------------------------------------
 5 files changed, 121 insertions(+), 119 deletions(-)
 create mode 100644 net/core/gro.c
include/linux/netdevice.h +0 -1
index ce6ee1453dbc3691fab13ee079347fbd49e587d3..93d397db9ec417b92192296374ebc672bde557a3 100644
@@ -2902,7 +2902,6 @@ struct net_device *dev_get_by_index_rcu(struct net *net, int ifindex);
 struct net_device *dev_get_by_napi_id(unsigned int napi_id);
 int netdev_get_name(struct net *net, char *name, int ifindex);
 int dev_restart(struct net_device *dev);
-int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb);
 
 
 static inline int dev_hard_header(struct sk_buff *skb, struct net_device *dev,
include/net/gro.h +2 -0
index 1ffbe74b2e35eb2f24343da1765633ba7e74ab67..f988bf3440f8972151848d6321713b1a0184df59 100644
@@ -414,4 +414,6 @@ static inline __wsum ip6_gro_compute_pseudo(struct sk_buff *skb, int proto)
 					    skb_gro_len(skb), proto, 0));
 }
 
+int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb);
+
 #endif /* _NET_IPV6_GRO_H */
net/core/Makefile +1 -1
index 4268846f2f4759b4dbd759ea7206287781ef9a3d..6bdcb2cafed8e6bcac499798b800c11715ca9204 100644
@@ -11,7 +11,7 @@ obj-$(CONFIG_SYSCTL) += sysctl_net_core.o
 obj-y		     += dev.o dev_addr_lists.o dst.o netevent.o \
 			neighbour.o rtnetlink.o utils.o link_watch.o filter.o \
 			sock_diag.o dev_ioctl.o tso.o sock_reuseport.o \
-			fib_notifier.o xdp.o flow_offload.o
+			fib_notifier.o xdp.o flow_offload.o gro.o
 
 obj-y += net-sysfs.o
 obj-$(CONFIG_PAGE_POOL) += page_pool.o
net/core/gro.c new file +118 -0

118 lines not on this page · raw message

net/core/skbuff.c +0 -117

129 lines not on this page · raw message

Signature · 1 line
2.34.0.rc1.387.gb447b232ab-goog
#5 lore raw

PATCH 4/4 net: gro: populate net/core/gro.c

In reply to Eric Dumazet

From: Eric Dumazet <[email protected]>

Move gro code and data from net/core/dev.c to net/core/gro.c to ease maintenance.

gro_normal_list() and gro_normal_one() are inlined because they are called from both files.

---
 include/linux/netdevice.h |   1 +
 include/net/gro.h         |  22 ++
 net/core/dev.c            | 668 +-------------------------------------
 net/core/gro.c            | 648 ++++++++++++++++++++++++++++++++++++
 4 files changed, 672 insertions(+), 667 deletions(-)
include/linux/netdevice.h +1 -0
index 93d397db9ec417b92192296374ebc672bde557a3..31a7e6b2768123021690a3dc8572c5e8cb0e0027 100644
@@ -3657,6 +3657,7 @@ int netif_rx_ni(struct sk_buff *skb);
 int netif_rx_any_context(struct sk_buff *skb);
 int netif_receive_skb(struct sk_buff *skb);
 int netif_receive_skb_core(struct sk_buff *skb);
+void netif_receive_skb_list_internal(struct list_head *head);
 void netif_receive_skb_list(struct list_head *head);
 gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb);
 void napi_gro_flush(struct napi_struct *napi, bool flush_old);
include/net/gro.h +22 -0
index f988bf3440f8972151848d6321713b1a0184df59..d0e7df691a807410049508355230a4523af590a1 100644
@@ -416,4 +416,26 @@ static inline __wsum ip6_gro_compute_pseudo(struct sk_buff *skb, int proto)
 
 int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb);
 
+/* Pass the currently batched GRO_NORMAL SKBs up to the stack. */
+static inline void gro_normal_list(struct napi_struct *napi)
+{
+	if (!napi->rx_count)
+		return;
+	netif_receive_skb_list_internal(&napi->rx_list);
+	INIT_LIST_HEAD(&napi->rx_list);
+	napi->rx_count = 0;
+}
+
+/* Queue one GRO_NORMAL SKB up for list processing. If batch size exceeded,
+ * pass the whole batch up to the stack.
+ */
+static inline void gro_normal_one(struct napi_struct *napi, struct sk_buff *skb, int segs)
+{
+	list_add_tail(&skb->list, &napi->rx_list);
+	napi->rx_count += segs;
+	if (napi->rx_count >= gro_normal_batch)
+		gro_normal_list(napi);
+}
+
+
 #endif /* _NET_IPV6_GRO_H */
net/core/dev.c +1 -667

714 lines not on this page · raw message

net/core/gro.c +648 -0

656 lines not on this page · raw message

Signature · 1 line
2.34.0.rc1.387.gb447b232ab-goog
#6 lore raw
In reply to Eric Dumazet
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Hello:

This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:

Quoted 10 lines · On Mon, 15 Nov 2021 09:05:50 -0800 you wrote:

From: Eric Dumazet <[email protected]>

Move GRO related content into net/core/gro.c
and include/net/gro.h.

This reduces GRO scope to where it is really needed, and shrinks too big files (include/linux/netdevice.h and net/core/dev.c)

[...]

Here is the summary with links:
- [net-next,1/4] net: move gro definitions to include/net/gro.h

    https://git.kernel.org/netdev/net-next/c/4721031c3559
  - [net-next,2/4] net: gro: move skb_gro_receive_list to udp_offload.c
    https://git.kernel.org/netdev/net-next/c/0b935d7f8c07
  - [net-next,3/4] net: gro: move skb_gro_receive into net/core/gro.c
    https://git.kernel.org/netdev/net-next/c/e456a18a390b
  - [net-next,4/4] net: gro: populate net/core/gro.c
    https://git.kernel.org/netdev/net-next/c/587652bbdd06

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html