All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org, David Ahern <dsahern@kernel.org>,
	 Willem de Bruijn <willemb@google.com>,
	Soheil Hassas Yeganeh <soheil@google.com>,
	 Neal Cardwell <ncardwell@google.com>,
	eric.dumazet@gmail.com,  Eric Dumazet <edumazet@google.com>
Subject: [PATCH net-next 06/18] net: move ip_packet_offload and ipv6_packet_offload to net_hotdata
Date: Tue,  5 Mar 2024 16:04:01 +0000	[thread overview]
Message-ID: <20240305160413.2231423-7-edumazet@google.com> (raw)
In-Reply-To: <20240305160413.2231423-1-edumazet@google.com>

These structures are used in GRO and GSO paths.

Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 include/net/hotdata.h  |  7 +++++++
 net/ipv4/af_inet.c     | 18 +++++++++---------
 net/ipv6/ip6_offload.c | 18 +++++++++---------
 3 files changed, 25 insertions(+), 18 deletions(-)

diff --git a/include/net/hotdata.h b/include/net/hotdata.h
index dc50b200a94b6b935cd79d8e0406a61209fdc68e..ec752d234c5ed4b9c110c9e61c143fe8fc27089e 100644
--- a/include/net/hotdata.h
+++ b/include/net/hotdata.h
@@ -3,9 +3,16 @@
 #define _NET_HOTDATA_H
 
 #include <linux/types.h>
+#include <linux/netdevice.h>
 
 /* Read mostly data used in network fast paths. */
 struct net_hotdata {
+#if IS_ENABLED(CONFIG_INET)
+	struct packet_offload	ip_packet_offload;
+#endif
+#if IS_ENABLED(CONFIG_IPV6)
+	struct packet_offload	ipv6_packet_offload;
+#endif
 	struct list_head	offload_base;
 	struct list_head	ptype_all;
 	int			gro_normal_batch;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 5daebdcbca326aa1fc042e1e1ff1e82a18bd283d..08dda6955562ea6b89e02b8299b03ab52b342f27 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1904,14 +1904,6 @@ static int ipv4_proc_init(void);
  *	IP protocol layer initialiser
  */
 
-static struct packet_offload ip_packet_offload __read_mostly = {
-	.type = cpu_to_be16(ETH_P_IP),
-	.callbacks = {
-		.gso_segment = inet_gso_segment,
-		.gro_receive = inet_gro_receive,
-		.gro_complete = inet_gro_complete,
-	},
-};
 
 static const struct net_offload ipip_offload = {
 	.callbacks = {
@@ -1938,7 +1930,15 @@ static int __init ipv4_offload_init(void)
 	if (ipip_offload_init() < 0)
 		pr_crit("%s: Cannot add IPIP protocol offload\n", __func__);
 
-	dev_add_offload(&ip_packet_offload);
+	net_hotdata.ip_packet_offload = (struct packet_offload) {
+		.type = cpu_to_be16(ETH_P_IP),
+		.callbacks = {
+			.gso_segment = inet_gso_segment,
+			.gro_receive = inet_gro_receive,
+			.gro_complete = inet_gro_complete,
+		},
+	};
+	dev_add_offload(&net_hotdata.ip_packet_offload);
 	return 0;
 }
 
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index cca64c7809bee9a0360cbfab6a645d3f8d2ffea3..b41e35af69ea2835aa47d6ca01d9b109d4092462 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -419,14 +419,6 @@ static int ip4ip6_gro_complete(struct sk_buff *skb, int nhoff)
 	return inet_gro_complete(skb, nhoff);
 }
 
-static struct packet_offload ipv6_packet_offload __read_mostly = {
-	.type = cpu_to_be16(ETH_P_IPV6),
-	.callbacks = {
-		.gso_segment = ipv6_gso_segment,
-		.gro_receive = ipv6_gro_receive,
-		.gro_complete = ipv6_gro_complete,
-	},
-};
 
 static struct sk_buff *sit_gso_segment(struct sk_buff *skb,
 				       netdev_features_t features)
@@ -486,7 +478,15 @@ static int __init ipv6_offload_init(void)
 	if (ipv6_exthdrs_offload_init() < 0)
 		pr_crit("%s: Cannot add EXTHDRS protocol offload\n", __func__);
 
-	dev_add_offload(&ipv6_packet_offload);
+	net_hotdata.ipv6_packet_offload = (struct packet_offload) {
+		.type = cpu_to_be16(ETH_P_IPV6),
+		.callbacks = {
+			.gso_segment = ipv6_gso_segment,
+			.gro_receive = ipv6_gro_receive,
+			.gro_complete = ipv6_gro_complete,
+		},
+	};
+	dev_add_offload(&net_hotdata.ipv6_packet_offload);
 
 	inet_add_offload(&sit_offload, IPPROTO_IPV6);
 	inet6_add_offload(&ip6ip6_offload, IPPROTO_IPV6);
-- 
2.44.0.278.ge034bb2e1d-goog


  parent reply	other threads:[~2024-03-05 16:04 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-05 16:03 [PATCH net-next 00/18] net: group together hot data Eric Dumazet
2024-03-05 16:03 ` [PATCH net-next 01/18] net: introduce struct net_hotdata Eric Dumazet
2024-03-05 16:03 ` [PATCH net-next 02/18] net: move netdev_budget and netdev_budget to net_hotdata Eric Dumazet
2024-03-08  2:26   ` Andrew Lunn
2024-03-05 16:03 ` [PATCH net-next 03/18] net: move netdev_tstamp_prequeue into net_hotdata Eric Dumazet
2024-03-05 16:03 ` [PATCH net-next 04/18] net: move ptype_all " Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 05/18] net: move netdev_max_backlog to net_hotdata Eric Dumazet
2024-03-05 16:04 ` Eric Dumazet [this message]
2024-03-06  6:08   ` [PATCH net-next 06/18] net: move ip_packet_offload and ipv6_packet_offload " kernel test robot
2024-03-06  9:00     ` Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 07/18] net: move tcpv4_offload and tcpv6_offload " Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 08/18] net: move dev_tx_weight " Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 09/18] net: move dev_rx_weight " Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 10/18] net: move skbuff_cache(s) " Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 11/18] udp: move udpv4_offload and udpv6_offload " Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 12/18] ipv6: move tcpv6_protocol and udpv6_protocol " Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 13/18] inet: move tcp_protocol and udp_protocol " Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 14/18] inet: move inet_ehash_secret and udp_ehash_secret into net_hotdata Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 15/18] ipv6: move inet6_ehash_secret and udp6_ehash_secret " Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 16/18] ipv6: move tcp_ipv6_hash_secret and udp_ipv6_hash_secret to net_hotdata Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 17/18] net: introduce include/net/rps.h Eric Dumazet
2024-03-05 16:04 ` [PATCH net-next 18/18] net: move rps_sock_flow_table to net_hotdata Eric Dumazet
2024-03-05 18:28 ` [PATCH net-next 00/18] net: group together hot data Soheil Hassas Yeganeh
2024-03-06  4:39 ` David Ahern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240305160413.2231423-7-edumazet@google.com \
    --to=edumazet@google.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=soheil@google.com \
    --cc=willemb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.