From owner-freebsd-net@FreeBSD.ORG Sat Dec 6 02:22:13 2008 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 457791065670 for ; Sat, 6 Dec 2008 02:22:13 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: from rv-out-0506.google.com (rv-out-0506.google.com [209.85.198.225]) by mx1.freebsd.org (Postfix) with ESMTP id 0C32A8FC1A for ; Sat, 6 Dec 2008 02:22:12 +0000 (UTC) (envelope-from pyunyh@gmail.com) Received: by rv-out-0506.google.com with SMTP id b25so264314rvf.43 for ; Fri, 05 Dec 2008 18:22:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:received:received:date:from :to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=4kGByYz+XLQf/K+xfikfHCBI+3b0p01oUnm5BqQ0Ekw=; b=L3fqW60MJ4SjO4+6WM8gvhUoXwQx//x6/hK9Y8/FCCqavXxDEReSVpYamZ+DsGKd9U pkQV0sQWHc7Dsbw6VAPQtSQXBlSzubrlQh2pEWR1h1M8aBoAyJTXZzCZYkkcaJKbQpKt O3R2hK8hh92NDqVGTmMMwqHbjKxsPdSO3jQDY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:reply-to:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=qfLeHG1lynA/lKG8t6pYMuat1Er7+eNa4JQuWRabYNcldCv0wyu8Rq2wnyIEe77fTZ VKaztWJJEoVNePnjAqgaemF1Ye1EZkA3vXV9Ued3UqDzxG0cFaoq17IcWw/TLR6z6XK3 cTTUd2+hdD6FEumbxGRqqu5FOfaAxAeD5DOw8= Received: by 10.141.197.14 with SMTP id z14mr310195rvp.203.1228530132496; Fri, 05 Dec 2008 18:22:12 -0800 (PST) Received: from michelle.cdnetworks.co.kr ([211.53.35.84]) by mx.google.com with ESMTPS id k37sm586048rvb.1.2008.12.05.18.22.09 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 05 Dec 2008 18:22:11 -0800 (PST) Received: from michelle.cdnetworks.co.kr (localhost.cdnetworks.co.kr [127.0.0.1]) by michelle.cdnetworks.co.kr (8.13.5/8.13.5) with ESMTP id mB62M5gb022619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 6 Dec 2008 11:22:05 +0900 (KST) (envelope-from pyunyh@gmail.com) Received: (from yongari@localhost) by michelle.cdnetworks.co.kr (8.13.5/8.13.5/Submit) id mB62M5Ig022618; Sat, 6 Dec 2008 11:22:05 +0900 (KST) (envelope-from pyunyh@gmail.com) Date: Sat, 6 Dec 2008 11:22:05 +0900 From: Pyun YongHyeon To: Vladimir Ermakov Message-ID: <20081206022205.GD22093@cdnetworks.co.kr> References: <49392FDD.8050209@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="1LKvkjL3sHcu1TtY" Content-Disposition: inline In-Reply-To: <49392FDD.8050209@gmail.com> User-Agent: Mutt/1.4.2.1i Cc: freebsd-net@freebsd.org Subject: Re: vlan support trouble in if_sis driver ? X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: pyunyh@gmail.com List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Dec 2008 02:22:13 -0000 --1LKvkjL3sHcu1TtY Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Dec 05, 2008 at 04:42:53PM +0300, Vladimir Ermakov wrote: > Hello > > Using sis card (SiS 900) > sis0: 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@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 00:0d:61:xx:xx:xx 356 4 > 40934 155 0 29276 0 > em0 1500 00:02:55:xx:xx:xx 0 0 > 0 0 0 0 0 > lo0 16384 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 00:02:55:xx:xx:xx 0 0 > 0 0 0 0 0 > vlan1 1500 00:0d:61:xx:xx:xx 255 0 > 29543 155 0 28656 0 > > # ifconfig sis0 > sis0: flags=8843 metric 0 mtu 1500 > options=8 > ether 00:0d:61:xx:xx:xx > media: Ethernet autoselect (100baseTX ) > status: active > # ifconfig vlan1 > vlan1: flags=8843 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 ) > 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 --1LKvkjL3sHcu1TtY Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="sis.vlan.patch" 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++; --1LKvkjL3sHcu1TtY--