* [PATCH net-next v4] net-timestamp: namespacify the sysctl_tstamp_allow_data
@ 2024-10-05 22:26 Jason Xing
2024-10-06 15:30 ` Kuniyuki Iwashima
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Jason Xing @ 2024-10-05 22:26 UTC (permalink / raw)
To: davem, edumazet, kuba, pabeni, willemdebruijn.kernel, willemb,
kuniyu
Cc: netdev, Jason Xing
From: Jason Xing <kernelxing@tencent.com>
Let it be tuned in per netns by admins.
Signed-off-by: Jason Xing <kernelxing@tencent.com>
---
v4
Link: https://lore.kernel.org/all/20241003104035.22374-1-kerneljasonxing@gmail.com/
1. use u8 instead of int to save more bytes (Kuniyuki)
v3
Link: https://lore.kernel.org/all/CANn89iLVRPHQ0TzWWOs8S1hA5Uwck_j=tPAQquv+qDf8bMkmYQ@mail.gmail.com/
1. move sysctl_tstamp_allow_data after sysctl_txrehash (Eric)
v2
Link: https://lore.kernel.org/all/66fa81b2ddf10_17948d294bb@willemb.c.googlers.com.notmuch/
1. remove the static global from sock.c
2. reorder the tests
3. I removed the patch [1/3] because I made one mistake
4. I also removed the patch [2/3] because Willem soon will propose a
packetdrill test that is better.
Now, I only need to write this standalone patch.
---
include/net/netns/core.h | 1 +
include/net/sock.h | 2 --
net/core/net_namespace.c | 1 +
net/core/skbuff.c | 2 +-
net/core/sock.c | 2 --
net/core/sysctl_net_core.c | 18 +++++++++---------
6 files changed, 12 insertions(+), 14 deletions(-)
diff --git a/include/net/netns/core.h b/include/net/netns/core.h
index 78214f1b43a2..9b36f0ff0c20 100644
--- a/include/net/netns/core.h
+++ b/include/net/netns/core.h
@@ -15,6 +15,7 @@ struct netns_core {
int sysctl_somaxconn;
int sysctl_optmem_max;
u8 sysctl_txrehash;
+ u8 sysctl_tstamp_allow_data;
#ifdef CONFIG_PROC_FS
struct prot_inuse __percpu *prot_inuse;
diff --git a/include/net/sock.h b/include/net/sock.h
index c58ca8dd561b..4f31be0fd671 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -2808,8 +2808,6 @@ void sk_get_meminfo(const struct sock *sk, u32 *meminfo);
extern __u32 sysctl_wmem_max;
extern __u32 sysctl_rmem_max;
-extern int sysctl_tstamp_allow_data;
-
extern __u32 sysctl_wmem_default;
extern __u32 sysctl_rmem_default;
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index e39479f1c9a4..e78c01912c64 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -317,6 +317,7 @@ static __net_init void preinit_net_sysctl(struct net *net)
*/
net->core.sysctl_optmem_max = 128 * 1024;
net->core.sysctl_txrehash = SOCK_TXREHASH_ENABLED;
+ net->core.sysctl_tstamp_allow_data = 1;
}
/* init code that must occur even if setup_net() is not called. */
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 74149dc4ee31..00afeb90c23a 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -5506,7 +5506,7 @@ static bool skb_may_tx_timestamp(struct sock *sk, bool tsonly)
{
bool ret;
- if (likely(READ_ONCE(sysctl_tstamp_allow_data) || tsonly))
+ if (likely(tsonly || READ_ONCE(sock_net(sk)->core.sysctl_tstamp_allow_data)))
return true;
read_lock_bh(&sk->sk_callback_lock);
diff --git a/net/core/sock.c b/net/core/sock.c
index fe87f9bd8f16..93b6c1d0317d 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -286,8 +286,6 @@ EXPORT_SYMBOL(sysctl_rmem_max);
__u32 sysctl_wmem_default __read_mostly = SK_WMEM_MAX;
__u32 sysctl_rmem_default __read_mostly = SK_RMEM_MAX;
-int sysctl_tstamp_allow_data __read_mostly = 1;
-
DEFINE_STATIC_KEY_FALSE(memalloc_socks_key);
EXPORT_SYMBOL_GPL(memalloc_socks_key);
diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
index 86a2476678c4..b60fac380cec 100644
--- a/net/core/sysctl_net_core.c
+++ b/net/core/sysctl_net_core.c
@@ -491,15 +491,6 @@ static struct ctl_table net_core_table[] = {
.mode = 0644,
.proc_handler = proc_dointvec,
},
- {
- .procname = "tstamp_allow_data",
- .data = &sysctl_tstamp_allow_data,
- .maxlen = sizeof(int),
- .mode = 0644,
- .proc_handler = proc_dointvec_minmax,
- .extra1 = SYSCTL_ZERO,
- .extra2 = SYSCTL_ONE
- },
#ifdef CONFIG_RPS
{
.procname = "rps_sock_flow_entries",
@@ -665,6 +656,15 @@ static struct ctl_table netns_core_table[] = {
.extra2 = SYSCTL_ONE,
.proc_handler = proc_dou8vec_minmax,
},
+ {
+ .procname = "tstamp_allow_data",
+ .data = &init_net.core.sysctl_tstamp_allow_data,
+ .maxlen = sizeof(u8),
+ .mode = 0644,
+ .proc_handler = proc_dou8vec_minmax,
+ .extra1 = SYSCTL_ZERO,
+ .extra2 = SYSCTL_ONE
+ },
/* sysctl_core_net_init() will set the values after this
* to readonly in network namespaces
*/
--
2.37.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v4] net-timestamp: namespacify the sysctl_tstamp_allow_data
2024-10-05 22:26 [PATCH net-next v4] net-timestamp: namespacify the sysctl_tstamp_allow_data Jason Xing
@ 2024-10-06 15:30 ` Kuniyuki Iwashima
2024-10-06 18:54 ` Eric Dumazet
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Kuniyuki Iwashima @ 2024-10-06 15:30 UTC (permalink / raw)
To: kerneljasonxing
Cc: davem, edumazet, kernelxing, kuba, kuniyu, netdev, pabeni,
willemb, willemdebruijn.kernel
From: Jason Xing <kerneljasonxing@gmail.com>
Date: Sun, 6 Oct 2024 07:26:09 +0900
> From: Jason Xing <kernelxing@tencent.com>
>
> Let it be tuned in per netns by admins.
>
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v4] net-timestamp: namespacify the sysctl_tstamp_allow_data
2024-10-05 22:26 [PATCH net-next v4] net-timestamp: namespacify the sysctl_tstamp_allow_data Jason Xing
2024-10-06 15:30 ` Kuniyuki Iwashima
@ 2024-10-06 18:54 ` Eric Dumazet
2024-10-06 23:50 ` Willem de Bruijn
2024-10-08 23:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Eric Dumazet @ 2024-10-06 18:54 UTC (permalink / raw)
To: Jason Xing
Cc: davem, kuba, pabeni, willemdebruijn.kernel, willemb, kuniyu,
netdev, Jason Xing
On Sun, Oct 6, 2024 at 12:26 AM Jason Xing <kerneljasonxing@gmail.com> wrote:
>
> From: Jason Xing <kernelxing@tencent.com>
>
> Let it be tuned in per netns by admins.
>
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v4] net-timestamp: namespacify the sysctl_tstamp_allow_data
2024-10-05 22:26 [PATCH net-next v4] net-timestamp: namespacify the sysctl_tstamp_allow_data Jason Xing
2024-10-06 15:30 ` Kuniyuki Iwashima
2024-10-06 18:54 ` Eric Dumazet
@ 2024-10-06 23:50 ` Willem de Bruijn
2024-10-08 23:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: Willem de Bruijn @ 2024-10-06 23:50 UTC (permalink / raw)
To: Jason Xing, davem, edumazet, kuba, pabeni, willemdebruijn.kernel,
willemb, kuniyu
Cc: netdev, Jason Xing
Jason Xing wrote:
> From: Jason Xing <kernelxing@tencent.com>
>
> Let it be tuned in per netns by admins.
>
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net-next v4] net-timestamp: namespacify the sysctl_tstamp_allow_data
2024-10-05 22:26 [PATCH net-next v4] net-timestamp: namespacify the sysctl_tstamp_allow_data Jason Xing
` (2 preceding siblings ...)
2024-10-06 23:50 ` Willem de Bruijn
@ 2024-10-08 23:20 ` patchwork-bot+netdevbpf
3 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-10-08 23:20 UTC (permalink / raw)
To: Jason Xing
Cc: davem, edumazet, kuba, pabeni, willemdebruijn.kernel, willemb,
kuniyu, netdev, kernelxing
Hello:
This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Sun, 6 Oct 2024 07:26:09 +0900 you wrote:
> From: Jason Xing <kernelxing@tencent.com>
>
> Let it be tuned in per netns by admins.
>
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
> ---
> v4
> Link: https://lore.kernel.org/all/20241003104035.22374-1-kerneljasonxing@gmail.com/
> 1. use u8 instead of int to save more bytes (Kuniyuki)
>
> [...]
Here is the summary with links:
- [net-next,v4] net-timestamp: namespacify the sysctl_tstamp_allow_data
https://git.kernel.org/netdev/net-next/c/da5e06dee58a
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-10-08 23:20 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-05 22:26 [PATCH net-next v4] net-timestamp: namespacify the sysctl_tstamp_allow_data Jason Xing
2024-10-06 15:30 ` Kuniyuki Iwashima
2024-10-06 18:54 ` Eric Dumazet
2024-10-06 23:50 ` Willem de Bruijn
2024-10-08 23:20 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).