Commit d24458e4 authored by Björn Töpel's avatar Björn Töpel Committed by Daniel Borkmann

xsk: fix poll/POLLIN premature returns

Polling for the ingress queues relies on reading the producer/consumer
pointers of the Rx queue.

Prior this commit, a cached consumer pointer could be used, instead of
the actual consumer pointer and therefore report POLLIN prematurely.

This patch makes sure that the non-cached consumer pointer is used
instead.
Reported-by: default avatarQi Zhang <qi.z.zhang@intel.com>
Tested-by: default avatarQi Zhang <qi.z.zhang@intel.com>
Fixes: c497176c ("xsk: add Rx receive functions and poll support")
Signed-off-by: default avatarBjörn Töpel <bjorn.topel@intel.com>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
parent 9e4e5b5c
...@@ -250,7 +250,7 @@ static inline bool xskq_full_desc(struct xsk_queue *q) ...@@ -250,7 +250,7 @@ static inline bool xskq_full_desc(struct xsk_queue *q)
static inline bool xskq_empty_desc(struct xsk_queue *q) static inline bool xskq_empty_desc(struct xsk_queue *q)
{ {
return xskq_nb_free(q, q->prod_tail, 1) == q->nentries; return xskq_nb_free(q, q->prod_tail, q->nentries) == q->nentries;
} }
void xskq_set_umem(struct xsk_queue *q, struct xdp_umem_props *umem_props); void xskq_set_umem(struct xsk_queue *q, struct xdp_umem_props *umem_props);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment