netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] libbpf: add support for canceling cached_cons advance
@ 2020-11-22 13:10 Li RongQing
  2020-11-22 19:42 ` kernel test robot
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Li RongQing @ 2020-11-22 13:10 UTC (permalink / raw)
  To: netdev, bpf

It is possible to fail receiving packets after calling
xsk_ring_cons__peek, at this condition, cached_cons has
been advanced, should be cancelled.

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 tools/lib/bpf/xsk.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/tools/lib/bpf/xsk.h b/tools/lib/bpf/xsk.h
index 1069c46364ff..4128215c246b 100644
--- a/tools/lib/bpf/xsk.h
+++ b/tools/lib/bpf/xsk.h
@@ -153,6 +153,12 @@ static inline size_t xsk_ring_cons__peek(struct xsk_ring_cons *cons,
 	return entries;
 }
 
+static inline void xsk_ring_cons__cancel(struct xsk_ring_cons *cons,
+					 size_t nb)
+{
+	rx->cached_cons -= nb;
+}
+
 static inline void xsk_ring_cons__release(struct xsk_ring_cons *cons, size_t nb)
 {
 	/* Make sure data has been read before indicating we are done
-- 
2.17.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-24  7:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-22 13:10 [PATCH] libbpf: add support for canceling cached_cons advance Li RongQing
2020-11-22 19:42 ` kernel test robot
2020-11-23  9:40 ` Magnus Karlsson
2020-11-23 10:43   ` Li,Rongqing
2020-11-24  8:08 ` [libbpf] 394b6e9238: last_state.incomplete kernel test robot

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).