net/ixgbe: ping VF when PF status changes
authorAlex Zelezniak <alexz@att.com>
Thu, 30 Mar 2017 21:05:54 +0000 (16:05 -0500)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 17:02:59 +0000 (19:02 +0200)
Signed-off-by: Alex Zelezniak <alexz@att.com>
Acked-by: Wei Dai <wei.dai@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
drivers/net/ixgbe/ixgbe_ethdev.c
drivers/net/ixgbe/rte_pmd_ixgbe.h
drivers/net/ixgbe/rte_pmd_ixgbe_version.map

index 4fd22c5..0c4d308 100644 (file)
@@ -4893,6 +4893,37 @@ ixgbe_convert_vm_rx_mask_to_val(uint16_t rx_mask, uint32_t orig_val)
        return new_val;
 }
 
+int
+rte_pmd_ixgbe_ping_vf(uint8_t port, uint16_t vf)
+{
+       struct ixgbe_hw *hw;
+       struct ixgbe_vf_info *vfinfo;
+       struct rte_eth_dev *dev;
+       struct rte_pci_device *pci_dev;
+       uint32_t ctrl;
+
+       RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+       dev = &rte_eth_devices[port];
+       pci_dev = IXGBE_DEV_TO_PCI(dev);
+
+       if (!is_device_supported(dev, &rte_ixgbe_pmd))
+               return -ENOTSUP;
+
+       if (vf >= pci_dev->max_vfs)
+               return -EINVAL;
+
+       hw = IXGBE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+       vfinfo = *(IXGBE_DEV_PRIVATE_TO_P_VFDATA(dev->data->dev_private));
+
+       ctrl = IXGBE_PF_CONTROL_MSG;
+       if (vfinfo[vf].clear_to_send)
+               ctrl |= IXGBE_VT_MSGTYPE_CTS;
+
+       ixgbe_write_mbx(hw, &ctrl, 1, vf);
+
+       return 0;
+}
 
 int
 rte_pmd_ixgbe_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)
index 4d7b507..cdb747e 100644 (file)
 
 #include <rte_ethdev.h>
 
+/**
+ * Notify VF when PF link status changes.
+ *
+ * @param port
+ *   The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if *vf* invalid.
+ */
+int rte_pmd_ixgbe_ping_vf(uint8_t port, uint16_t vf);
+
 /**
  * Set the VF MAC address.
  *
index a992dfd..2c7512d 100644 (file)
@@ -31,3 +31,9 @@ DPDK_17.02 {
        rte_pmd_ixgbe_set_vf_tx;
        rte_pmd_ixgbe_set_vf_vlan_filter;
 } DPDK_16.11;
+
+DPDK_17.05 {
+       global:
+
+       rte_pmd_ixgbe_ping_vf;
+} DPDK_17.02;