From andrew@supernews.net  Sun Dec  1 20:27:53 2002
Return-Path: <andrew@supernews.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 6562037B401
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  1 Dec 2002 20:27:53 -0800 (PST)
Received: from trinity.supernews.net (trinity.ranger.supernews.net [216.168.1.22])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 1FAE443EBE
	for <FreeBSD-gnats-submit@freebsd.org>; Sun,  1 Dec 2002 20:27:53 -0800 (PST)
	(envelope-from andrew@supernews.net)
Received: from andrew by trinity.supernews.net with local (Exim 3.36 #1)
	id 18IiBV-000FEQ-00; Mon, 02 Dec 2002 04:27:53 +0000
Message-Id: <E18IiBV-000FEQ-00@trinity.supernews.net>
Date: Mon, 02 Dec 2002 04:27:53 +0000
From: "Andrew - Supernews" <andrew+fbsd@supernews.net>
Sender: Andrew <andrew@supernews.net>
Reply-To: andrew+fbsd@supernews.net
To: FreeBSD-gnats-submit@freebsd.org
Cc: andrew+fbsd@supernews.net
Subject: vlan support broken in 'em' driver (includes suggested fix)
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         45907
>Category:       kern
>Synopsis:       vlan support broken in 'em' driver (includes suggested fix)
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pdeuskar
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 01 20:30:01 PST 2002
>Closed-Date:    Mon Dec 23 11:15:18 PST 2002
>Last-Modified:  Wed Jan  8 11:30:02 PST 2003
>Originator:     "Andrew - Supernews" andrew+fbsd@supernews.net
>Release:        FreeBSD 4.7-STABLE i386
>Organization:
Supernews
>Environment:
System: FreeBSD 4.7-STABLE i386 as of 1 Dec 2002

Using two em cards (with multiple vlans on each):
em0: <Intel(R) PRO/1000 Network Connection, Version - 1.4.7> port 0x3000-0x303f 
mem 0xfc200000-0xfc21ffff irq 5 at device 2.0 on pci3
em0:  Speed:N/A  Duplex:N/A
em1: <Intel(R) PRO/1000 Network Connection, Version - 1.4.7> port 0x3040-0x307f 
mem 0xfc220000-0xfc23ffff irq 5 at device 2.1 on pci3
em1:  Speed:N/A  Duplex:N/A

>Description:

Vlan support fails to function correctly because the priority/QoS bits are
not masked off from the 802.1Q tag before using it as a pure vlan number.
Accordingly traffic with these bits set (in our case, OSPF HELLO packets from
a router) does not get matched up with the correct vlan device.

Other drivers (such as pci/if_ti.c) mask off the offending bits before
passing the packet to the vlan input code; the following suggested fix
does likewise for this driver.

>How-To-Repeat:

Attach a vlan interface to the em interface in the usual way. Supply
incoming traffic with the correct vlan number but non-zero priority.
Observe that the affected packets are visible to the em interface (via,
for example, tcpdump) but that they are discarded by the vlan code and not
passed to the relevent vlan interface (tcpdump on the vlan interface fails
to show the traffic).

>Fix:

By analogy to the ti driver, the following code in sys/dev/if_em.c:

				if (current_desc->status & E1000_RXD_STAT_VP)
					VLAN_INPUT_TAG(eh, adapter->fmp, 
						       current_desc->special);

(which is the only occurrence of VLAN_INPUT_TAG in the file)
should instead read

				if (current_desc->status & E1000_RXD_STAT_VP)
					VLAN_INPUT_TAG(eh, adapter->fmp, 
					        current_desc->special & 0xfff);

(note that we have been running this fix in production use for a couple of
weeks now at sustained high traffic levels.)
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->pdeuskar 
Responsible-Changed-By: dwmalone 
Responsible-Changed-When: Sat Dec 21 07:36:19 PST 2002 
Responsible-Changed-Why:  
Give this PR to Prafulla. It contains a sensible looking patch. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=45907 
State-Changed-From-To: open->closed 
State-Changed-By: pdeuskar 
State-Changed-When: Mon Dec 23 11:13:19 PST 2002 
State-Changed-Why:  
The bug has been fixed in 1.4.10 version of the driver. 

-Prafulla 

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

From: Dan Lukes <dan@obluda.cz>
To: freebsd-gnats-submit@FreeBSD.org, pdeuskar@FreeBSD.org,
	andrew+fbsd@supernews.net
Cc:  
Subject: Re: kern/45907: vlan support broken in 'em' driver (includes suggested
 fix)
Date: Wed, 08 Jan 2003 20:24:28 +0100

 	I miss this PR when when I submitted the PR 46405.
 
 	I'm disagree with you that the problem is within 'em' driver - it's 
 more general problem with if_vlan (or we must correct not only 'em' but 
 all drivers with vlan hardware support).
 
 	I suggest to revert the 45907 and apply 46405
 
 					Dan
 
 
 -- 
 Dan Lukes      tel: +420 2 21914205, fax: +420 2 21914206
 root  of FIONet,  KolejNET,  webmaster  of www.freebsd.cz
 AKA: dan@obluda.cz, dan@freebsd.cz, dan@kolej.mff.cuni.cz
 
>Unformatted:

Fixed in 1.4.10 version of the driver.

-Prafulla
