diff options
author | Xuan Zhuo <xuanzhuo@linux.alibaba.com> | 2020-12-01 21:56:58 +0800 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2020-12-03 01:14:38 +0100 |
commit | 3413f04141aa440c71da187755e8e22f5093ce83 (patch) | |
tree | 05f9cc0aa60f5e1bace31ef5778090229b28e8dc /net/xdp/xsk_queue.h | |
parent | f5da54187e33dce9bea63170667dbb0ca8d98194 (diff) | |
download | lwn-3413f04141aa440c71da187755e8e22f5093ce83.tar.gz lwn-3413f04141aa440c71da187755e8e22f5093ce83.zip |
xsk: Change the tx writeable condition
Modify the tx writeable condition from the queue is not full to the
number of present tx queues is less than the half of the total number
of queues. Because the tx queue not full is a very short time, this will
cause a large number of EPOLLOUT events, and cause a large number of
process wake up.
Fixes: 35fcde7f8deb ("xsk: support for Tx")
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Magnus Karlsson <magnus.karlsson@intel.com>
Link: https://lore.kernel.org/bpf/508fef55188d4e1160747ead64c6dcda36735880.1606555939.git.xuanzhuo@linux.alibaba.com
Diffstat (limited to 'net/xdp/xsk_queue.h')
-rw-r--r-- | net/xdp/xsk_queue.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/xdp/xsk_queue.h b/net/xdp/xsk_queue.h index cdb9cf3cd136..9e71b9f27679 100644 --- a/net/xdp/xsk_queue.h +++ b/net/xdp/xsk_queue.h @@ -264,6 +264,12 @@ static inline bool xskq_cons_is_full(struct xsk_queue *q) q->nentries; } +static inline u32 xskq_cons_present_entries(struct xsk_queue *q) +{ + /* No barriers needed since data is not accessed */ + return READ_ONCE(q->ring->producer) - READ_ONCE(q->ring->consumer); +} + /* Functions for producers */ static inline bool xskq_prod_is_full(struct xsk_queue *q) |