diff options
| author | 2018-02-09 02:26:33 +0000 | |
|---|---|---|
| committer | 2018-02-09 02:26:33 +0000 | |
| commit | 6fa8084961d20dd7a3d9682892eef3f850dc19e9 (patch) | |
| tree | 0f235f6922bb00735d83539b59125d998517fe5a | |
| parent | Implement the bwfm(4) SDIO bus logic. This is the bus layer that (diff) | |
| download | wireguard-openbsd-6fa8084961d20dd7a3d9682892eef3f850dc19e9.tar.xz wireguard-openbsd-6fa8084961d20dd7a3d9682892eef3f850dc19e9.zip | |
Extend the mbuf queue API with an accessor that checks whether
or not the mbuf queue is full.
ok dlg@
| -rw-r--r-- | share/man/man9/mq_init.9 | 15 | ||||
| -rw-r--r-- | sys/sys/mbuf.h | 3 |
2 files changed, 15 insertions, 3 deletions
diff --git a/share/man/man9/mq_init.9 b/share/man/man9/mq_init.9 index e37d24b4966..58acf26b344 100644 --- a/share/man/man9/mq_init.9 +++ b/share/man/man9/mq_init.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mq_init.9,v 1.8 2016/04/15 05:05:21 dlg Exp $ +.\" $OpenBSD: mq_init.9,v 1.9 2018/02/09 02:26:33 patrick Exp $ .\" .\" Copyright (c) 2015 David Gwynne <dlg@openbsd.org> .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: April 15 2016 $ +.Dd $Mdocdate: February 9 2018 $ .Dt MQ_INIT 9 .Os .Sh NAME @@ -26,6 +26,7 @@ .Nm mq_dechain , .Nm mq_len , .Nm mq_empty , +.Nm mq_full , .Nm mq_purge , .Nm mq_drops , .Nm mq_set_maxlen , @@ -49,6 +50,8 @@ .Fn mq_len "struct mbuf_queue *mq" .Ft int .Fn mq_empty "struct mbuf_queue *mq" +.Ft int +.Fn mq_full "struct mbuf_queue *mq" .Ft unsigned int .Fn mq_purge "struct mbuf_queue *mq" .Ft unsigned int @@ -135,6 +138,10 @@ mbuf queue. Return if the .Fa mq mbuf queue is empty. +.It Fn mq_full "struct mbuf_queue *mq" +Return if the +.Fa mq +mbuf queue is full. .It Fn mq_purge "struct mbuf_queue *mq" Free all the mbufs on the .Fa mq @@ -163,6 +170,7 @@ already exist on the queue. .Fn mq_dechain , .Fn mq_len , .Fn mq_empty , +.Fn mq_full , .Fn mq_purge , .Fn mq_drops , .Fn mq_set_maxlen , @@ -189,6 +197,9 @@ returns the number of mbufs on the queue. .Fn mq_empty returns a non-zero value if the queue is empty, otherwise 0. .Pp +.Fn mq_full +returns a non-zero value if the queue is full, otherwise 0. +.Pp .Fn mq_enqueue returns 0 if the mbuf was successfully queued, or non-zero if the mbuf was freed because it would cause the queue to exceed its maximum diff --git a/sys/sys/mbuf.h b/sys/sys/mbuf.h index 5a2dbbe8885..825cc801843 100644 --- a/sys/sys/mbuf.h +++ b/sys/sys/mbuf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: mbuf.h,v 1.233 2018/02/06 23:44:48 henning Exp $ */ +/* $OpenBSD: mbuf.h,v 1.234 2018/02/09 02:26:33 patrick Exp $ */ /* $NetBSD: mbuf.h,v 1.19 1996/02/09 18:25:14 christos Exp $ */ /* @@ -555,6 +555,7 @@ unsigned int mq_purge(struct mbuf_queue *); #define mq_len(_mq) ml_len(&(_mq)->mq_list) #define mq_empty(_mq) ml_empty(&(_mq)->mq_list) +#define mq_full(_mq) (mq_len((_mq)) >= (_mq)->mq_maxlen) #define mq_drops(_mq) ((_mq)->mq_drops) #define mq_set_maxlen(_mq, _l) ((_mq)->mq_maxlen = (_l)) |
