diff options
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/if_de.c | 80 | ||||
-rw-r--r-- | sys/dev/pci/if_lmc.c | 32 | ||||
-rw-r--r-- | sys/dev/pci/if_sf.c | 13 | ||||
-rw-r--r-- | sys/dev/pci/if_sis.c | 24 | ||||
-rw-r--r-- | sys/dev/pci/if_ste.c | 13 | ||||
-rw-r--r-- | sys/dev/pci/if_ti.c | 17 | ||||
-rw-r--r-- | sys/dev/pci/if_tl.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/if_tx.c | 11 | ||||
-rw-r--r-- | sys/dev/pci/if_txp.c | 7 | ||||
-rw-r--r-- | sys/dev/pci/if_vr.c | 9 | ||||
-rw-r--r-- | sys/dev/pci/if_wb.c | 12 | ||||
-rw-r--r-- | sys/dev/pci/if_wx.c | 20 |
12 files changed, 169 insertions, 78 deletions
diff --git a/sys/dev/pci/if_de.c b/sys/dev/pci/if_de.c index 272b2d13f3e..dc4cb29873e 100644 --- a/sys/dev/pci/if_de.c +++ b/sys/dev/pci/if_de.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_de.c,v 1.46 2001/06/12 15:40:31 niklas Exp $ */ +/* $OpenBSD: if_de.c,v 1.47 2001/06/27 06:34:47 kjc Exp $ */ /* $NetBSD: if_de.c,v 1.45 1997/06/09 00:34:18 thorpej Exp $ */ /*- @@ -4116,6 +4116,11 @@ tulip_txput( int segcnt, free; u_int32_t d_status; struct mbuf *m0; +#if 1 /* ALTQ */ + struct ifnet *ifp = &sc->tulip_if; + struct mbuf *ombuf = m; + int compressed = 0; +#endif #if defined(TULIP_DEBUG) if ((sc->tulip_cmdmode & TULIP_CMD_TXRUN) == 0) { @@ -4169,6 +4174,26 @@ tulip_txput( * entries that we can use for one packet, so we have * recopy it into one mbuf and then try again. */ +#if 1 /* ALTQ */ + struct mbuf *tmp; + /* + * tulip_mbuf_compress() frees the original mbuf. + * thus, we have to remove the mbuf from the queue + * before calling it. + * we don't have to worry about space shortage + * after compressing the mbuf since the compressed + * mbuf will take only two segs. + */ + if (compressed) { + /* should not happen */ + printf("tulip_txput: compress called twice!\n"); + goto finish; + } + IFQ_DEQUEUE(&ifp->if_snd, tmp); + if (tmp != ombuf) + panic("tulip_txput: different mbuf dequeued!"); + compressed = 1; +#endif m = tulip_mbuf_compress(m); if (m == NULL) goto finish; @@ -4235,6 +4260,16 @@ tulip_txput( * The descriptors have been filled in. Now get ready * to transmit. */ +#if 1 /* ALTQ */ + if (!compressed && (sc->tulip_flags & TULIP_TXPROBE_ACTIVE) == 0) { + /* remove the mbuf from the queue */ + struct mbuf *tmp; + IFQ_DEQUEUE(&ifp->if_snd, tmp); + if (tmp != ombuf) + panic("tulip_txput: different mbuf dequeued!"); + } +#endif + IF_ENQUEUE(&sc->tulip_txq, m); m = NULL; @@ -4593,11 +4628,19 @@ tulip_ifioctl( return error; } +#if 1 /* ALTQ */ +/* + * the original dequeueing policy is dequeue-and-prepend if something + * goes wrong. when altq is used, it is changed to peek-and-dequeue. + * the modification becomes a bit complicated since tulip_txput() might + * copy and modify the mbuf passed. + */ +#endif /* * These routines gets called at device spl (from ether_output). This might * pose a problem for TULIP_USE_SOFTINTR if ether_output is called at * device spl from another driver. - */ + */ static ifnet_ret_t tulip_ifstart( @@ -4611,15 +4654,23 @@ tulip_ifstart( if ((sc->tulip_flags & (TULIP_WANTSETUP|TULIP_TXPROBE_ACTIVE)) == TULIP_WANTSETUP) tulip_txput_setup(sc); - while (sc->tulip_if.if_snd.ifq_head != NULL) { - struct mbuf *m; - IF_DEQUEUE(&sc->tulip_if.if_snd, m); - if ((m = tulip_txput(sc, m)) != NULL) { - IF_PREPEND(&sc->tulip_if.if_snd, m); + while (!IFQ_IS_EMPTY(&sc->tulip_if.if_snd)) { + struct mbuf *m, *m0; + IFQ_POLL(&sc->tulip_if.if_snd, m); + if (m == NULL) + break; + if ((m0 = tulip_txput(sc, m)) != NULL) { + if (m0 != m) + /* should not happen */ + printf("tulip_if_start: txput failed!\n"); break; } } - if (sc->tulip_if.if_snd.ifq_head == NULL) +#ifdef ALTQ + if (0) /* don't switch to the one packet mode */ +#else + if (IFQ_IS_EMPTY(&sc->tulip_if.if_snd)) +#endif sc->tulip_if.if_start = tulip_ifstart_one; } @@ -4634,11 +4685,13 @@ tulip_ifstart_one( tulip_softc_t * const sc = TULIP_IFP_TO_SOFTC(ifp); if ((sc->tulip_if.if_flags & IFF_RUNNING) - && sc->tulip_if.if_snd.ifq_head != NULL) { - struct mbuf *m; - IF_DEQUEUE(&sc->tulip_if.if_snd, m); - if ((m = tulip_txput(sc, m)) != NULL) - IF_PREPEND(&sc->tulip_if.if_snd, m); + && !IFQ_IS_EMPTY(&sc->tulip_if.if_snd)) { + struct mbuf *m, *m0; + IFQ_POLL(&sc->tulip_if.if_snd, m); + if (m != NULL && (m0 = tulip_txput(sc, m)) != NULL) + if (m0 != m) + /* should not happen */ + printf("tulip_if_start_one: txput failed!\n"); } TULIP_PERFEND(ifstart_one); } @@ -4837,6 +4890,7 @@ tulip_attach( tulip_reset(sc); + IFQ_SET_READY(&ifp->if_snd); #if defined(__bsdi__) && _BSDI_VERSION >= 199510 sc->tulip_pf = printf; TULIP_ETHER_IFATTACH(sc); diff --git a/sys/dev/pci/if_lmc.c b/sys/dev/pci/if_lmc.c index 165e70fdb48..ea5e2875cf7 100644 --- a/sys/dev/pci/if_lmc.c +++ b/sys/dev/pci/if_lmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_lmc.c,v 1.8 2001/06/27 05:44:55 nate Exp $ */ +/* $OpenBSD: if_lmc.c,v 1.9 2001/06/27 06:34:48 kjc Exp $ */ /* $NetBSD: if_lmc.c,v 1.1 1999/03/25 03:32:43 explorer Exp $ */ /*- @@ -1286,15 +1286,20 @@ static ifnet_ret_t lmc_ifstart(struct ifnet * const ifp) { lmc_softc_t * const sc = LMC_IFP_TO_SOFTC(ifp); - struct mbuf *m; + struct mbuf *m, *m0; if (sc->lmc_flags & LMC_IFUP) { while (sppp_isempty(ifp) == 0) { - m = sppp_dequeue(ifp); - if ((m = lmc_txput(sc, m)) != NULL) { - IF_PREPEND(&((struct sppp *)ifp)->pp_fastq, m); + m = sppp_pick(ifp); + if (m == NULL) break; - } + if ((m = lmc_txput(sc, m)) != NULL) + break; + m0 = sppp_dequeue(ifp); +#if defined(LMC_DEBUG) + if (m0 != m) + printf("lmc_ifstart: mbuf mismatch!\n"); +#endif } LMC_CSR_WRITE(sc, csr_txpoll, 1); } @@ -1304,13 +1309,17 @@ static ifnet_ret_t lmc_ifstart_one(struct ifnet * const ifp) { lmc_softc_t * const sc = LMC_IFP_TO_SOFTC(ifp); - struct mbuf *m; + struct mbuf *m, *m0; if ((sc->lmc_flags & LMC_IFUP) && (sppp_isempty(ifp) == 0)) { - m = sppp_dequeue(ifp); - if ((m = lmc_txput(sc, m)) != NULL) { - IF_PREPEND(&((struct sppp *)ifp)->pp_fastq, m); - } + m = sppp_pick(ifp); + if ((m = lmc_txput(sc, m)) != NULL) + return; + m0 = sppp_dequeue(ifp); +#if defined(LMC_DEBUG) + if (m0 != m) + printf("lmc_ifstart: mbuf mismatch!\n"); +#endif LMC_CSR_WRITE(sc, csr_txpoll, 1); } } @@ -1428,6 +1437,7 @@ lmc_attach(lmc_softc_t * const sc) ifp->if_watchdog = lmc_watchdog; ifp->if_timer = 1; ifp->if_mtu = LMC_MTU; + IFQ_SET_READY(&ifp->if_snd); #if defined(__bsdi__) ifp->if_type = IFT_NONE; diff --git a/sys/dev/pci/if_sf.c b/sys/dev/pci/if_sf.c index 19f8b4bf333..84f586a58a5 100644 --- a/sys/dev/pci/if_sf.c +++ b/sys/dev/pci/if_sf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sf.c,v 1.11 2001/06/24 20:26:59 fgsch Exp $ */ +/* $OpenBSD: if_sf.c,v 1.12 2001/06/27 06:34:48 kjc Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -739,7 +739,8 @@ void sf_attach(parent, self, aux) ifp->if_start = sf_start; ifp->if_watchdog = sf_watchdog; ifp->if_baudrate = 10000000; - ifp->if_snd.ifq_maxlen = SF_TX_DLIST_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, SF_TX_DLIST_CNT - 1); + IFQ_SET_READY(&ifp->if_snd); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); /* @@ -1029,7 +1030,7 @@ int sf_intr(arg) /* Re-enable interrupts. */ csr_write_4(sc, SF_IMR, SF_INTRS); - if (ifp->if_snd.ifq_head != NULL) + if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) sf_start(ifp); return claimed; @@ -1231,7 +1232,7 @@ void sf_start(ifp) i = SF_IDX_HI(txprod) >> 4; while(sc->sf_ldata->sf_tx_dlist[i].sf_mbuf == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -1352,7 +1353,7 @@ void sf_stats_update(xsc) if (mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) sc->sf_link++; - if (ifp->if_snd.ifq_head != NULL) + if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) sf_start(ifp); } @@ -1377,7 +1378,7 @@ void sf_watchdog(ifp) sf_reset(sc); sf_init(sc); - if (ifp->if_snd.ifq_head != NULL) + if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) sf_start(ifp); return; diff --git a/sys/dev/pci/if_sis.c b/sys/dev/pci/if_sis.c index eb88dac17ae..e012dd17ea3 100644 --- a/sys/dev/pci/if_sis.c +++ b/sys/dev/pci/if_sis.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_sis.c,v 1.14 2001/06/24 20:27:00 fgsch Exp $ */ +/* $OpenBSD: if_sis.c,v 1.15 2001/06/27 06:34:48 kjc Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -826,7 +826,8 @@ void sis_attach(parent, self, aux) ifp->if_start = sis_start; ifp->if_watchdog = sis_watchdog; ifp->if_baudrate = 10000000; - ifp->if_snd.ifq_maxlen = SIS_TX_LIST_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, SIS_TX_LIST_CNT - 1); + IFQ_SET_READY(&ifp->if_snd); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); sc->sc_mii.mii_ifp = ifp; @@ -1127,7 +1128,7 @@ void sis_tick(xsc) if (mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) sc->sis_link++; - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_IS_EMPTY(&ifp->if_snd)) sis_start(ifp); } timeout_add(&sc->sis_timeout, hz); @@ -1190,7 +1191,7 @@ int sis_intr(arg) /* Re-enable interrupts. */ CSR_WRITE_4(sc, SIS_IER, 1); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_IS_EMPTY(&ifp->if_snd)) sis_start(ifp); return claimed; @@ -1258,7 +1259,6 @@ void sis_start(ifp) struct sis_softc *sc; struct mbuf *m_head = NULL; u_int32_t idx; - int s; sc = ifp->if_softc; @@ -1271,20 +1271,18 @@ void sis_start(ifp) return; while(sc->sis_ldata->sis_tx_list[idx].sis_mbuf == NULL) { - s = splimp(); - IF_DEQUEUE(&ifp->if_snd, m_head); - splx(s); + IFQ_POLL(&ifp->if_snd, m_head); if (m_head == NULL) break; if (sis_encap(sc, m_head, &idx)) { - s = splimp(); - IF_PREPEND(&ifp->if_snd, m_head); - splx(s); ifp->if_flags |= IFF_OACTIVE; break; } + /* now we are committed to transmit the packet */ + IFQ_DEQUEUE(&ifp->if_snd, m_head); + /* * If there's a BPF listener, bounce a copy of this frame * to him. @@ -1294,6 +1292,8 @@ void sis_start(ifp) bpf_mtap(ifp->if_bpf, m_head); #endif } + if (idx == sc->sis_cdata.sis_tx_prod) + return; /* Transmit */ sc->sis_cdata.sis_tx_prod = idx; @@ -1599,7 +1599,7 @@ void sis_watchdog(ifp) sis_reset(sc); sis_init(sc); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_IS_EMPTY(&ifp->if_snd)) sis_start(ifp); splx(s); diff --git a/sys/dev/pci/if_ste.c b/sys/dev/pci/if_ste.c index a72d091fa53..8dd665c8936 100644 --- a/sys/dev/pci/if_ste.c +++ b/sys/dev/pci/if_ste.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ste.c,v 1.11 2001/06/25 02:18:47 fgsch Exp $ */ +/* $OpenBSD: if_ste.c,v 1.12 2001/06/27 06:34:49 kjc Exp $ */ /* * Copyright (c) 1997, 1998, 1999 * Bill Paul <wpaul@ctr.columbia.edu>. All rights reserved. @@ -604,7 +604,7 @@ int ste_intr(xsc) /* Re-enable interrupts */ CSR_WRITE_2(sc, STE_IMR, STE_INTRS); - if (ifp->if_snd.ifq_head != NULL) + if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) ste_start(ifp); return claimed; @@ -818,7 +818,7 @@ void ste_stats_update(xsc) if (mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) sc->ste_link++; - if (ifp->if_snd.ifq_head != NULL) + if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) ste_start(ifp); } @@ -986,7 +986,8 @@ void ste_attach(parent, self, aux) ifp->if_start = ste_start; ifp->if_watchdog = ste_watchdog; ifp->if_baudrate = 10000000; - ifp->if_snd.ifq_maxlen = STE_TX_LIST_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, STE_TX_LIST_CNT - 1); + IFQ_SET_READY(&ifp->if_snd); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); sc->sc_mii.mii_ifp = ifp; @@ -1433,7 +1434,7 @@ void ste_start(ifp) break; } - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -1488,7 +1489,7 @@ void ste_watchdog(ifp) ste_reset(sc); ste_init(sc); - if (ifp->if_snd.ifq_head != NULL) + if (IFQ_IS_EMPTY(&ifp->if_snd) == 0) ste_start(ifp); return; diff --git a/sys/dev/pci/if_ti.c b/sys/dev/pci/if_ti.c index a8170794bff..79b4ff8aaa8 100644 --- a/sys/dev/pci/if_ti.c +++ b/sys/dev/pci/if_ti.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ti.c,v 1.24 2001/06/27 05:44:55 nate Exp $ */ +/* $OpenBSD: if_ti.c,v 1.25 2001/06/27 06:34:49 kjc Exp $ */ /* * Copyright (c) 1997, 1998, 1999 @@ -1643,7 +1643,8 @@ ti_attach(parent, self, aux) ifp->if_start = ti_start; ifp->if_watchdog = ti_watchdog; ifp->if_mtu = ETHERMTU; - ifp->if_snd.ifq_maxlen = TI_TX_RING_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, TI_TX_RING_CNT - 1); + IFQ_SET_READY(&ifp->if_snd); bcopy(sc->sc_dv.dv_xname, ifp->if_xname, IFNAMSIZ); /* Set up ifmedia support. */ @@ -1901,7 +1902,7 @@ int ti_intr(xsc) /* Re-enable interrupts. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, 0); - if (ifp->if_flags & IFF_RUNNING && ifp->if_snd.ifq_head != NULL) + if (ifp->if_flags & IFF_RUNNING && !IFQ_IS_EMPTY(&ifp->if_snd)) ti_start(ifp); return (1); @@ -2024,13 +2025,14 @@ void ti_start(ifp) struct ti_softc *sc; struct mbuf *m_head = NULL; u_int32_t prodidx = 0; + int pkts = 0; sc = ifp->if_softc; prodidx = CSR_READ_4(sc, TI_MB_SENDPROD_IDX); while(sc->ti_cdata.ti_tx_chain[prodidx] == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_POLL(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -2040,11 +2042,14 @@ void ti_start(ifp) * for the NIC to drain the ring. */ if (ti_encap(sc, m_head, &prodidx)) { - IF_PREPEND(&ifp->if_snd, m_head); ifp->if_flags |= IFF_OACTIVE; break; } + /* now we are committed to transmit the packet */ + IFQ_DEQUEUE(&ifp->if_snd, m_head); + pkts++; + /* * If there's a BPF listener, bounce a copy of this frame * to him. @@ -2054,6 +2059,8 @@ void ti_start(ifp) bpf_mtap(ifp->if_bpf, m_head); #endif } + if (pkts == 0) + return; /* Transmit */ CSR_WRITE_4(sc, TI_MB_SENDPROD_IDX, prodidx); diff --git a/sys/dev/pci/if_tl.c b/sys/dev/pci/if_tl.c index b5ad89c0198..60d970d3bc0 100644 --- a/sys/dev/pci/if_tl.c +++ b/sys/dev/pci/if_tl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tl.c,v 1.20 2001/06/24 20:27:01 fgsch Exp $ */ +/* $OpenBSD: if_tl.c,v 1.21 2001/06/27 06:34:49 kjc Exp $ */ /* * Copyright (c) 1997, 1998 @@ -1392,7 +1392,7 @@ int tl_intr(xsc) CMD_PUT(sc, TL_CMD_ACK | r | type); } - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_IS_EMPTY(&ifp->if_snd)) tl_start(ifp); return r; @@ -1568,7 +1568,7 @@ void tl_start(ifp) start_tx = sc->tl_cdata.tl_tx_free; while(sc->tl_cdata.tl_tx_free != NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -2151,7 +2151,8 @@ tl_attach(parent, self, aux) ifp->if_start = tl_start; ifp->if_watchdog = tl_watchdog; ifp->if_baudrate = 10000000; - ifp->if_snd.ifq_maxlen = TL_TX_LIST_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, TL_TX_LIST_CNT - 1); + IFQ_SET_READY(&ifp->if_snd); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); /* diff --git a/sys/dev/pci/if_tx.c b/sys/dev/pci/if_tx.c index 9f8c070e74c..9c4abd38f72 100644 --- a/sys/dev/pci/if_tx.c +++ b/sys/dev/pci/if_tx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_tx.c,v 1.16 2001/06/25 02:18:48 fgsch Exp $ */ +/* $OpenBSD: if_tx.c,v 1.17 2001/06/27 06:34:50 kjc Exp $ */ /* $FreeBSD: src/sys/pci/if_tx.c,v 1.45 2001/02/07 20:11:02 semenu Exp $ */ /*- @@ -447,7 +447,8 @@ epic_freebsd_attach(dev) ifp->if_init = (if_init_f_t*)epic_init; ifp->if_timer = 0; ifp->if_baudrate = 10000000; - ifp->if_snd.ifq_maxlen = TX_RING_SIZE - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, TX_RING_SIZE - 1); + IFQ_SET_READY(&ifp->if_snd); /* Enable ports, memory and busmastering */ command = pci_read_config(dev, PCIR_COMMAND, 4); @@ -819,7 +820,7 @@ epic_ifstart(ifp) flist = sc->tx_flist + sc->cur_tx; /* Get next packet to send */ - IF_DEQUEUE( &ifp->if_snd, m0 ); + IFQ_DEQUEUE( &ifp->if_snd, m0 ); /* If nothing to send, return */ if( NULL == m0 ) return; @@ -1032,7 +1033,7 @@ epic_intr(arg) if( status & (INTSTAT_TXC|INTSTAT_TCC|INTSTAT_TQE) ) { epic_tx_done( sc ); if(!(sc->sc_if.if_flags & IFF_OACTIVE) && - sc->sc_if.if_snd.ifq_head ) + !IFQ_IS_EMPTY( &sc->sc_if.if_snd )) epic_ifstart( &sc->sc_if ); } @@ -1122,7 +1123,7 @@ epic_ifwatchdog(ifp) printf("seems we can continue normaly\n"); /* Start output */ - if( ifp->if_snd.ifq_head ) epic_ifstart( ifp ); + if( !IFQ_IS_EMPTY( &ifp->if_snd ) ) epic_ifstart( ifp ); splx(x); } diff --git a/sys/dev/pci/if_txp.c b/sys/dev/pci/if_txp.c index 9a777506fd4..a0ad84c0b18 100644 --- a/sys/dev/pci/if_txp.c +++ b/sys/dev/pci/if_txp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_txp.c,v 1.47 2001/06/24 22:58:01 fgsch Exp $ */ +/* $OpenBSD: if_txp.c,v 1.48 2001/06/27 06:34:50 kjc Exp $ */ /* * Copyright (c) 2001 @@ -270,7 +270,8 @@ txp_attach(parent, self, aux) ifp->if_start = txp_start; ifp->if_watchdog = txp_watchdog; ifp->if_baudrate = 10000000; - ifp->if_snd.ifq_maxlen = TX_ENTRIES; + IFQ_SET_MAXLEN(&ifp->if_snd, TX_ENTRIES); + IFQ_SET_READY(&ifp->if_snd); ifp->if_capabilities = 0; bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); @@ -1280,7 +1281,7 @@ txp_start(ifp) cnt = r->r_cnt; while (1) { - IF_DEQUEUE(&ifp->if_snd, m); + IFQ_DEQUEUE(&ifp->if_snd, m); if (m == NULL) break; diff --git a/sys/dev/pci/if_vr.c b/sys/dev/pci/if_vr.c index f4d2ead0bd8..1c720aa7748 100644 --- a/sys/dev/pci/if_vr.c +++ b/sys/dev/pci/if_vr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_vr.c,v 1.17 2001/06/24 22:38:47 aaron Exp $ */ +/* $OpenBSD: if_vr.c,v 1.18 2001/06/27 06:34:50 kjc Exp $ */ /* * Copyright (c) 1997, 1998 @@ -766,6 +766,7 @@ vr_attach(parent, self, aux) ifp->if_start = vr_start; ifp->if_watchdog = vr_watchdog; ifp->if_baudrate = 10000000; + IFQ_SET_READY(&ifp->if_snd); bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); /* @@ -1185,7 +1186,7 @@ vr_intr(arg) /* Re-enable interrupts. */ CSR_WRITE_2(sc, VR_IMR, VR_INTRS); - if (ifp->if_snd.ifq_head != NULL) { + if (!IFQ_IS_EMPTY(&ifp->if_snd)) { vr_start(ifp); } @@ -1291,7 +1292,7 @@ vr_start(ifp) start_tx = sc->vr_cdata.vr_tx_free; while(sc->vr_cdata.vr_tx_free->vr_mbuf == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -1548,7 +1549,7 @@ vr_watchdog(ifp) vr_reset(sc); vr_init(sc); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_IS_EMPTY(&ifp->if_snd)) vr_start(ifp); return; diff --git a/sys/dev/pci/if_wb.c b/sys/dev/pci/if_wb.c index 8655e3d5d32..e324c0abfc7 100644 --- a/sys/dev/pci/if_wb.c +++ b/sys/dev/pci/if_wb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wb.c,v 1.10 2001/06/24 20:27:02 fgsch Exp $ */ +/* $OpenBSD: if_wb.c,v 1.11 2001/06/27 06:34:50 kjc Exp $ */ /* * Copyright (c) 1997, 1998 @@ -903,7 +903,9 @@ wb_attach(parent, self, aux) ifp->if_start = wb_start; ifp->if_watchdog = wb_watchdog; ifp->if_baudrate = 10000000; - ifp->if_snd.ifq_maxlen = WB_TX_LIST_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, WB_TX_LIST_CNT - 1); + IFQ_SET_READY(&ifp->if_snd); + bcopy(sc->sc_dev.dv_xname, ifp->if_xname, IFNAMSIZ); /* @@ -1310,7 +1312,7 @@ int wb_intr(arg) /* Re-enable interrupts. */ CSR_WRITE_4(sc, WB_IMR, WB_INTRS); - if (ifp->if_snd.ifq_head != NULL) { + if (!IFQ_IS_EMPTY(&ifp->if_snd)) { wb_start(ifp); } @@ -1449,7 +1451,7 @@ void wb_start(ifp) start_tx = sc->wb_cdata.wb_tx_free; while(sc->wb_cdata.wb_tx_free->wb_mbuf == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -1752,7 +1754,7 @@ void wb_watchdog(ifp) wb_reset(sc); wb_init(sc); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_IS_EMPTY(&ifp->if_snd)) wb_start(ifp); return; diff --git a/sys/dev/pci/if_wx.c b/sys/dev/pci/if_wx.c index cc43092c01c..2557548b476 100644 --- a/sys/dev/pci/if_wx.c +++ b/sys/dev/pci/if_wx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wx.c,v 1.13 2001/06/24 20:27:03 fgsch Exp $ */ +/* $OpenBSD: if_wx.c,v 1.14 2001/06/27 06:34:51 kjc Exp $ */ /* * Principal Author: Matthew Jacob * Copyright (c) 1999, 2001 by Traakan Software @@ -722,7 +722,8 @@ wx_attach(device_t dev) ifp->if_ioctl = wx_ioctl; ifp->if_start = wx_start; ifp->if_watchdog = wx_txwatchdog; - ifp->if_snd.ifq_maxlen = WX_MAX_TDESC - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, WX_MAX_TDESC - 1); + IFQ_SET_READY(&ifp->if_snd); ether_ifattach(ifp, ETHER_BPF_SUPPORTED); out: WX_UNLOCK(sc); @@ -1125,7 +1126,7 @@ wx_start(struct ifnet *ifp) int gctried = 0; struct mbuf *m, *mb_head; - IF_DEQUEUE(&ifp->if_snd, mb_head); + IFQ_DEQUEUE(&ifp->if_snd, mb_head); if (mb_head == NULL) { break; } @@ -1264,6 +1265,17 @@ wx_start(struct ifnet *ifp) if (nactv == WX_MAX_TDESC && mb_head->m_next == NULL) { sc->wx_xmitputback++; ifp->if_flags |= IFF_OACTIVE; +#ifdef ALTQ + /* + * XXX when altq is enabled, we can't put the + * packet back to the queue. + * just give up this packet for now. + */ + if (ALTQ_IS_ENABLED(&ifp->if_snd)) { + m_freem(mb_head); + break; + } +#endif IF_PREPEND(&ifp->if_snd, mb_head); break; } @@ -1336,7 +1348,7 @@ wx_intr(void *arg) if (sc->tactive) { wx_gc(sc); } - if (sc->wx_if.if_snd.ifq_head != NULL) { + if (IFQ_IS_EMPTY(&sc->wx_if.if_snd) == 0) { wx_start(&sc->wx_if); } WX_ENABLE_INT(sc); |