From owner-freebsd-current@FreeBSD.ORG Sat Jan 3 16:27:27 2009 Return-Path: Delivered-To: current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 507B5106566B for ; Sat, 3 Jan 2009 16:27:27 +0000 (UTC) (envelope-from chris@hitnet.RWTH-Aachen.DE) Received: from mta-2.ms.rz.rwth-aachen.de (mta-2.ms.rz.RWTH-Aachen.DE [134.130.7.73]) by mx1.freebsd.org (Postfix) with ESMTP id F05728FC14 for ; Sat, 3 Jan 2009 16:27:26 +0000 (UTC) (envelope-from chris@hitnet.RWTH-Aachen.DE) MIME-version: 1.0 Received: from ironport-out-1.rz.rwth-aachen.de ([134.130.5.40]) by mta-2.ms.rz.RWTH-Aachen.de (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008)) with ESMTP id <0KCW00EMHKBOX9C0@mta-2.ms.rz.RWTH-Aachen.de> for current@freebsd.org; Sat, 03 Jan 2009 16:57:24 +0100 (CET) X-IronPort-AV: E=Sophos;i="4.36,322,1228086000"; d="diff'?scan'208";a="95317559" Received: from smarthost-2.ms.rz.rwth-aachen.de (HELO smarthost.rwth-aachen.de) ([134.130.7.90]) by ironport-in-1.rz.rwth-aachen.de with ESMTP; Sat, 03 Jan 2009 16:57:24 +0100 Received: from bigboss.hitnet.rwth-aachen.de (bigspace.hitnet.RWTH-Aachen.DE [137.226.181.2]) by smarthost.rwth-aachen.de (8.13.8+Sun/8.13.8/1) with ESMTP id n03FvOff002868 for ; Sat, 03 Jan 2009 16:57:24 +0100 (CET) Received: from haakonia.hitnet.rwth-aachen.de ([137.226.181.92]) by bigboss.hitnet.rwth-aachen.de with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.63) (envelope-from ) id 1LJ8sO-0003aK-Aw for current@freebsd.org; Sat, 03 Jan 2009 16:57:24 +0100 Received: by haakonia.hitnet.rwth-aachen.de (Postfix, from userid 1001) id 283E63F433; Sat, 03 Jan 2009 16:57:24 +0100 (CET) Date: Sat, 03 Jan 2009 16:57:24 +0100 From: Christian Brueffer To: current@freebsd.org Message-id: <20090103155724.GC1243@haakonia.hitnet.RWTH-Aachen.DE> Content-type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary=Lb0e7rgc7IsuDeGj Content-disposition: inline X-Operating-System: FreeBSD 6.4-STABLE X-PGP-Key: http://people.FreeBSD.org/~brueffer/brueffer.key.asc X-PGP-Fingerprint: A5C8 2099 19FF AACA F41B B29B 6C76 178C A0ED 982D User-Agent: Mutt/1.5.11 Cc: Subject: CFT: altq support for pcn(4) X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Jan 2009 16:27:27 -0000 --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--