From owner-freebsd-hackers@freebsd.org Wed Nov 23 13:12:59 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 95E9DC505C2 for ; Wed, 23 Nov 2016 13:12:59 +0000 (UTC) (envelope-from david@madTurtle.lapinbilly.eu) Received: from madTurtle.lapinbilly.eu (xvm-127-18.dc2.ghst.net [185.26.127.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "madTurtle", Issuer "madTurtle" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 2FA02DEC for ; Wed, 23 Nov 2016 13:12:58 +0000 (UTC) (envelope-from david@madTurtle.lapinbilly.eu) Received: from madTurtle.lapinbilly.eu (localhost [127.0.0.1]) by madTurtle.lapinbilly.eu (8.15.2/8.15.2) with ESMTPS id uANCsDED092226 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO) for ; Wed, 23 Nov 2016 12:54:13 GMT (envelope-from david@madTurtle.lapinbilly.eu) Received: (from david@localhost) by madTurtle.lapinbilly.eu (8.15.2/8.15.2/Submit) id uANCsDlS092225 for freebsd-hackers@freebsd.org; Wed, 23 Nov 2016 13:54:13 +0100 (CET) (envelope-from david) Date: Wed, 23 Nov 2016 13:54:13 +0100 From: David Marec To: freebsd-hackers@freebsd.org Subject: Re: RTL 8111G Message-ID: <20161123125412.GA92220@madTurtle.lapinbilly.eu> References: <582AEEAE.2030702@systella.fr> <58341ECB.8080605@systella.fr> <66187adb-2240-e63f-3800-b454cd4cbc0b@davenulle.org> <5834C6C2.4070102@systella.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5834C6C2.4070102@systella.fr> User-Agent: Mutt/1.7.1 (2016-10-04) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Nov 2016 13:12:59 -0000 On Tue, Nov 22, 2016 at 11:29:22PM +0100, BERTRAND Joël wrote: > > I don't understand your last sentences. What is the failure on > 'M_DONTWAIT' ? > Reading your first post, I was thinking about patching the realteak driver, as the flag 'M_DONTWAIT' is no more used when allocating mbufs. Starting from the last driver I found on the realteack website (1.92), here is a patch that make it build against FreeBSD 11-Release: --- if_re.c.orig 2016-11-23 13:36:22.034612000 +0100 +++ if_re.c 2016-11-23 13:38:15.458230000 +0100 @@ -61,6 +61,7 @@ #include #include #include +#include #include @@ -720,7 +721,7 @@ else size =MJUM9BYTES; for (i = 0; i < RE_RX_BUF_NUM; i++) { - sc->re_desc.rx_buf[i] = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, size); + sc->re_desc.rx_buf[i] = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size); if (!sc->re_desc.rx_buf[i]) { //device_printf(dev, "m_getcl fail!!!\n"); error = ENXIO; @@ -5432,7 +5433,7 @@ { struct mbuf *m_new = NULL; - m_new = m_defrag(m_head, M_DONTWAIT); + m_new = m_defrag(m_head, M_NOWAIT); if (m_new == NULL) { printf("re%d: no memory for tx list", sc->re_unit); @@ -5576,7 +5577,7 @@ sc->re_desc.tx_last_index = (sc->re_desc.tx_last_index+1)%RE_TX_BUF_NUM; txptr=&sc->re_desc.tx_desc[sc->re_desc.tx_last_index]; - ifp->if_opackets++; + if_inc_counter(ifp,IFCOUNTER_OPACKETS,1); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; } @@ -5654,7 +5655,7 @@ else size = MJUM9BYTES; - buf = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR, size); + buf = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, size); if (buf==NULL) { bError=1; goto update_desc; @@ -5719,7 +5720,7 @@ } eh = mtod(m, struct ether_header *); - ifp->if_ipackets++; + if_inc_counter(ifp,IFCOUNTER_IPACKETS,1); #ifdef _DEBUG_ printf("Rcv Packet, Len=%d \n", m->m_len); #endif @@ -5794,7 +5795,7 @@ #if OS_VER < VERSION(7,0) re_int_task(arg, 0); #else - taskqueue_enqueue_fast(taskqueue_fast, &sc->re_inttask); + taskqueue_enqueue(taskqueue_fast, &sc->re_inttask); return (FILTER_HANDLED); #endif @@ -5874,7 +5875,7 @@ #if OS_VER>=VERSION(7,0) if (CSR_READ_2(sc, RE_ISR) & RE_INTRS) { - taskqueue_enqueue_fast(taskqueue_fast, &sc->re_inttask); + taskqueue_enqueue(taskqueue_fast, &sc->re_inttask); return; } #endif I made few tests on the first machine that embedds this NIC and it seems to be working. -- David Marec