From nobody@FreeBSD.org  Thu Feb  5 11:37:26 2009
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 06FC01065675
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  5 Feb 2009 11:37:26 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id E84068FC1D
	for <freebsd-gnats-submit@FreeBSD.org>; Thu,  5 Feb 2009 11:37:25 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id n15BbOg0071501
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 5 Feb 2009 11:37:24 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id n15BbOJR071500;
	Thu, 5 Feb 2009 11:37:24 GMT
	(envelope-from nobody)
Message-Id: <200902051137.n15BbOJR071500@www.freebsd.org>
Date: Thu, 5 Feb 2009 11:37:24 GMT
From: Sergey Tihonov <gluk@slan.ru>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Receive large packets by Vlan that parent if_sis (don't) work
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         131414
>Category:       kern
>Synopsis:       [sis] [patch] Receive large packets by Vlan that parent if_sis (don't) work
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    yongari
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 05 11:40:00 UTC 2009
>Closed-Date:    Thu Mar 19 01:19:48 UTC 2009
>Last-Modified:  Thu Mar 19 01:19:48 UTC 2009
>Originator:     Sergey Tihonov
>Release:        release 6.4
>Organization:
none
>Environment:
FreeBSD vts-uzhnaya.slan.ru 6.4-RELEASE FreeBSD 6.4-RELEASE #3: Tue Feb  3 17:55:28 MSK 2009     root@host1.slan.ru:/usr/src/sys/i386/compile/MINIBSD-64-FULL  i386

>Description:
Good day.
I have motherboard with integrated SIS 900.
When  ifconfig vlan777 create 10.3.3.3/24 vlan 777 vlandev sis0 
Packets that size more than 1468 didt received by vlan777
Im search patch, but find only patch which correct error counter.

>How-To-Repeat:
host1:
  ifconfig vlan777 create 10.3.3.3/24 vlan 777 vlandev sis0
host2:
  ifconfig vlan777 create 10.3.3.1/24 vlan 777 vlandev rl0
  ping -s 1500 10.3.3.3

Some or all packets lost.

>Fix:
Im correct two files if_sis.c and if_sisreg.h 
May be, this not correct code, but it help for me.
Patch appended

Patch attached with submission follows:

--- if_sis.c.bak	2008-10-02 06:57:00.000000000 +0400
+++ if_sis.c	2009-02-03 17:05:00.000000000 +0300
@@ -1431,9 +1431,12 @@
 		 * 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_ierrors++;
 				ifp->if_collisions++;
 			sis_newbuf(sc, cur_rx, m);
 			continue;
@@ -1649,6 +1652,7 @@
 		SIS_LOCK_ASSERT(sc);
 		/* Reading the ISR register clears all interrupts. */
 		status = CSR_READ_4(sc, SIS_ISR);
+		if (status & SIS_ISR_RX_EARLY) DELAY(1000); 
 
 		if ((status & SIS_INTRS) == 0)
 			break;
@@ -1661,8 +1665,10 @@
 		if (status & (SIS_ISR_RX_DESC_OK|SIS_ISR_RX_OK|SIS_ISR_RX_IDLE))
 			sis_rxeof(sc);
 
-		if (status & (SIS_ISR_RX_ERR | SIS_ISR_RX_OFLOW))
-			sis_rxeoc(sc);
+		if (status & (SIS_ISR_RX_ERR | SIS_ISR_RX_OFLOW)) {
+			if (status & SIS_ISR_RX_EARLY) 
+			    sis_rxeof(sc); 
+			else sis_rxeoc(sc); }
 
 		if (status & (SIS_ISR_RX_IDLE))
 			SIS_SETBIT(sc, SIS_CSR, SIS_CSR_RX_ENABLE);
--- if_sisreg.h.bak	2008-10-02 06:57:00.000000000 +0400
+++ if_sisreg.h	2009-02-03 17:24:00.000000000 +0300
@@ -245,11 +245,11 @@
 
 #define SIS_TXCFG_100	\
 	(SIS_TXDMA_64BYTES|SIS_TXCFG_AUTOPAD|\
-	 SIS_TXCFG_FILL(64)|SIS_TXCFG_DRAIN(1536))
+	 SIS_TXCFG_FILL(64)|SIS_TXCFG_DRAIN(1540))
 
 #define SIS_TXCFG_10	\
 	(SIS_TXDMA_32BYTES|SIS_TXCFG_AUTOPAD|\
-	 SIS_TXCFG_FILL(64)|SIS_TXCFG_DRAIN(1536))
+	 SIS_TXCFG_FILL(64)|SIS_TXCFG_DRAIN(1540))
 
 #define SIS_RXCFG_DRAIN_THRESH	0x0000003E /* 8-byte units */
 #define SIS_TXCFG_MPII03D	0x00040000 /* "Must be 1" */ 
@@ -347,6 +347,10 @@
 #define SIS_RXSTAT_DSTCLASS	0x01800000
 #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
@@ -465,7 +469,7 @@
 
 #define SIS_TIMEOUT		1000
 #define ETHER_ALIGN		2
-#define SIS_RXLEN		1536
+#define SIS_RXLEN		1540
 #define SIS_MIN_FRAMELEN	60
 
 /*


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-net 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Feb 5 22:55:01 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131414 
State-Changed-From-To: open->feedback 
State-Changed-By: yongari 
State-Changed-When: Fri Feb 6 00:39:51 UTC 2009 
State-Changed-Why:  
I believe CURRENT already have fix for the issue. 
Would you try try r185784? Since sis(4) moved to dev directory 
in HEAD you should use 
http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/dev/sis 
to check changes. 


Responsible-Changed-From-To: freebsd-net->yongari 
Responsible-Changed-By: yongari 
Responsible-Changed-When: Fri Feb 6 00:39:51 UTC 2009 
Responsible-Changed-Why:  
Grab. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131414 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/131414: commit references a PR
Date: Fri, 13 Feb 2009 02:08:34 +0000 (UTC)

 Author: yongari
 Date: Fri Feb 13 02:08:20 2009
 New Revision: 188550
 URL: http://svn.freebsd.org/changeset/base/188550
 
 Log:
   Receving VLAN oversized frames raise SIS_ISR_RX_ERR interrupt, so
   make sis_rxeof() handle that too. Previously it used to receive the
   frame and reset controller.
   
   PR:	kern/131414
 
 Modified:
   head/sys/dev/sis/if_sis.c
 
 Modified: head/sys/dev/sis/if_sis.c
 ==============================================================================
 --- head/sys/dev/sis/if_sis.c	Fri Feb 13 01:50:04 2009	(r188549)
 +++ head/sys/dev/sis/if_sis.c	Fri Feb 13 02:08:20 2009	(r188550)
 @@ -1663,10 +1663,11 @@ sis_intr(void *arg)
  		     SIS_ISR_TX_OK | SIS_ISR_TX_IDLE) )
  			sis_txeof(sc);
  
 -		if (status & (SIS_ISR_RX_DESC_OK|SIS_ISR_RX_OK|SIS_ISR_RX_IDLE))
 +		if (status & (SIS_ISR_RX_DESC_OK | SIS_ISR_RX_OK |
 +		    SIS_ISR_RX_ERR | SIS_ISR_RX_IDLE))
  			sis_rxeof(sc);
  
 -		if (status & (SIS_ISR_RX_ERR | SIS_ISR_RX_OFLOW))
 +		if (status & SIS_ISR_RX_OFLOW)
  			sis_rxeoc(sc);
  
  		if (status & (SIS_ISR_RX_IDLE))
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: feedback->patched 
State-Changed-By: yongari 
State-Changed-When: Fri Feb 13 02:19:34 UTC 2009 
State-Changed-Why:  
Feedback received. Slightly modified patch committed to HEAD. 
Thanks for testing/reporting! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131414 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/131414: commit references a PR
Date: Thu, 19 Mar 2009 00:55:39 +0000 (UTC)

 Author: yongari
 Date: Thu Mar 19 00:55:27 2009
 New Revision: 190009
 URL: http://svn.freebsd.org/changeset/base/190009
 
 Log:
   MFC r188550:
     Receving VLAN oversized frames raise SIS_ISR_RX_ERR interrupt, so
     make sis_rxeof() handle that too. Previously it used to receive the
     frame and reset controller.
   
     PR:	kern/131414
 
 Modified:
   stable/7/sys/   (props changed)
   stable/7/sys/contrib/pf/   (props changed)
   stable/7/sys/dev/ath/ath_hal/   (props changed)
   stable/7/sys/dev/cxgb/   (props changed)
   stable/7/sys/dev/sis/if_sis.c
 
 Modified: stable/7/sys/dev/sis/if_sis.c
 ==============================================================================
 --- stable/7/sys/dev/sis/if_sis.c	Thu Mar 19 00:52:30 2009	(r190008)
 +++ stable/7/sys/dev/sis/if_sis.c	Thu Mar 19 00:55:27 2009	(r190009)
 @@ -1662,10 +1662,11 @@ sis_intr(void *arg)
  		     SIS_ISR_TX_OK | SIS_ISR_TX_IDLE) )
  			sis_txeof(sc);
  
 -		if (status & (SIS_ISR_RX_DESC_OK|SIS_ISR_RX_OK|SIS_ISR_RX_IDLE))
 +		if (status & (SIS_ISR_RX_DESC_OK | SIS_ISR_RX_OK |
 +		    SIS_ISR_RX_ERR | SIS_ISR_RX_IDLE))
  			sis_rxeof(sc);
  
 -		if (status & (SIS_ISR_RX_ERR | SIS_ISR_RX_OFLOW))
 +		if (status & SIS_ISR_RX_OFLOW)
  			sis_rxeoc(sc);
  
  		if (status & (SIS_ISR_RX_IDLE))
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: yongari 
State-Changed-When: Thu Mar 19 01:18:19 UTC 2009 
State-Changed-Why:  
MFC done. Thanks a lot! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=131414 
>Unformatted:
