]> Pileus Git - ~andy/linux/blobdiff - drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
i40e: Retain MAC filters on port VLAN deletion
[~andy/linux] / drivers / net / ethernet / intel / i40e / i40e_virtchnl_pf.c
index 869b4fb991fc8d63cce858bfde53cf61749fed8d..44bb3597d73652ac06facecabf1c768b72ed5f89 100644 (file)
@@ -2081,6 +2081,15 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
                        "VF %d has already configured VLAN filters and the administrator is requesting a port VLAN override.\nPlease unload and reload the VF driver for this change to take effect.\n",
                        vf_id);
 
+       /* Check for condition where there was already a port VLAN ID
+        * filter set and now it is being deleted by setting it to zero.
+        * Before deleting all the old VLAN filters we must add new ones
+        * with -1 (I40E_VLAN_ANY) or otherwise we're left with all our
+        * MAC addresses deleted.
+        */
+       if (!(vlan_id || qos) && vsi->info.pvid)
+               ret = i40e_vsi_add_vlan(vsi, I40E_VLAN_ANY);
+
        if (vsi->info.pvid) {
                /* kill old VLAN */
                ret = i40e_vsi_kill_vlan(vsi, (le16_to_cpu(vsi->info.pvid) &
@@ -2109,6 +2118,10 @@ int i40e_ndo_set_vf_port_vlan(struct net_device *netdev,
                                 vsi->back->hw.aq.asq_last_status);
                        goto error_pvid;
                }
+               /* Kill non-vlan MAC filters - ignore error return since
+                * there might not be any non-vlan MAC filters.
+                */
+               i40e_vsi_kill_vlan(vsi, I40E_VLAN_ANY);
        }
 
        if (ret) {