diff mbox series

[net-next] tcp: move sysctl_tcp_l3mdev_accept to netns_ipv4_read_rx

Message ID 20241009150504.2871093-1-edumazet@google.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tcp: move sysctl_tcp_l3mdev_accept to netns_ipv4_read_rx | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/apply fail Patch does not apply to net-next-0

Commit Message

Eric Dumazet Oct. 9, 2024, 3:05 p.m. UTC
sysctl_tcp_l3mdev_accept is read from TCP receive fast path from
tcp_v6_early_demux(),
 __inet6_lookup_established,
  inet_request_bound_dev_if().

Move it to netns_ipv4_read_rx.

Remove the '#ifdef CONFIG_NET_L3_MASTER_DEV' that was guarding
its definition.

Note this adds a hole of three bytes that could be filled later.

Fixes: 18fd64d25422 ("netns-ipv4: reorganize netns_ipv4 fast path variables")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Wei Wang <weiwan@google.com>
Cc: Coco Li <lixiaoyan@google.com>
---
 .../networking/net_cachelines/netns_ipv4_sysctl.rst          | 2 +-
 include/net/netns/ipv4.h                                     | 5 ++---
 net/core/net_namespace.c                                     | 4 +++-
 3 files changed, 6 insertions(+), 5 deletions(-)

Comments

David Ahern Oct. 9, 2024, 3:12 p.m. UTC | #1
On 10/9/24 9:05 AM, Eric Dumazet wrote:
> sysctl_tcp_l3mdev_accept is read from TCP receive fast path from
> tcp_v6_early_demux(),
>  __inet6_lookup_established,
>   inet_request_bound_dev_if().
> 
> Move it to netns_ipv4_read_rx.
> 
> Remove the '#ifdef CONFIG_NET_L3_MASTER_DEV' that was guarding
> its definition.
> 
> Note this adds a hole of three bytes that could be filled later.
> 
> Fixes: 18fd64d25422 ("netns-ipv4: reorganize netns_ipv4 fast path variables")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Cc: Wei Wang <weiwan@google.com>
> Cc: Coco Li <lixiaoyan@google.com>
> ---
>  .../networking/net_cachelines/netns_ipv4_sysctl.rst          | 2 +-
>  include/net/netns/ipv4.h                                     | 5 ++---
>  net/core/net_namespace.c                                     | 4 +++-
>  3 files changed, 6 insertions(+), 5 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@kernel.org>
Jakub Kicinski Oct. 10, 2024, 2:58 a.m. UTC | #2
On Wed,  9 Oct 2024 15:05:04 +0000 Eric Dumazet wrote:
>  .../networking/net_cachelines/netns_ipv4_sysctl.rst          | 2 +-

This will need a respin, I applied the formatting changes from Donald.
Eric Dumazet Oct. 10, 2024, 3:33 a.m. UTC | #3
On Thu, Oct 10, 2024 at 4:58 AM Jakub Kicinski <kuba@kernel.org> wrote:
>
> On Wed,  9 Oct 2024 15:05:04 +0000 Eric Dumazet wrote:
> >  .../networking/net_cachelines/netns_ipv4_sysctl.rst          | 2 +-
>
> This will need a respin, I applied the formatting changes from Donald.

Thanks Jakub, I will respin.
diff mbox series

Patch

diff --git a/Documentation/networking/net_cachelines/netns_ipv4_sysctl.rst b/Documentation/networking/net_cachelines/netns_ipv4_sysctl.rst
index 9b87089a84c61eddaa4e048da6cbb68c5e934ad6..b9855d95fc0d189db65aebae92564336ddeae7bd 100644
--- a/Documentation/networking/net_cachelines/netns_ipv4_sysctl.rst
+++ b/Documentation/networking/net_cachelines/netns_ipv4_sysctl.rst
@@ -58,7 +58,7 @@  u8                              sysctl_udp_early_demux
 u8                              sysctl_nexthop_compat_mode                   -                   -                   
 u8                              sysctl_fwmark_reflect                        -                   -                   
 u8                              sysctl_tcp_fwmark_accept                     -                   -                   
-u8                              sysctl_tcp_l3mdev_accept                     -                   -                   
+u8                              sysctl_tcp_l3mdev_accept                     -                   read_mostly         __inet6_lookup_established/inet_request_bound_dev_if
 u8                              sysctl_tcp_mtu_probing                       -                   -                   
 int                             sysctl_tcp_mtu_probe_floor                   -                   -                   
 int                             sysctl_tcp_base_mss                          -                   -                   
diff --git a/include/net/netns/ipv4.h b/include/net/netns/ipv4.h
index 276f622f3516871c438be27bafe61c039445b335..42866649901e36fbdd4e9f55645b22bdb6f86891 100644
--- a/include/net/netns/ipv4.h
+++ b/include/net/netns/ipv4.h
@@ -76,6 +76,8 @@  struct netns_ipv4 {
 	__cacheline_group_begin(netns_ipv4_read_rx);
 	u8 sysctl_ip_early_demux;
 	u8 sysctl_tcp_early_demux;
+	u8 sysctl_tcp_l3mdev_accept;
+	/* 3 bytes hole, try to pack */
 	int sysctl_tcp_reordering;
 	int sysctl_tcp_rmem[3];
 	__cacheline_group_end(netns_ipv4_read_rx);
@@ -151,9 +153,6 @@  struct netns_ipv4 {
 
 	u8 sysctl_fwmark_reflect;
 	u8 sysctl_tcp_fwmark_accept;
-#ifdef CONFIG_NET_L3_MASTER_DEV
-	u8 sysctl_tcp_l3mdev_accept;
-#endif
 	u8 sysctl_tcp_mtu_probing;
 	int sysctl_tcp_mtu_probe_floor;
 	int sysctl_tcp_base_mss;
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index a5bc1fd8b0341f401b6b48ea7c26b2ac07d1ddb6..0a86aff17f512bbeaa2795ab56748d8bb3b3fb71 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -1159,11 +1159,13 @@  static void __init netns_ipv4_struct_check(void)
 				      sysctl_ip_early_demux);
 	CACHELINE_ASSERT_GROUP_MEMBER(struct netns_ipv4, netns_ipv4_read_rx,
 				      sysctl_tcp_early_demux);
+	CACHELINE_ASSERT_GROUP_MEMBER(struct netns_ipv4, netns_ipv4_read_rx,
+				      sysctl_tcp_l3mdev_accept);
 	CACHELINE_ASSERT_GROUP_MEMBER(struct netns_ipv4, netns_ipv4_read_rx,
 				      sysctl_tcp_reordering);
 	CACHELINE_ASSERT_GROUP_MEMBER(struct netns_ipv4, netns_ipv4_read_rx,
 				      sysctl_tcp_rmem);
-	CACHELINE_ASSERT_GROUP_SIZE(struct netns_ipv4, netns_ipv4_read_rx, 18);
+	CACHELINE_ASSERT_GROUP_SIZE(struct netns_ipv4, netns_ipv4_read_rx, 22);
 }
 #endif