aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/netmap/netmap_kern.h
diff options
context:
space:
mode:
Diffstat (limited to 'sys/dev/netmap/netmap_kern.h')
-rw-r--r--sys/dev/netmap/netmap_kern.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/dev/netmap/netmap_kern.h b/sys/dev/netmap/netmap_kern.h
index 4578269e43a28..3f4b00d814f48 100644
--- a/sys/dev/netmap/netmap_kern.h
+++ b/sys/dev/netmap/netmap_kern.h
@@ -1169,6 +1169,15 @@ nm_kr_txempty(struct netmap_kring *kring)
* rxsync_prologue */
#define nm_kr_rxempty(_k) nm_kr_txempty(_k)
+/* True if the application needs to wait for more space on the ring
+ * (more received packets or more free tx slots).
+ * Only valid after *xsync_prologue. */
+static inline int
+nm_kr_wouldblock(struct netmap_kring *kring)
+{
+ return kring->rcur == kring->nr_hwtail;
+}
+
/*
* protect against multiple threads using the same ring.
* also check that the ring has not been stopped or locked