svn commit: r281639 - head/sys/arm/allwinner

Luiz Otavio O Souza loos at FreeBSD.org
Fri Apr 17 03:56:51 UTC 2015


Author: loos
Date: Fri Apr 17 03:56:50 2015
New Revision: 281639
URL: https://svnweb.freebsd.org/changeset/base/281639

Log:
  Fix the 'wrong packet header' errors for if_emac.
  
  Do not strip the ethernet CRC until we read all data from FIFO, otherwise
  the CRC bytes would be left in FIFO causing the failure of next packet
  (wrong packet header).
  
  When this error happens the receiver has to be disabled and the RX FIFO
  flushed, discarding valid packets.
  
  With this fix if_emac behaves a lot better.

Modified:
  head/sys/arm/allwinner/if_emac.c

Modified: head/sys/arm/allwinner/if_emac.c
==============================================================================
--- head/sys/arm/allwinner/if_emac.c	Fri Apr 17 01:51:05 2015	(r281638)
+++ head/sys/arm/allwinner/if_emac.c	Fri Apr 17 03:56:50 2015	(r281639)
@@ -358,15 +358,13 @@ emac_rxeof(struct emac_softc *sc, int co
 				return;
 			m->m_len = m->m_pkthdr.len = MCLBYTES;
 
-			len -= ETHER_CRC_LEN;
-
 			/* Copy entire frame to mbuf first. */
 			bus_space_read_multi_4(sc->emac_tag, sc->emac_handle,
 			    EMAC_RX_IO_DATA, mtod(m, uint32_t *),
 			    roundup2(len, 4) / 4);
 
 			m->m_pkthdr.rcvif = ifp;
-			m->m_len = m->m_pkthdr.len = len;
+			m->m_len = m->m_pkthdr.len = len - ETHER_CRC_LEN;
 
 			/*
 			 * Emac controller needs strict aligment, so to avoid


More information about the svn-src-head mailing list