From owner-p4-projects@FreeBSD.ORG Sat Mar 11 02:10:28 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 D62FB16AADC; Sat, 11 Mar 2006 02:10:26 +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 57A9216AB2B for ; Sat, 11 Mar 2006 02:10:25 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 09B2247E25 for ; Fri, 10 Mar 2006 17:44:06 +0000 (GMT) (envelope-from imp@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.1/8.13.1) with ESMTP id k2AHhoTJ017860 for ; Fri, 10 Mar 2006 17:43:55 GMT (envelope-from imp@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.1/8.13.1/Submit) id k2AHhe3E017857 for perforce@freebsd.org; Fri, 10 Mar 2006 17:43:40 GMT (envelope-from imp@freebsd.org) Date: Fri, 10 Mar 2006 17:43:40 GMT Message-Id: <200603101743.k2AHhe3E017857@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to imp@freebsd.org using -f From: Warner Losh To: Perforce Change Reviews Cc: Subject: PERFORCE change 93112 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:10:28 -0000 http://perforce.freebsd.org/chv.cgi?CH=93112 Change 93112 by imp@imp_Speedy on 2006/03/10 17:43:02 Subtract out the CRC length from the lenght we report, as the EMAC device includes this lenght, but ifnet drivers do not want it. Free the mb that we just copied. This likely means that we can go with a much simpler 'pool' of memory for this device and not mess with the load/unload of each segment as a mbuf as we get packets. Minor compile nit. Affected files ... .. //depot/projects/arm/src/sys/arm/at91/if_ate.c#39 edit Differences ... ==== //depot/projects/arm/src/sys/arm/at91/if_ate.c#39 (text+ko) ==== @@ -652,11 +652,17 @@ BUS_DMASYNC_PREWRITE); continue; } - mb->m_len = rx_stat & ETH_LEN_MASK; + /* + * The length returned by the device includes the + * ethernet CRC calculation for the packet, but + * ifnet drivers are supposed to discard it. + */ + mb->m_len = (rx_stat & ETH_LEN_MASK) - ETHER_CRC_LEN; mb->m_pkthdr.len = mb->m_len; mb->m_pkthdr.rcvif = sc->ifp; - tmp_mbuf = m_devget(mtod(md, caddr_t), mb->m_len, + tmp_mbuf = m_devget(mtod(mb, caddr_t), mb->m_len, ETHER_ALIGN, sc->ifp, NULL); + m_free(mb); /* * For the last buffer, set the wrap bit so * the controller restarts from the first