From owner-freebsd-net@FreeBSD.ORG Wed Mar 9 13:45:02 2005 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4FCC816A4CE for ; Wed, 9 Mar 2005 13:45:02 +0000 (GMT) Received: from mail.omniti.com (longsword.omniti.com [66.80.117.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 86B7543D41 for ; Wed, 9 Mar 2005 13:45:01 +0000 (GMT) (envelope-from jesus@omniti.com) DomainKey-Status: good DomainKey-Signature: q=dns; a=rsa-sha1; c=nofws; s=test; d=omniti.com; h=Received:Message-ID:Date:From:User-Agent:X-Accept-Language:MIME-Version:To:Subject:Content-Type:Content-Transfer-Encoding; b=O5GQOKX1McPUGKTWQIjjQI1BCixv2QUcl9mZUDYfMmEa7aDw5bYXSa4tuxLWGX5A G/DC3hYryZR4F25WzZkK4NM2ikpQVoVk4+HvGNARj9Nl1ayA+IChWhNfisOQRapt Received: from ([10.80.116.114:60141] helo=[10.80.116.114]) by mail.omniti.com (ecelerity HEAD) with SMTP id F4/3C-27841-1DDFE224 for ; Wed, 09 Mar 2005 08:44:51 -0500 Message-ID: <422EFEE4.6090401@omniti.com> Date: Wed, 09 Mar 2005 08:49:24 -0500 From: Theo Schlossnagle User-Agent: Mozilla Thunderbird 0.9 (X11/20041127) X-Accept-Language: en-us, en MIME-Version: 1.0 To: freebsd-net@freebsd.org Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: FreeBSD 5.3 if_re.c (re) altq compatibility patch X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Mar 2005 13:45:02 -0000 Howdy, On my FreBSD 5.3-p5 box, the "re" ethernet driver doesn't support altq. Here's a patch to convert if_re.c to use the IFQ macros for altq compatibility. --- /usr/src/sys/dev/re/if_re.c.old Tue Feb 1 21:37:26 2005 +++ /usr/src/sys/dev/re/if_re.c Tue Feb 1 22:20:04 2005 @@ -1203,7 +1203,9 @@ ifp->if_baudrate = 1000000000; else ifp->if_baudrate = 100000000; - ifp->if_snd.ifq_maxlen = RL_IFQ_MAXLEN; + IFQ_SET_MAXLEN(&ifp->if_snd, RL_IFQ_MAXLEN); + ifp->if_snd.ifq_drv_maxlen = RL_IFQ_MAXLEN; + IFQ_SET_READY(&ifp->if_snd); ifp->if_capenable = ifp->if_capabilities; callout_handle_init(&sc->rl_stat_ch); @@ -1786,7 +1788,7 @@ re_rxeof(sc); re_txeof(sc); - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) re_start_locked(ifp); if (cmd == POLL_AND_CHECK_STATUS) { /* also check status register */ @@ -1870,7 +1872,7 @@ } } - if (ifp->if_snd.ifq_head != NULL) + if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) re_start_locked(ifp); done_locked: @@ -2007,7 +2009,7 @@ { struct rl_softc *sc; struct mbuf *m_head = NULL; - int idx; + int idx, queued = 0; sc = ifp->if_softc; @@ -2016,7 +2018,7 @@ idx = sc->rl_ldata.rl_tx_prodidx; while (sc->rl_ldata.rl_tx_mbuf[idx] == NULL) { - IF_DEQUEUE(&ifp->if_snd, m_head); + IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head); if (m_head == NULL) break; @@ -2031,25 +2033,27 @@ * to him. */ BPF_MTAP(ifp, m_head); + + queued++; } /* Flush the TX descriptors */ + if (queued) { + bus_dmamap_sync(sc->rl_ldata.rl_tx_list_tag, + sc->rl_ldata.rl_tx_list_map, + BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); - bus_dmamap_sync(sc->rl_ldata.rl_tx_list_tag, - sc->rl_ldata.rl_tx_list_map, - BUS_DMASYNC_PREWRITE|BUS_DMASYNC_PREREAD); - - sc->rl_ldata.rl_tx_prodidx = idx; + sc->rl_ldata.rl_tx_prodidx = idx; /* * RealTek put the TX poll request register in a different * location on the 8169 gigE chip. I don't know why. */ - if (sc->rl_type == RL_8169) - CSR_WRITE_2(sc, RL_GTXSTART, RL_TXSTART_START); - else - CSR_WRITE_2(sc, RL_TXSTART, RL_TXSTART_START); + if (sc->rl_type == RL_8169) + CSR_WRITE_2(sc, RL_GTXSTART, RL_TXSTART_START); + else + CSR_WRITE_2(sc, RL_TXSTART, RL_TXSTART_START); /* * Use the countdown timer for interrupt moderation. @@ -2059,12 +2063,13 @@ * interrupt. Each time we write to the TIMERCNT register, * the timer count is reset to 0. */ - CSR_WRITE_4(sc, RL_TIMERCNT, 1); + CSR_WRITE_4(sc, RL_TIMERCNT, 1); /* * Set a timeout in case the chip goes out to lunch. */ - ifp->if_timer = 5; + ifp->if_timer = 5; + } } static void -- // Theo Schlossnagle // Principal Engineer -- http://www.omniti.com/~jesus/ // Postal Engine -- http://www.postalengine.com/ // Ecelerity: fastest MTA on Earth