vlan support trouble in if_sis driver ?

Pyun YongHyeon pyunyh at gmail.com
Fri Dec 5 18:22:13 PST 2008


On Fri, Dec 05, 2008 at 04:42:53PM +0300, Vladimir Ermakov wrote:
 > Hello
 > 
 > Using sis  card  (SiS 900)
 > sis0: <SiS 900 10/100BaseTX> port 0xe800-0xe8ff mem 
 > 0xed160000-0xed160fff irq 19 at device 4.0 on pci0
 > 
 > # uname -a
 > FreeBSD damask 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24 19:59:52 
 > UTC 2008     root at logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
 > 
 > # netstat -bin
 > Name    Mtu Network       Address              Ipkts Ierrs     Ibytes    
 > Opkts Oerrs     Obytes  Coll
 > sis0   1500 <Link#1>      00:0d:61:xx:xx:xx      356     4      
 > 40934      155     0      29276     0
 > em0    1500 <Link#2>      00:02:55:xx:xx:xx        0     0          
 > 0        0     0          0     0
 > lo0   16384 <Link#3>                               0     0          
 > 0        0     0          0     0
 > lo0   16384 fe80:3::1/64  fe80:3::1                0     -          
 > 0        0     -          0     -
 > lo0   16384 ::1/128       ::1                      0     -          
 > 0        0     -          0     -
 > lo0   16384 127.0.0.0/8   127.0.0.1                0     -          
 > 0        0     -          0     -
 > vlan0  1500 <Link#4>      00:02:55:xx:xx:xx        0     0          
 > 0        0     0          0     0
 > vlan1  1500 <Link#5>      00:0d:61:xx:xx:xx      255     0      
 > 29543      155     0      28656     0
 > 
 > # ifconfig sis0
 > sis0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
 >        options=8<VLAN_MTU>
 >        ether 00:0d:61:xx:xx:xx
 >        media: Ethernet autoselect (100baseTX <full-duplex>)
 >        status: active
 > # ifconfig vlan1
 > vlan1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
 >        ether 00:0d:61:xx:xx:xx
 >        inet 192.168.1.221 netmask 0xffffff80 broadcast 192.168.1.255
 >        media: Ethernet autoselect (100baseTX <full-duplex>)
 >        status: active
 >        vlan: 12 parent interface: sis0
 > 
 > noticed the following troubles with using interface vlan1 (vlandev sis0):
 > - can not download a file using fget tool
 > - increases Ierrs on the physical interface sis0
 > 
 > this bug in if_sis driver ?

I don't have sis(4) hardwares so I'm not sure it's bug. Since you
see Ierrs on parent interface sis0, I guess the hardware might set
a giant bit when it receives VLAN frames. Driver might think it
received errored frames which in turn make driver drop these VLAN
frames.

Would you try attached patch?(Just compile tested).
-- 
Regards,
Pyun YongHyeon
-------------- next part --------------
Index: sys/dev/sis/if_sisreg.h
===================================================================
--- sys/dev/sis/if_sisreg.h	(revision 185658)
+++ sys/dev/sis/if_sisreg.h	(working copy)
@@ -348,6 +348,11 @@
 #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
Index: sys/dev/sis/if_sis.c
===================================================================
--- sys/dev/sis/if_sis.c	(revision 185658)
+++ sys/dev/sis/if_sis.c	(working copy)
@@ -1432,7 +1432,11 @@
 		 * 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++;


More information about the freebsd-net mailing list