diff options
| author | Eric Dumazet <edumazet@google.com> | 2025-09-16 16:09:49 +0000 |
|---|---|---|
| committer | Paolo Abeni <pabeni@redhat.com> | 2025-09-18 10:17:10 +0200 |
| commit | 9db27c80622bd612549ea213390500f7377ee3e1 (patch) | |
| tree | c4431c098c618ebaaf5d1fc28fd4982e8fa41bd5 /include | |
| parent | net: group sk_backlog and sk_receive_queue (diff) | |
| download | linux-9db27c80622bd612549ea213390500f7377ee3e1.tar.gz linux-9db27c80622bd612549ea213390500f7377ee3e1.zip | |
udp: add udp_drops_inc() helper
Generic sk_drops_inc() reads sk->sk_drop_counters.
We know the precise location for UDP sockets.
Move sk_drop_counters out of sock_read_rxtx
so that sock_write_rxtx starts at a cache line boundary.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: David Ahern <dsahern@kernel.org>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
Link: https://patch.msgid.link/20250916160951.541279-9-edumazet@google.com
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'include')
| -rw-r--r-- | include/net/sock.h | 2 | ||||
| -rw-r--r-- | include/net/udp.h | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/net/sock.h b/include/net/sock.h index 867dc44140d4..82bcdb7d7e67 100644 --- a/include/net/sock.h +++ b/include/net/sock.h @@ -451,7 +451,6 @@ struct sock { #ifdef CONFIG_XFRM struct xfrm_policy __rcu *sk_policy[2]; #endif - struct numa_drop_counters *sk_drop_counters; __cacheline_group_end(sock_read_rxtx); __cacheline_group_begin(sock_write_rxtx); @@ -568,6 +567,7 @@ struct sock { #ifdef CONFIG_BPF_SYSCALL struct bpf_local_storage __rcu *sk_bpf_storage; #endif + struct numa_drop_counters *sk_drop_counters; struct rcu_head sk_rcu; netns_tracker ns_tracker; struct xarray sk_user_frags; diff --git a/include/net/udp.h b/include/net/udp.h index 93b159f30e88..a08822e294b0 100644 --- a/include/net/udp.h +++ b/include/net/udp.h @@ -295,6 +295,11 @@ static inline void udp_lib_init_sock(struct sock *sk) set_bit(SOCK_CUSTOM_SOCKOPT, &sk->sk_socket->flags); } +static inline void udp_drops_inc(struct sock *sk) +{ + numa_drop_add(&udp_sk(sk)->drop_counters, 1); +} + /* hash routines shared between UDPv4/6 and UDP-Litev4/6 */ static inline int udp_lib_hash(struct sock *sk) { |
