Commit 571bf020 authored by Eric Dumazet's avatar Eric Dumazet Committed by Jakub Kicinski

inet: move tcp_protocol and udp_protocol to net_hotdata

These structures are read in rx path, move them to net_hotdata
for better cache locality.
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Acked-by: default avatarSoheil Hassas Yeganeh <soheil@google.com>
Reviewed-by: default avatarDavid Ahern <dsahern@kernel.org>
Link: https://lore.kernel.org/r/20240306160031.874438-14-edumazet@google.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 4ea0875b
...@@ -11,7 +11,9 @@ struct net_hotdata { ...@@ -11,7 +11,9 @@ struct net_hotdata {
#if IS_ENABLED(CONFIG_INET) #if IS_ENABLED(CONFIG_INET)
struct packet_offload ip_packet_offload; struct packet_offload ip_packet_offload;
struct net_offload tcpv4_offload; struct net_offload tcpv4_offload;
struct net_protocol tcp_protocol;
struct net_offload udpv4_offload; struct net_offload udpv4_offload;
struct net_protocol udp_protocol;
struct packet_offload ipv6_packet_offload; struct packet_offload ipv6_packet_offload;
struct net_offload tcpv6_offload; struct net_offload tcpv6_offload;
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
......
...@@ -1751,19 +1751,6 @@ static const struct net_protocol igmp_protocol = { ...@@ -1751,19 +1751,6 @@ static const struct net_protocol igmp_protocol = {
}; };
#endif #endif
static const struct net_protocol tcp_protocol = {
.handler = tcp_v4_rcv,
.err_handler = tcp_v4_err,
.no_policy = 1,
.icmp_strict_tag_validation = 1,
};
static const struct net_protocol udp_protocol = {
.handler = udp_rcv,
.err_handler = udp_err,
.no_policy = 1,
};
static const struct net_protocol icmp_protocol = { static const struct net_protocol icmp_protocol = {
.handler = icmp_rcv, .handler = icmp_rcv,
.err_handler = icmp_err, .err_handler = icmp_err,
...@@ -1992,9 +1979,22 @@ static int __init inet_init(void) ...@@ -1992,9 +1979,22 @@ static int __init inet_init(void)
if (inet_add_protocol(&icmp_protocol, IPPROTO_ICMP) < 0) if (inet_add_protocol(&icmp_protocol, IPPROTO_ICMP) < 0)
pr_crit("%s: Cannot add ICMP protocol\n", __func__); pr_crit("%s: Cannot add ICMP protocol\n", __func__);
if (inet_add_protocol(&udp_protocol, IPPROTO_UDP) < 0)
net_hotdata.udp_protocol = (struct net_protocol) {
.handler = udp_rcv,
.err_handler = udp_err,
.no_policy = 1,
};
if (inet_add_protocol(&net_hotdata.udp_protocol, IPPROTO_UDP) < 0)
pr_crit("%s: Cannot add UDP protocol\n", __func__); pr_crit("%s: Cannot add UDP protocol\n", __func__);
if (inet_add_protocol(&tcp_protocol, IPPROTO_TCP) < 0)
net_hotdata.tcp_protocol = (struct net_protocol) {
.handler = tcp_v4_rcv,
.err_handler = tcp_v4_err,
.no_policy = 1,
.icmp_strict_tag_validation = 1,
};
if (inet_add_protocol(&net_hotdata.tcp_protocol, IPPROTO_TCP) < 0)
pr_crit("%s: Cannot add TCP protocol\n", __func__); pr_crit("%s: Cannot add TCP protocol\n", __func__);
#ifdef CONFIG_IP_MULTICAST #ifdef CONFIG_IP_MULTICAST
if (inet_add_protocol(&igmp_protocol, IPPROTO_IGMP) < 0) if (inet_add_protocol(&igmp_protocol, IPPROTO_IGMP) < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment