From owner-svn-src-stable@FreeBSD.ORG Thu Mar 19 00:52:30 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ED7E6106564A; Thu, 19 Mar 2009 00:52:30 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFB818FC19; Thu, 19 Mar 2009 00:52:30 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n2J0qUTA043251; Thu, 19 Mar 2009 00:52:30 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n2J0qUSj043249; Thu, 19 Mar 2009 00:52:30 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200903190052.n2J0qUSj043249@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 19 Mar 2009 00:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190008 - in stable/7/sys: . contrib/pf dev/cxgb dev/sis X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Mar 2009 00:52:31 -0000 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