summaryrefslogtreecommitdiffstats
path: root/include/net/rps.h
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2024-03-29 15:42:24 +0000
committerDavid S. Miller <davem@davemloft.net>2024-04-01 11:28:32 +0100
commitc62fdf5b11ef12b89ac2450c25c12bffc3d924c5 (patch)
treed2e567fd8a48d2b68c7f8d6d9dbaedb99f9a2c1c /include/net/rps.h
parent36b83ffcf209a2e6099dae1070df6a2001dfab27 (diff)
downloadlinux-stable-c62fdf5b11ef12b89ac2450c25c12bffc3d924c5.tar.gz
linux-stable-c62fdf5b11ef12b89ac2450c25c12bffc3d924c5.tar.bz2
linux-stable-c62fdf5b11ef12b89ac2450c25c12bffc3d924c5.zip
net: rps: add rps_input_queue_head_add() helper
process_backlog() can batch increments of sd->input_queue_head, saving some memory bandwidth. Also add READ_ONCE()/WRITE_ONCE() annotations around sd->input_queue_head accesses. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/net/rps.h')
-rw-r--r--include/net/rps.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/net/rps.h b/include/net/rps.h
index 10ca25731c1e..a93401d23d66 100644
--- a/include/net/rps.h
+++ b/include/net/rps.h
@@ -138,11 +138,16 @@ static inline void rps_input_queue_tail_save(u32 *dest, u32 tail)
#endif
}
-static inline void rps_input_queue_head_incr(struct softnet_data *sd)
+static inline void rps_input_queue_head_add(struct softnet_data *sd, int val)
{
#ifdef CONFIG_RPS
- sd->input_queue_head++;
+ WRITE_ONCE(sd->input_queue_head, sd->input_queue_head + val);
#endif
}
+static inline void rps_input_queue_head_incr(struct softnet_data *sd)
+{
+ rps_input_queue_head_add(sd, 1);
+}
+
#endif /* _NET_RPS_H */