netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net 2/2] ixgbe: Fix a bug in setting VF VLAN via PF
@ 2013-04-18  6:41 Jeff Kirsher
  2013-04-18 18:52 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Jeff Kirsher @ 2013-04-18  6:41 UTC (permalink / raw)
  To: davem; +Cc: Greg Rose, netdev, gospo, sassmann, Jeff Kirsher

From: Greg Rose <gregory.v.rose@intel.com>

The PF driver does not check if the administrator has already set a VF
VLAN via the PF driver before setting the new VLAN.  This results in
the following scenario:

A) Administrator sets VF <n> to VLAN 100
B) Administrator sets VF <x> to VLAN 100
C) Administrator sets VF <n> to VLAN 200
D) The VF <n> driver continues to be able to receive traffic on VLAN
   100 because the VLVFB pool enable bit for that VF was left set
   instead of being cleared as it should be.

This fix ensures that the old VLAN filter for VF <n> is first removed
and the pool bit enable for VF <n> is cleared so that it no longer
receives traffic on VLAN 100.

Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
Tested-by: Sibai Li <sibai.li@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index d44b4d2..97e3366 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -1049,6 +1049,12 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
 	if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7))
 		return -EINVAL;
 	if (vlan || qos) {
+		if (adapter->vfinfo[vf].pf_vlan)
+			err = ixgbe_set_vf_vlan(adapter, false,
+						adapter->vfinfo[vf].pf_vlan,
+						vf);
+		if (err)
+			goto out;
 		err = ixgbe_set_vf_vlan(adapter, true, vlan, vf);
 		if (err)
 			goto out;
-- 
1.7.11.7

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [net 2/2] ixgbe: Fix a bug in setting VF VLAN via PF
  2013-04-18  6:41 [net 2/2] ixgbe: Fix a bug in setting VF VLAN via PF Jeff Kirsher
@ 2013-04-18 18:52 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2013-04-18 18:52 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: gregory.v.rose, netdev, gospo, sassmann

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 17 Apr 2013 23:41:35 -0700

> From: Greg Rose <gregory.v.rose@intel.com>
> 
> The PF driver does not check if the administrator has already set a VF
> VLAN via the PF driver before setting the new VLAN.  This results in
> the following scenario:
> 
> A) Administrator sets VF <n> to VLAN 100
> B) Administrator sets VF <x> to VLAN 100
> C) Administrator sets VF <n> to VLAN 200
> D) The VF <n> driver continues to be able to receive traffic on VLAN
>    100 because the VLVFB pool enable bit for that VF was left set
>    instead of being cleared as it should be.
> 
> This fix ensures that the old VLAN filter for VF <n> is first removed
> and the pool bit enable for VF <n> is cleared so that it no longer
> receives traffic on VLAN 100.
> 
> Signed-off-by: Greg Rose <gregory.v.rose@intel.com>
> Tested-by: Sibai Li <sibai.li@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-18 18:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-18  6:41 [net 2/2] ixgbe: Fix a bug in setting VF VLAN via PF Jeff Kirsher
2013-04-18 18:52 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).