Index: if_bge.c =================================================================== RCS file: /usr/store/mlaier/fcvs/src/sys/dev/bge/if_bge.c,v retrieving revision 1.72.2.2 diff -u -r1.72.2.2 if_bge.c --- if_bge.c 29 Sep 2004 14:31:49 -0000 1.72.2.2 +++ if_bge.c 8 Oct 2004 15:15:14 -0000 @@ -2384,7 +2384,9 @@ ifp->if_watchdog = bge_watchdog; ifp->if_init = bge_init; ifp->if_mtu = ETHERMTU; - ifp->if_snd.ifq_maxlen = BGE_TX_RING_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, BGE_TX_RING_CNT - 1); + ifp->if_snd.ifq_drv_maxlen = BGE_TX_RING_CNT - 1; + IFQ_SET_READY(&ifp->if_snd); ifp->if_hwassist = BGE_CSUM_FEATURES; /* NB: the code for RX csum offload is disabled for now */ ifp->if_capabilities = IFCAP_TXCSUM | IFCAP_VLAN_HWTAGGING | @@ -2982,7 +2984,7 @@ /* Re-enable interrupts. */ CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 0); - if (ifp->if_flags & IFF_RUNNING && ifp->if_snd.ifq_head != NULL) + if (ifp->if_flags & IFF_RUNNING && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bge_start_locked(ifp); BGE_UNLOCK(sc); @@ -3021,7 +3023,7 @@ BGE_MACMODE_TBI_SEND_CFGS); CSR_WRITE_4(sc, BGE_MAC_STS, 0xFFFFFFFF); printf("bge%d: gigabit link up\n", sc->bge_unit); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bge_start_locked(ifp); } return; @@ -3037,7 +3039,7 @@ IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX) printf("bge%d: gigabit link up\n", sc->bge_unit); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) bge_start_locked(ifp); } @@ -3199,6 +3201,7 @@ struct bge_softc *sc; struct mbuf *m_head = NULL; u_int32_t prodidx = 0; + int queued = 0; sc = ifp->if_softc; @@ -3208,7 +3211,7 @@ prodidx = CSR_READ_4(sc, BGE_MBX_TX_HOST_PROD0_LO); while(sc->bge_cdata.bge_tx_chain[prodidx] == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -3229,7 +3232,7 @@ m_head->m_pkthdr.csum_flags & (CSUM_DELAY_DATA)) { if ((BGE_TX_RING_CNT - sc->bge_txcnt) < m_head->m_pkthdr.csum_data + 16) { - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_flags |= IFF_OACTIVE; break; } @@ -3241,11 +3244,13 @@ * for the NIC to drain the ring. */ if (bge_encap(sc, m_head, &prodidx)) { - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_flags |= IFF_OACTIVE; break; } + queued++; + /* * If there's a BPF listener, bounce a copy of this frame * to him. @@ -3253,6 +3258,9 @@ BPF_MTAP(ifp, m_head); } + if (!queued) + return; + /* Transmit */ CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); /* 5700 b2 errata */