Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 Mar 2006 17:43:40 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 93112 for review
Message-ID:  <200603101743.k2AHhe3E017857@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200603101743.k2AHhe3E017857>