net/bnxt: determine the Rx status of VF
authorAjit Khaparde <ajit.khaparde@broadcom.com>
Thu, 1 Jun 2017 17:07:19 +0000 (12:07 -0500)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 12 Jun 2017 09:41:28 +0000 (10:41 +0100)
This patch adds code to determine the Rx status of a VF.
It adds the rte_pmd_bnxt_get_vf_rx_status call, which calculates
the VNIC count of the function to get the Rx status.

Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
drivers/net/bnxt/bnxt_hwrm.c
drivers/net/bnxt/bnxt_hwrm.h
drivers/net/bnxt/rte_pmd_bnxt.c
drivers/net/bnxt/rte_pmd_bnxt.h
drivers/net/bnxt/rte_pmd_bnxt_version.map

index 6ea31ca..721e652 100644 (file)
@@ -2626,6 +2626,30 @@ int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on)
        return rc;
 }
 
+static void bnxt_vnic_count(struct bnxt_vnic_info *vnic, void *cbdata)
+{
+       uint32_t *count = cbdata;
+
+       if (vnic->func_default)
+               *count = *count + 1;
+}
+
+static int bnxt_vnic_count_hwrm_stub(struct bnxt *bp __rte_unused,
+                                    struct bnxt_vnic_info *vnic __rte_unused)
+{
+       return 0;
+}
+
+int bnxt_vf_default_vnic_count(struct bnxt *bp, uint16_t vf)
+{
+       uint32_t count = 0;
+
+       bnxt_hwrm_func_vf_vnic_query_and_config(bp, vf, bnxt_vnic_count,
+           &count, bnxt_vnic_count_hwrm_stub);
+
+       return count;
+}
+
 static int bnxt_hwrm_func_vf_vnic_query(struct bnxt *bp, uint16_t vf,
                                        uint16_t *vnic_ids)
 {
index 5aaf947..01e72fa 100644 (file)
@@ -141,6 +141,7 @@ int bnxt_hwrm_port_clr_stats(struct bnxt *bp);
 int bnxt_hwrm_port_led_cfg(struct bnxt *bp, bool led_on);
 int bnxt_hwrm_port_led_qcaps(struct bnxt *bp);
 int bnxt_hwrm_func_cfg_vf_set_flags(struct bnxt *bp, uint16_t vf);
+int bnxt_vf_default_vnic_count(struct bnxt *bp, uint16_t vf);
 int bnxt_hwrm_func_vf_vnic_query_and_config(struct bnxt *bp, uint16_t vf,
        void (*vnic_cb)(struct bnxt_vnic_info *, void *), void *cbdata,
        int (*hwrm_cb)(struct bnxt *bp, struct bnxt_vnic_info *vnic));
index 1bbe040..39428a8 100644 (file)
@@ -515,6 +515,32 @@ int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
        return bnxt_hwrm_func_clr_stats(bp, bp->pf.first_vf_id + vf_id);
 }
 
+int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id)
+{
+       struct rte_eth_dev *dev;
+       struct rte_eth_dev_info dev_info;
+       struct bnxt *bp;
+
+       dev = &rte_eth_devices[port];
+       if (!is_bnxt_supported(dev))
+               return -ENOTSUP;
+
+       rte_eth_dev_info_get(port, &dev_info);
+       bp = (struct bnxt *)dev->data->dev_private;
+
+       if (vf_id >= dev_info.max_vfs)
+               return -EINVAL;
+
+       if (!BNXT_PF(bp)) {
+               RTE_LOG(ERR, PMD,
+                       "Attempt to query VF %d RX stats on non-PF port %d!\n",
+                       vf_id, port);
+               return -ENOTSUP;
+       }
+
+       return bnxt_vf_default_vnic_count(bp, vf_id);
+}
+
 int rte_pmd_bnxt_get_vf_tx_drop_count(uint8_t port, uint16_t vf_id,
                                      uint64_t *count)
 {
index 7bfd376..0987c0f 100644 (file)
@@ -217,6 +217,23 @@ int rte_pmd_bnxt_reset_vf_stats(uint8_t port,
  */
 int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on);
 
+
+/**
+ * Returns the number of default RX queues on a VF
+ *
+ * @param port
+ *    The port identifier of the Ethernet device.
+ * @param vf
+ *   VF id.
+ * @return
+ *   - Non-negative value - Number of default RX queues
+ *   - (-EINVAL) if bad parameter.
+ *   - (-ENOTSUP) if on a function without VFs
+ *   - (-ENOMEM) on an allocation failure
+ *   - (-1) firmware interface error
+ */
+int rte_pmd_bnxt_get_vf_rx_status(uint8_t port, uint16_t vf_id);
+
 /**
  * Queries the TX drop counter for the function
  *
index d26d5fc..c9e53f5 100644 (file)
@@ -1,6 +1,7 @@
 DPDK_17.08 {
        global:
 
+       rte_pmd_bnxt_get_vf_rx_status;
        rte_pmd_bnxt_get_vf_stats;
        rte_pmd_bnxt_get_vf_tx_drop_count;
        rte_pmd_bnxt_reset_vf_stats;