aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/netmap/netmap_kern.h
diff options
context:
space:
mode:
authorVincenzo Maffione <vmaffione@FreeBSD.org>2019-02-02 22:39:29 +0000
committerVincenzo Maffione <vmaffione@FreeBSD.org>2019-02-02 22:39:29 +0000
commit5faab7782202ab1e6815c5da956d8997f59aa105 (patch)
tree5e2550d3df987aa498d1fe373d6d99bf2a2968cf /sys/dev/netmap/netmap_kern.h
parent769d56eccf62ada5443e8225abb7000875e77821 (diff)
Notes
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