diff options
author | David Gwynne <dlg@cvs.openbsd.org> | 2017-01-24 03:57:36 +0000 |
---|---|---|
committer | David Gwynne <dlg@cvs.openbsd.org> | 2017-01-24 03:57:36 +0000 |
commit | 38e410c3ec2b9ed68bafb194f1a842cc049bc486 (patch) | |
tree | 04130c870954194face9f3e0397be2ded92d2471 /sys/dev/ic | |
parent | d9fc778f44a5b33d674263219b50b7126e81c30c (diff) |
add support for multiple transmit ifqueues per network interface.
an ifq to transmit a packet is picked by the current traffic
conditioner (ie, priq or hfsc) by providing an index into an array
of ifqs. by default interfaces get a single ifq but can ask for
more using if_attach_queues().
the vast majority of our drivers still think there's a 1:1 mapping
between interfaces and transmit queues, so their if_start routines
take an ifnet pointer instead of a pointer to the ifqueue struct.
instead of changing all the drivers in the tree, drivers can opt
into using an if_qstart routine and setting the IFXF_MPSAFE flag.
the stack provides a compatability wrapper from the new if_qstart
handler to the previous if_start handlers if IFXF_MPSAFE isnt set.
enabling hfsc on an interface configures it to transmit everything
through the first ifq. any other ifqs are left configured as priq,
but unused, when hfsc is enabled.
getting this in now so everyone can kick the tyres.
ok mpi@ visa@ (who provided some tweaks for cnmac).
Diffstat (limited to 'sys/dev/ic')
-rw-r--r-- | sys/dev/ic/re.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/sys/dev/ic/re.c b/sys/dev/ic/re.c index 205d3569702..3af886547be 100644 --- a/sys/dev/ic/re.c +++ b/sys/dev/ic/re.c @@ -1,4 +1,4 @@ -/* $OpenBSD: re.c,v 1.200 2017/01/22 10:17:38 dlg Exp $ */ +/* $OpenBSD: re.c,v 1.201 2017/01/24 03:57:34 dlg Exp $ */ /* $FreeBSD: if_re.c,v 1.31 2004/09/04 07:54:05 ru Exp $ */ /* * Copyright (c) 1997, 1998-2003 @@ -161,7 +161,7 @@ int re_tx_list_init(struct rl_softc *); int re_rxeof(struct rl_softc *); int re_txeof(struct rl_softc *); void re_tick(void *); -void re_start(struct ifnet *); +void re_start(struct ifqueue *); void re_txstart(void *); int re_ioctl(struct ifnet *, u_long, caddr_t); void re_watchdog(struct ifnet *); @@ -1005,7 +1005,7 @@ re_attach(struct rl_softc *sc, const char *intrstr) ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; ifp->if_xflags = IFXF_MPSAFE; ifp->if_ioctl = re_ioctl; - ifp->if_start = re_start; + ifp->if_qstart = re_start; ifp->if_watchdog = re_watchdog; ifp->if_hardmtu = sc->rl_max_mtu; IFQ_SET_MAXLEN(&ifp->if_snd, sc->rl_ldata.rl_tx_desc_cnt); @@ -1776,8 +1776,9 @@ re_txstart(void *xsc) */ void -re_start(struct ifnet *ifp) +re_start(struct ifqueue *ifq) { + struct ifnet *ifp = ifq->ifq_if; struct rl_softc *sc = ifp->if_softc; struct mbuf *m; unsigned int idx; @@ -1785,7 +1786,7 @@ re_start(struct ifnet *ifp) int post = 0; if (!ISSET(sc->rl_flags, RL_FLAG_LINK)) { - IFQ_PURGE(&ifp->if_snd); + ifq_purge(ifq); return; } @@ -1797,11 +1798,11 @@ re_start(struct ifnet *ifp) for (;;) { if (sc->rl_ldata.rl_tx_ndescs >= free + 2) { - ifq_set_oactive(&ifp->if_snd); + ifq_set_oactive(ifq); break; } - m = ifq_dequeue(&ifp->if_snd); + m = ifq_dequeue(ifq); if (m == NULL) break; @@ -1831,7 +1832,7 @@ re_start(struct ifnet *ifp) ifp->if_timer = 5; sc->rl_ldata.rl_txq_prodidx = idx; - ifq_serialize(&ifp->if_snd, &sc->rl_start); + ifq_serialize(ifq, &sc->rl_start); } int |