ixgbe: fix vf irq storm when running on Xen Dom0.
[dpdk.git] / lib / librte_pmd_ixgbe / ixgbe_ethdev.c
index a95bc28..d413792 100644 (file)
@@ -772,6 +772,21 @@ eth_ixgbe_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
        return 0;
 }
 
+static void ixgbevf_get_queue_num(struct ixgbe_hw *hw)
+{
+       /* Traffic classes are not supported by now */
+       unsigned int tcs, tc;
+
+       /*
+        * Must let PF know we are at mailbox API version 1.1.
+        * Otherwise PF won't answer properly.
+        * In case that PF fails to provide Rx/Tx queue number,
+        * max_tx_queues and max_rx_queues remain to be 1.
+        */
+       if (!ixgbevf_negotiate_api_version(hw, ixgbe_mbox_api_11))
+               ixgbevf_get_queues(hw, &tcs, &tc);
+}
+
 /*
  * Virtual Function device init
  */
@@ -840,6 +855,9 @@ eth_ixgbevf_dev_init(__attribute__((unused)) struct eth_driver *eth_drv,
                return (diag);
        }
 
+       /* Get Rx/Tx queue count via mailbox, which is ready after reset_hw */
+       ixgbevf_get_queue_num(hw);
+
        /* Allocate memory for storing MAC addresses */
        eth_dev->data->mac_addrs = rte_zmalloc("ixgbevf", ETHER_ADDR_LEN *
                        hw->mac.num_rar_entries, 0);
@@ -1376,6 +1394,9 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
        struct rte_eth_link link;
        struct ixgbe_hw *hw =
                IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       struct ixgbe_vf_info *vfinfo = 
+               *IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private);
+       int vf;
 
        PMD_INIT_FUNC_TRACE();
 
@@ -1389,6 +1410,10 @@ ixgbe_dev_stop(struct rte_eth_dev *dev)
        /* stop adapter */
        ixgbe_stop_adapter(hw);
 
+       for (vf = 0; vfinfo != NULL && 
+                    vf < dev->pci_dev->max_vfs; vf++)
+               vfinfo[vf].clear_to_send = false;
+
        /* Turn off the laser */
        ixgbe_disable_tx_laser(hw);