net/i40e: support getting all loaded DDP profiles
authorBeilei Xing <beilei.xing@intel.com>
Thu, 30 Mar 2017 02:51:49 +0000 (10:51 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 4 Apr 2017 17:02:56 +0000 (19:02 +0200)
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/rte_pmd_i40e.h
drivers/net/i40e/rte_pmd_i40e_version.map

index ab7343f..359d121 100644 (file)
@@ -11867,6 +11867,9 @@ rte_pmd_i40e_set_tc_strict_prio(uint8_t port, uint8_t tc_map)
        return ret;
 }
 
+#define I40E_PROFILE_INFO_SIZE 48
+#define I40E_MAX_PROFILE_NUM 16
+
 static void
 i40e_generate_profile_info_sec(char *name, struct i40e_ddp_version *version,
                               uint32_t track_id, uint8_t *profile_info_sec,
@@ -12073,3 +12076,28 @@ rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,
        rte_free(profile_info_sec);
        return status;
 }
+
+int
+rte_pmd_i40e_get_ddp_list(uint8_t port, uint8_t *buff, uint32_t size)
+{
+       struct rte_eth_dev *dev;
+       struct i40e_hw *hw;
+       enum i40e_status_code status = I40E_SUCCESS;
+
+       RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV);
+
+       dev = &rte_eth_devices[port];
+
+       if (!is_device_supported(dev, &rte_i40e_pmd))
+               return -ENOTSUP;
+
+       if (size < (I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM + 4))
+               return -EINVAL;
+
+       hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+       status = i40e_aq_get_ddp_list(hw, (void *)buff,
+                                     size, 0, NULL);
+
+       return status;
+}
index 51c7bde..8e15630 100644 (file)
@@ -480,4 +480,19 @@ int rte_pmd_i40e_process_ddp_package(uint8_t port, uint8_t *buff,
                                     uint32_t size,
                                     enum rte_pmd_i40e_package_op op);
 
+/**
+ * rte_pmd_i40e_get_ddp_list - Get loaded profile list
+ * @param port
+ *    port id
+ * @param buff
+ *    buffer for response
+ * @param size
+ *    buffer size
+ * @return
+ *   - (0) if successful.
+ *   - (-ENODEV) if *port* invalid.
+ *   - (-EINVAL) if bad parameter.
+ */
+int rte_pmd_i40e_get_ddp_list(uint8_t port, uint8_t *buff, uint32_t size);
+
 #endif /* _PMD_I40E_H_ */
index 6d001a3..dbb994e 100644 (file)
@@ -31,5 +31,6 @@ DPDK_17.05 {
        rte_pmd_i40e_set_vf_tc_bw_alloc;
        rte_pmd_i40e_set_vf_tc_max_bw;
        rte_pmd_i40e_process_ddp_package;
+       rte_pmd_i40e_get_ddp_list;
 
 } DPDK_17.02;