From owner-p4-projects@FreeBSD.ORG Sat Mar 11 02:03:37 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 593CF16A9B4; Sat, 11 Mar 2006 02:03:22 +0000 (GMT) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7980716A9FE; Sat, 11 Mar 2006 02:03:08 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from server.baldwin.cx (66-23-211-162.clients.speedfactory.net [66.23.211.162]) by mx1.FreeBSD.org (Postfix) with ESMTP id C906E4433D; Fri, 10 Mar 2006 12:57:50 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from zion.baldwin.cx (zion.baldwin.cx [192.168.0.7]) (authenticated bits=0) by server.baldwin.cx (8.13.4/8.13.4) with ESMTP id k2ACvghT053506; Fri, 10 Mar 2006 07:57:48 -0500 (EST) (envelope-from jhb@freebsd.org) From: John Baldwin To: Warner Losh Date: Fri, 10 Mar 2006 07:57:39 -0500 User-Agent: KMail/1.8.3 References: <200603100640.k2A6e2fM072334@repoman.freebsd.org> In-Reply-To: <200603100640.k2A6e2fM072334@repoman.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-15" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200603100757.40459.jhb@freebsd.org> X-Virus-Scanned: ClamAV 0.87.1/1321/Thu Mar 9 23:54:15 2006 on server.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-3.1 required=4.2 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.1.0 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on server.baldwin.cx Cc: Perforce Change Reviews Subject: Re: PERFORCE change 93095 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Mar 2006 02:03:37 -0000 On Friday 10 March 2006 01:40 am, Warner Losh wrote: > http://perforce.freebsd.org/chv.cgi?CH=3D93095 > > Change 93095 by imp@imp_hammer on 2006/03/10 06:39:29 > > Try to use m_devget() as suggested by jhb and done in the de > driver. > > Affected files ... > > .. //depot/projects/arm/src/sys/arm/at91/if_ate.c#38 edit > > Differences ... > > =3D=3D=3D=3D //depot/projects/arm/src/sys/arm/at91/if_ate.c#38 (text+ko) = =3D=3D=3D=3D > > @@ -24,10 +24,8 @@ > > /* TODO: (in no order) > * > - * 5) Setup RX buffers in ateinit_locked > * 8) Need to sync busdma goo in atestop > * 9) atestop should maybe free the mbufs? > - * 10) On Rx, how do we get a new mbuf? > * > * 1) detach > * 2) Free dma setup > @@ -657,7 +655,8 @@ > mb->m_len =3D rx_stat & ETH_LEN_MASK; > mb->m_pkthdr.len =3D mb->m_len; > mb->m_pkthdr.rcvif =3D sc->ifp; > - tmp_mbuf =3D m_copyup(mb, ETHER_HDR_LEN, 2); > + tmp_mbuf =3D m_devget(mtod(md, caddr_t), mb->m_len, > + ETHER_ALIGN, sc->ifp, NULL); > /* > * For the last buffer, set the wrap bit so > * the controller restarts from the first Note that you can drop all the mb-> lines above, just pass in rx_stat &=20 ETH_LEN_MASK to m_devget() where you pass mb->m_len. It will setup the pkthdr on the new mbuf. You probably want to bump your iferrors count if m_devget fails too. > @@ -671,7 +670,8 @@ > BUS_DMASYNC_PREREAD); > bus_dmamap_sync(sc->rx_desc_tag, sc->rx_desc_map, > BUS_DMASYNC_PREWRITE); > - (*sc->ifp->if_input)(sc->ifp, tmp_mbuf); > + if (tmp_mbuf !=3D NULL) > + (*sc->ifp->if_input)(sc->ifp, tmp_mbuf); > } Not sure if you have locking for this driver yet, but if you do, don't forget to drop your driver lock around the call to if_input. =2D-=20 John Baldwin =A0<>< =A0http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" =A0=3D =A0http://www.FreeBSD.org