These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / net / ethernet / intel / fm10k / fm10k_iov.c
index 5b08e62..acfb8b1 100644 (file)
@@ -137,8 +137,11 @@ process_mbx:
                }
 
                /* guarantee we have free space in the SM mailbox */
-               if (!hw->mbx.ops.tx_ready(&hw->mbx, FM10K_VFMBX_MSG_MTU))
+               if (!hw->mbx.ops.tx_ready(&hw->mbx, FM10K_VFMBX_MSG_MTU)) {
+                       /* keep track of how many times this occurs */
+                       interface->hw_sm_mbx_full++;
                        break;
+               }
 
                /* cleanup mailbox and process received messages */
                mbx->ops.process(hw, mbx);
@@ -228,9 +231,6 @@ int fm10k_iov_resume(struct pci_dev *pdev)
                hw->iov.ops.set_lport(hw, vf_info, i,
                                      FM10K_VF_FLAG_MULTI_CAPABLE);
 
-               /* assign our default vid to the VF following reset */
-               vf_info->sw_vid = hw->mac.default_vid;
-
                /* mailbox is disconnected so we don't send a message */
                hw->iov.ops.assign_default_mac_vlan(hw, vf_info);
 
@@ -400,11 +400,31 @@ int fm10k_iov_configure(struct pci_dev *pdev, int num_vfs)
        return num_vfs;
 }
 
+static inline void fm10k_reset_vf_info(struct fm10k_intfc *interface,
+                                      struct fm10k_vf_info *vf_info)
+{
+       struct fm10k_hw *hw = &interface->hw;
+
+       /* assigning the MAC address will send a mailbox message */
+       fm10k_mbx_lock(interface);
+
+       /* disable LPORT for this VF which clears switch rules */
+       hw->iov.ops.reset_lport(hw, vf_info);
+
+       /* assign new MAC+VLAN for this VF */
+       hw->iov.ops.assign_default_mac_vlan(hw, vf_info);
+
+       /* re-enable the LPORT for this VF */
+       hw->iov.ops.set_lport(hw, vf_info, vf_info->vf_idx,
+                             FM10K_VF_FLAG_MULTI_CAPABLE);
+
+       fm10k_mbx_unlock(interface);
+}
+
 int fm10k_ndo_set_vf_mac(struct net_device *netdev, int vf_idx, u8 *mac)
 {
        struct fm10k_intfc *interface = netdev_priv(netdev);
        struct fm10k_iov_data *iov_data = interface->iov_data;
-       struct fm10k_hw *hw = &interface->hw;
        struct fm10k_vf_info *vf_info;
 
        /* verify SR-IOV is active and that vf idx is valid */
@@ -419,13 +439,7 @@ int fm10k_ndo_set_vf_mac(struct net_device *netdev, int vf_idx, u8 *mac)
        vf_info = &iov_data->vf_info[vf_idx];
        ether_addr_copy(vf_info->mac, mac);
 
-       /* assigning the MAC will send a mailbox message so lock is needed */
-       fm10k_mbx_lock(interface);
-
-       /* assign MAC address to VF */
-       hw->iov.ops.assign_default_mac_vlan(hw, vf_info);
-
-       fm10k_mbx_unlock(interface);
+       fm10k_reset_vf_info(interface, vf_info);
 
        return 0;
 }
@@ -455,16 +469,10 @@ int fm10k_ndo_set_vf_vlan(struct net_device *netdev, int vf_idx, u16 vid,
        /* record default VLAN ID for VF */
        vf_info->pf_vid = vid;
 
-       /* assigning the VLAN will send a mailbox message so lock is needed */
-       fm10k_mbx_lock(interface);
-
        /* Clear the VLAN table for the VF */
        hw->mac.ops.update_vlan(hw, FM10K_VLAN_ALL, vf_info->vsi, false);
 
-       /* Update VF assignment and trigger reset */
-       hw->iov.ops.assign_default_mac_vlan(hw, vf_info);
-
-       fm10k_mbx_unlock(interface);
+       fm10k_reset_vf_info(interface, vf_info);
 
        return 0;
 }