Index: if_pcn.c =================================================================== RCS file: /data/ncvs/freebsd/src/sys/dev/pcn/if_pcn.c,v retrieving revision 1.1 diff -u -r1.1 if_pcn.c --- if_pcn.c 14 Aug 2008 20:34:46 -0000 1.1 +++ if_pcn.c 2 Jan 2009 20:24:27 -0000 @@ -632,7 +632,9 @@ ifp->if_start = pcn_start; ifp->if_watchdog = pcn_watchdog; ifp->if_init = pcn_init; - ifp->if_snd.ifq_maxlen = PCN_TX_LIST_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, PCN_TX_LIST_CNT - 1); + ifp->if_snd.ifq_drv_maxlen = PCN_TX_LIST_CNT - 1; + IFQ_SET_READY(&ifp->if_snd); /* * Do MII setup. @@ -976,7 +978,7 @@ if (!sc->pcn_link && mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE) { sc->pcn_link++; - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) pcn_start_locked(ifp); } @@ -1022,7 +1024,7 @@ } } - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) pcn_start_locked(ifp); PCN_UNLOCK(sc); @@ -1108,6 +1110,7 @@ struct pcn_softc *sc; struct mbuf *m_head = NULL; u_int32_t idx; + int queued = 0; sc = ifp->if_softc; @@ -1122,16 +1125,18 @@ return; while(sc->pcn_cdata.pcn_tx_chain[idx] == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; if (pcn_encap(sc, m_head, &idx)) { - IF_PREPEND(&ifp->if_snd, m_head); + IFQ_DRV_PREPEND(&ifp->if_snd, m_head); ifp->if_drv_flags |= IFF_DRV_OACTIVE; break; } + queued++; + /* * If there's a BPF listener, bounce a copy of this frame * to him. @@ -1140,14 +1145,16 @@ } - /* Transmit */ - sc->pcn_cdata.pcn_tx_prod = idx; - pcn_csr_write(sc, PCN_CSR_CSR, PCN_CSR_TX|PCN_CSR_INTEN); + if (queued) { + /* Transmit */ + sc->pcn_cdata.pcn_tx_prod = idx; + pcn_csr_write(sc, PCN_CSR_CSR, PCN_CSR_TX|PCN_CSR_INTEN); - /* - * Set a timeout in case the chip goes out to lunch. - */ - ifp->if_timer = 5; + /* + * Set a timeout in case the chip goes out to lunch. + */ + ifp->if_timer = 5; + } return; } @@ -1332,7 +1339,7 @@ pcn_stop(sc); pcn_reset(sc); pcn_init_locked(sc); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) pcn_start_locked(ifp); PCN_UNLOCK(sc); @@ -1445,8 +1452,8 @@ pcn_reset(sc); pcn_init_locked(sc); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) pcn_start(ifp); PCN_UNLOCK(sc);