Date: Sat, 03 Jan 2009 16:57:24 +0100 From: Christian Brueffer <brueffer@FreeBSD.org> To: current@freebsd.org Subject: CFT: altq support for pcn(4) Message-ID: <20090103155724.GC1243@haakonia.hitnet.RWTH-Aachen.DE>
next in thread | raw e-mail | index | archive | help
--Lb0e7rgc7IsuDeGj Content-Type: multipart/mixed; boundary="cQXOx3fnlpmgJsTP" Content-Disposition: inline --cQXOx3fnlpmgJsTP Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi everyone, attached is a patch that adds altq support for the pcn(4) driver. The patch should apply cleanly to HEAD and RELENG_7. The suggested testing procedure is outlined at http://people.freebsd.org/~mlaier/ALTQ_driver/ Feedback welcome. - Christian --=20 Christian Brueffer chris@unixpages.org brueffer@FreeBSD.org GPG Key: http://people.freebsd.org/~brueffer/brueffer.key.asc GPG Fingerprint: A5C8 2099 19FF AACA F41B B29B 6C76 178C A0ED 982D --cQXOx3fnlpmgJsTP Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="pcn_altq.diff" Content-Transfer-Encoding: quoted-printable Index: if_pcn.c =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D 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 =3D pcn_start; ifp->if_watchdog =3D pcn_watchdog; ifp->if_init =3D pcn_init; - ifp->if_snd.ifq_maxlen =3D PCN_TX_LIST_CNT - 1; + IFQ_SET_MAXLEN(&ifp->if_snd, PCN_TX_LIST_CNT - 1); + ifp->if_snd.ifq_drv_maxlen =3D PCN_TX_LIST_CNT - 1; + IFQ_SET_READY(&ifp->if_snd); =20 /* * Do MII setup. @@ -976,7 +978,7 @@ if (!sc->pcn_link && mii->mii_media_status & IFM_ACTIVE && IFM_SUBTYPE(mii->mii_media_active) !=3D IFM_NONE) { sc->pcn_link++; - if (ifp->if_snd.ifq_head !=3D NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) pcn_start_locked(ifp); } =20 @@ -1022,7 +1024,7 @@ } } =20 - if (ifp->if_snd.ifq_head !=3D NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) pcn_start_locked(ifp); =20 PCN_UNLOCK(sc); @@ -1108,6 +1110,7 @@ struct pcn_softc *sc; struct mbuf *m_head =3D NULL; u_int32_t idx; + int queued =3D 0; =20 sc =3D ifp->if_softc; =20 @@ -1122,16 +1125,18 @@ return; =20 while(sc->pcn_cdata.pcn_tx_chain[idx] =3D=3D NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head =3D=3D NULL) break; =20 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 |=3D IFF_DRV_OACTIVE; break; } =20 + queued++; + /* * If there's a BPF listener, bounce a copy of this frame * to him. @@ -1140,14 +1145,16 @@ =20 } =20 - /* Transmit */ - sc->pcn_cdata.pcn_tx_prod =3D idx; - pcn_csr_write(sc, PCN_CSR_CSR, PCN_CSR_TX|PCN_CSR_INTEN); + if (queued) { + /* Transmit */ + sc->pcn_cdata.pcn_tx_prod =3D idx; + pcn_csr_write(sc, PCN_CSR_CSR, PCN_CSR_TX|PCN_CSR_INTEN); =20 - /* - * Set a timeout in case the chip goes out to lunch. - */ - ifp->if_timer =3D 5; + /* + * Set a timeout in case the chip goes out to lunch. + */ + ifp->if_timer =3D 5; + } =20 return; } @@ -1332,7 +1339,7 @@ pcn_stop(sc); pcn_reset(sc); pcn_init_locked(sc); - if (ifp->if_snd.ifq_head !=3D NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) pcn_start_locked(ifp); =20 PCN_UNLOCK(sc); @@ -1445,8 +1452,8 @@ pcn_reset(sc); pcn_init_locked(sc); =20 - if (ifp->if_snd.ifq_head !=3D NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) pcn_start(ifp); =20 PCN_UNLOCK(sc); =20 --cQXOx3fnlpmgJsTP-- --Lb0e7rgc7IsuDeGj Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (FreeBSD) iD8DBQFJX4rkbHYXjKDtmC0RAnarAKC2VvJIfLRqmtB7ijoISgdw7KqPXwCg6Vkk fL8iKIrqgyf+OMu+iDW3qoI= =tPwW -----END PGP SIGNATURE----- --Lb0e7rgc7IsuDeGj--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090103155724.GC1243>