mirror of
https://github.com/torvalds/linux
synced 2024-09-06 18:01:05 +00:00
net: move tcpv4_offload and tcpv6_offload to net_hotdata
These are used in TCP fast paths. Move them into net_hotdata for better cache locality. v2: tcpv6_offload definition depends on CONFIG_INET Signed-off-by: Eric Dumazet <edumazet@google.com> Acked-by: Soheil Hassas Yeganeh <soheil@google.com> Reviewed-by: David Ahern <dsahern@kernel.org> Link: https://lore.kernel.org/r/20240306160031.874438-8-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
61a0be1a53
commit
0139806eeb
|
@ -4,12 +4,15 @@
|
|||
|
||||
#include <linux/types.h>
|
||||
#include <linux/netdevice.h>
|
||||
#include <net/protocol.h>
|
||||
|
||||
/* Read mostly data used in network fast paths. */
|
||||
struct net_hotdata {
|
||||
#if IS_ENABLED(CONFIG_INET)
|
||||
struct packet_offload ip_packet_offload;
|
||||
struct net_offload tcpv4_offload;
|
||||
struct packet_offload ipv6_packet_offload;
|
||||
struct net_offload tcpv6_offload;
|
||||
#endif
|
||||
struct list_head offload_base;
|
||||
struct list_head ptype_all;
|
||||
|
|
|
@ -345,15 +345,14 @@ INDIRECT_CALLABLE_SCOPE int tcp4_gro_complete(struct sk_buff *skb, int thoff)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static const struct net_offload tcpv4_offload = {
|
||||
.callbacks = {
|
||||
.gso_segment = tcp4_gso_segment,
|
||||
.gro_receive = tcp4_gro_receive,
|
||||
.gro_complete = tcp4_gro_complete,
|
||||
},
|
||||
};
|
||||
|
||||
int __init tcpv4_offload_init(void)
|
||||
{
|
||||
return inet_add_offload(&tcpv4_offload, IPPROTO_TCP);
|
||||
net_hotdata.tcpv4_offload = (struct net_offload) {
|
||||
.callbacks = {
|
||||
.gso_segment = tcp4_gso_segment,
|
||||
.gro_receive = tcp4_gro_receive,
|
||||
.gro_complete = tcp4_gro_complete,
|
||||
},
|
||||
};
|
||||
return inet_add_offload(&net_hotdata.tcpv4_offload, IPPROTO_TCP);
|
||||
}
|
||||
|
|
|
@ -66,15 +66,15 @@ static struct sk_buff *tcp6_gso_segment(struct sk_buff *skb,
|
|||
|
||||
return tcp_gso_segment(skb, features);
|
||||
}
|
||||
static const struct net_offload tcpv6_offload = {
|
||||
.callbacks = {
|
||||
.gso_segment = tcp6_gso_segment,
|
||||
.gro_receive = tcp6_gro_receive,
|
||||
.gro_complete = tcp6_gro_complete,
|
||||
},
|
||||
};
|
||||
|
||||
int __init tcpv6_offload_init(void)
|
||||
{
|
||||
return inet6_add_offload(&tcpv6_offload, IPPROTO_TCP);
|
||||
net_hotdata.tcpv6_offload = (struct net_offload) {
|
||||
.callbacks = {
|
||||
.gso_segment = tcp6_gso_segment,
|
||||
.gro_receive = tcp6_gro_receive,
|
||||
.gro_complete = tcp6_gro_complete,
|
||||
},
|
||||
};
|
||||
return inet6_add_offload(&net_hotdata.tcpv6_offload, IPPROTO_TCP);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue