diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2015-11-25 03:10:01 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2015-11-25 03:10:01 +0000 |
commit | 6215416f96d04fd1a1b0e14e2670c208f0acc34c (patch) | |
tree | 14249f751ae54985d3581b0632deb81620be2edf /share/man | |
parent | bbe7ffca434bff081b83e600614f4ec4cded8f3b (diff) |
replace IFF_OACTIVE manipulation with mpsafe operations.
there are two things shared between the network stack and drivers
in the send path: the send queue and the IFF_OACTIVE flag. the send
queue is now protected by a mutex. this diff makes the oactive
functionality mpsafe too.
IFF_OACTIVE is part of if_flags. there are two problems with that.
firstly, if_flags is a short and we dont have any MI atomic operations
to manipulate a short. secondly, while we could make the IFF_OACTIVE
operates mpsafe, all changes to other flags would have to be made
safe at the same time, otherwise a read-modify-write cycle on their
updates could clobber the oactive change.
instead, this moves the oactive mark into struct ifqueue and provides
an API for changing it. there's ifq_set_oactive, ifq_clr_oactive,
and ifq_is_oactive. these are modelled on ifsq_set_oactive,
ifsq_clr_oactive, and ifsq_is_oactive in dragonflybsd.
this diff includes changes to all the drivers manipulating IFF_OACTIVE
to now use the ifsq_{set,clr_is}_oactive API too.
ok kettenis@ mpi@ jmatthew@ deraadt@
Diffstat (limited to 'share/man')
-rw-r--r-- | share/man/man9/Makefile | 6 | ||||
-rw-r--r-- | share/man/man9/ifq_enqueue.9 | 40 |
2 files changed, 40 insertions, 6 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 285f0584b6a..e25808556ec 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.261 2015/11/24 19:37:30 jmc Exp $ +# $OpenBSD: Makefile,v 1.262 2015/11/25 03:09:57 dlg Exp $ # $NetBSD: Makefile,v 1.4 1996/01/09 03:23:01 thorpej Exp $ # Makefile for section 9 (kernel function and variable) manual pages. @@ -217,7 +217,9 @@ MLINKS+=if_rxr_init.9 if_rxr_get.9 if_rxr_init.9 if_rxr_put.9 \ if_rxr_init.9 if_rxr_inuse.9 if_rxr_init.9 if_rxr_ioctl.9 \ if_rxr_init.9 if_rxr_info_ioctl.9 MLINKS+=ifq_enqueue.9 ifq_dequeue.9 ifq_enqueue.9 ifq_purge.9 \ - ifq_enqueue.9 ifq_len.9 ifq_enqueue.9 ifq_empty.9 + ifq_enqueue.9 ifq_len.9 ifq_enqueue.9 ifq_empty.9 \ + ifq_enqueue.9 ifq_set_oactive.9 ifq_enqueue.9 ifq_clr_oactive.9 \ + ifq_enqueue.9 ifq_is_oactive.9 MLINKS+=ifq_deq_begin.9 ifq_deq_commit.9 ifq_deq_begin.9 ifq_deq_rollback.9 MLINKS+=iic.9 iic_acquire_bus.9 iic.9 iic_release_bus.9 iic.9 iic_exec.9 \ iic.9 iic_smbus_write_byte.9 iic.9 iic_smbus_read_byte.9 \ diff --git a/share/man/man9/ifq_enqueue.9 b/share/man/man9/ifq_enqueue.9 index d3509cbbf5d..03c5909b0ca 100644 --- a/share/man/man9/ifq_enqueue.9 +++ b/share/man/man9/ifq_enqueue.9 @@ -1,4 +1,4 @@ -.\" $OpenBSD: ifq_enqueue.9,v 1.3 2015/11/23 11:07:58 jmc Exp $ +.\" $OpenBSD: ifq_enqueue.9,v 1.4 2015/11/25 03:09:57 dlg 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: November 23 2015 $ +.Dd $Mdocdate: November 25 2015 $ .Dt IFQ_ENQUEUE 9 .Os .Sh NAME @@ -22,7 +22,10 @@ .Nm ifq_dequeue , .Nm ifq_purge , .Nm ifq_len , -.Nm ifq_empty +.Nm ifq_empty , +.Nm ifq_set_oactive , +.Nm ifq_clr_oactive , +.Nm ifq_is_oactive .Nd interface send queue API .Sh SYNOPSIS .In net/if_var.h @@ -36,6 +39,12 @@ .Fn ifq_len "struct ifqueue *ifq" .Ft unsigned int .Fn ifq_empty "struct ifqueue *ifq" +.Ft void +.Fn ifq_set_oactive "struct ifqueue *ifq" +.Ft void +.Fn ifq_clr_oactive "struct ifqueue *ifq" +.Ft unsigned int +.Fn ifq_is_oactive "struct ifqueue *ifq" .Sh DESCRIPTION The ifqueue API provides implementions of data structures and operations for the network stack to queue mbufs for a network driver @@ -72,14 +81,33 @@ or Return if the interface send queue .Fa ifq is empty. +.It Fn ifq_set_oactive "struct ifqueue *ifq" +.Fn ifq_set_oactive +is called by the relevant driver to mark the hardware associated +with the interface send queue +.Fa ifq +as unable to transmit more packets. +.It Fn ifq_clr_oactive "struct ifqueue *ifq" +.Fn ifq_clr_oactive +is called by the relevant driver to clear the "active" mark on the +hardware associated with the interface send queue +.Fa ifq , +meaning it is now able to transmit packets. +.It Fn ifq_is_oactive "struct ifqueue *ifq" +Return if the hardware associated with the interface send queue +.Fa ifq +is unable to transmit more packets. .El .Sh CONTEXT .Fn ifq_enqueue , .Fn ifq_dequeue , .Fn ifq_purge , .Fn ifq_len , +.Fn ifq_empty , +.Fn ifq_set_oactive , +.Fn ifq_clr_oactive , and -.Fn ifq_empty +.Fn ifq_is_oactive can be called during autoconf, from process context, or from interrupt context. .Sh RETURN VALUES .Fn ifq_enqueue @@ -99,6 +127,10 @@ returns the number of mbufs on the queue. .Pp .Fn ifq_empty returns a non-zero value if the queue is empty, otherwise 0. +.Pp +.Fn ifq_is_oactive +returns a non-zero value if the hardware associated with the interface +send queue is unable to transmit more packets, otherwise 0. .Sh SEE ALSO .Xr ifq_deq_begin 9 , .Xr m_freem 9 |