Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 19 Mar 2009 00:52:30 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r190008 - in stable/7/sys: . contrib/pf dev/cxgb dev/sis
Message-ID:  <200903190052.n2J0qUSj043249@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Thu Mar 19 00:52:30 2009
New Revision: 190008
URL: http://svn.freebsd.org/changeset/base/190008

Log:
  MFC r185784:
    Fix a long standing VLAN tagged frame handling bug.
    When VLAN tagged frame is received the hardware sets 'LONG' bit of
    Rx status word. It is always set when the size of received frame
    exceeded 1518 bytes, including CRC. This VLAN tagged frame clears
    'OK' bit of Rx status word such that driver should not rely on 'OK'
    bit of Rx status word to pass the VLAN tagged frame to upper stack.
  
    To fix the bug, don't use SIS_CMDSTS_PKT_OK for Rx error check and
    introduce SIS_RXSTAT_ERROR macro that checks Rx errors. If we are
    configured to accept VLAN tagged frames and the received frame size
    is less than or equal to maximum allowed length of VLAN tagged
    frame, clear 'LONG' bit of Rx status word before checking Rx
    errors.
  
    Reported by:	Vladimir Ermako < samflanker <> gmail DOT com >
    Tested by:	Vladimir Ermako < samflanker <> gmail DOT com >

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/dev/sis/if_sis.c
  stable/7/sys/dev/sis/if_sisreg.h

Modified: stable/7/sys/dev/sis/if_sis.c
==============================================================================
--- stable/7/sys/dev/sis/if_sis.c	Thu Mar 19 00:44:22 2009	(r190007)
+++ stable/7/sys/dev/sis/if_sis.c	Thu Mar 19 00:52:30 2009	(r190008)
@@ -1431,7 +1431,11 @@ sis_rxeof(struct sis_softc *sc)
 		 * it should simply get re-used next time this descriptor
 	 	 * comes up in the ring.
 		 */
-		if (!(rxstat & SIS_CMDSTS_PKT_OK)) {
+		if ((ifp->if_capenable & IFCAP_VLAN_MTU) != 0 &&
+		    total_len <= (ETHER_MAX_LEN + ETHER_VLAN_ENCAP_LEN -
+		    ETHER_CRC_LEN))
+			rxstat &= ~SIS_RXSTAT_GIANT;
+		if (SIS_RXSTAT_ERROR(rxstat) != 0) {
 			ifp->if_ierrors++;
 			if (rxstat & SIS_RXSTAT_COLL)
 				ifp->if_collisions++;

Modified: stable/7/sys/dev/sis/if_sisreg.h
==============================================================================
--- stable/7/sys/dev/sis/if_sisreg.h	Thu Mar 19 00:44:22 2009	(r190007)
+++ stable/7/sys/dev/sis/if_sisreg.h	Thu Mar 19 00:52:30 2009	(r190008)
@@ -348,6 +348,11 @@ struct sis_desc {
 #define SIS_RXSTAT_OVERRUN	0x02000000
 #define SIS_RXSTAT_RX_ABORT	0x04000000
 
+#define	SIS_RXSTAT_ERROR(x)						\
+	((x) & (SIS_RXSTAT_RX_ABORT | SIS_RXSTAT_OVERRUN |		\
+	SIS_RXSTAT_GIANT | SIS_RXSTAT_SYMBOLERR | SIS_RXSTAT_RUNT |	\
+	SIS_RXSTAT_CRCERR | SIS_RXSTAT_ALIGNERR))
+
 #define SIS_DSTCLASS_REJECT	0x00000000
 #define SIS_DSTCLASS_UNICAST	0x00800000
 #define SIS_DSTCLASS_MULTICAST	0x01000000



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