From 6765eda2fce82a1f8b8e42f15ec76682d499b9a4 Mon Sep 17 00:00:00 2001 From: Beilei Xing Date: Thu, 30 Mar 2017 10:51:49 +0800 Subject: [PATCH] net/i40e: support getting all loaded DDP profiles Signed-off-by: Beilei Xing Acked-by: Jingjing Wu --- drivers/net/i40e/i40e_ethdev.c | 28 +++++++++++++++++++++++ drivers/net/i40e/rte_pmd_i40e.h | 15 ++++++++++++ drivers/net/i40e/rte_pmd_i40e_version.map | 1 + 3 files changed, 44 insertions(+) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index ab7343f11a..359d121c22 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -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; +} diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h index 51c7bde831..8e15630834 100644 --- a/drivers/net/i40e/rte_pmd_i40e.h +++ b/drivers/net/i40e/rte_pmd_i40e.h @@ -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_ */ diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map b/drivers/net/i40e/rte_pmd_i40e_version.map index 6d001a3614..dbb994ed23 100644 --- a/drivers/net/i40e/rte_pmd_i40e_version.map +++ b/drivers/net/i40e/rte_pmd_i40e_version.map @@ -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; -- 2.20.1