Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 19 Mar 2010 10:44:50 -0700
From:      Pyun YongHyeon <pyunyh@gmail.com>
To:        "Prokofyev S.P." <proks@skylinetele.com>
Cc:        jfv@FreeBSD.org, freebsd-net@freebsd.org
Subject:   Re: Please pay attention to fix bug kern/141285
Message-ID:  <20100319174450.GP9373@michelle.cdnetworks.com>
In-Reply-To: <4BA38CEC.9060205@skylinetele.com>
References:  <4BA38CEC.9060205@skylinetele.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--0F1p//8PRICkK4MW
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Fri, Mar 19, 2010 at 04:40:44PM +0200, Prokofyev S.P. wrote:
> Hi ALL !
> 
> Please pay attention to fix bug kern/141285(kern/141843) !
> 

igb(4) also has a similar issue but it seems igb(4) does not even
advertise IFCAP_VLAN_HWFILTER capability. igb(4) may have to remove
VLAN event handler or should implement IFCAP_VLAN_HWFILTER to
support VLAN hardware filtering.

I have a patch for the hardware VLAN filtering of em(4). But it
wouldn't address the issue reported in the PR. The root cause of
issue was em(4) wants to reset controller whenever new VLAN is
registered/unregistered. I'm not sure this is requirement of
hardware. If this is requirement of hardware there is no way to
avoid the controller reset unless you disable vlanhwfilter feature.

#ifconfig em0 -vlanhwfilter

em(4) in HEAD disabled VLAN hardware filtering by default so if you
use that version you wouldn't encounter the issue again. Attached
patch is small diff for VLAN hardware filtering which tries to
avoid unnecessary controller reset and added missing lock. If
hardware allows dynamic changing of VLAN filtering table we could
completely bypass the controller reset. Jack may know the details.

--0F1p//8PRICkK4MW
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="em.vlan_hwfilter.patch"

Index: sys/dev/e1000/if_em.c
===================================================================
--- sys/dev/e1000/if_em.c	(revision 205300)
+++ sys/dev/e1000/if_em.c	(working copy)
@@ -4652,10 +4652,15 @@
 
 	index = (vtag >> 5) & 0x7F;
 	bit = vtag & 0x1F;
+	EM_CORE_LOCK(adapter);
 	em_shadow_vfta[index] |= (1 << bit);
 	++adapter->num_vlans;
 	/* Re-init to load the changes */
-	em_init(adapter);
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 &&
+	    (ifp->if_capabilities & IFCAP_VLAN_HWFILTER) != 0 &&
+	    (ifp->if_capenable & IFCAP_VLAN_HWFILTER) != 0)
+		em_init_locked(adapter);
+	EM_CORE_UNLOCK(adapter);
 }
 
 /*
@@ -4677,9 +4682,14 @@
 	index = (vtag >> 5) & 0x7F;
 	bit = vtag & 0x1F;
 	em_shadow_vfta[index] &= ~(1 << bit);
+	EM_CORE_LOCK(adapter);
 	--adapter->num_vlans;
 	/* Re-init to load the changes */
-	em_init(adapter);
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 &&
+	    (ifp->if_capabilities & IFCAP_VLAN_HWFILTER) != 0 &&
+	    (ifp->if_capenable & IFCAP_VLAN_HWFILTER) != 0)
+		em_init_locked(adapter);
+	EM_CORE_UNLOCK(adapter);
 }
 
 static void

--0F1p//8PRICkK4MW--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20100319174450.GP9373>