Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Apr 2015 03:56:51 +0000 (UTC)
From:      Luiz Otavio O Souza <loos@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r281639 - head/sys/arm/allwinner
Message-ID:  <201504170356.t3H3upL5099055@svn.freebsd.org>

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



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