[dpdk-dev] [PATCH v2 4/5] net/i40e: add get all loaded profiles

Beilei Xing beilei.xing at intel.com
Fri Mar 3 08:39:43 CET 2017


This patch is to add get all loaded profiles function.

Signed-off-by: Beilei Xing <beilei.xing at intel.com>
---
 drivers/net/i40e/i40e_ethdev.c  | 36 ++++++++++++++++++++++++++++++++++++
 drivers/net/i40e/i40e_ethdev.h  |  5 +++++
 drivers/net/i40e/rte_pmd_i40e.h |  7 +++++++
 3 files changed, 48 insertions(+)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index dae4b97..5361311 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -11515,3 +11515,39 @@ i40e_process_package(uint8_t port, uint8_t *buff)
 
 	return status;
 }
+
+#define I40E_PROFILE_INFO_SIZE 48
+#define I40E_MAX_PROFILE_NUM 16
+int
+i40e_get_ppp_list(uint8_t port, uint8_t *buff)
+{
+	struct rte_eth_dev *dev = &rte_eth_devices[port];
+	struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+	struct i40e_profile_list *p_list;
+	struct i40e_profile_info *p_info;
+	uint32_t p_num, i;
+	enum i40e_status_code status = I40E_SUCCESS;
+
+	status = i40e_aq_get_ppp_list(hw, (void *)buff,
+		      (I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM + 4),
+		      0, NULL);
+	if (status < 0)
+		return status;
+
+	p_list = (struct i40e_profile_list *)buff;
+	p_num = p_list->p_count;
+	printf("Profile number is: %d\n\n", p_num);
+
+	for (i = 0; i < p_num; i++) {
+		p_info = &p_list->p_info[i];
+		printf("Profile %d:\n", i);
+		printf("Track id: 0x%x\n", p_info->track_id);
+		printf("Version: %d.%d.%d.%d \n\n",
+		       p_info->version.major,
+		       p_info->version.minor,
+		       p_info->version.update,
+		       p_info->version.draft);
+	}
+
+	return status;
+}
diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h
index e3eb1b9..9efc20e 100644
--- a/drivers/net/i40e/i40e_ethdev.h
+++ b/drivers/net/i40e/i40e_ethdev.h
@@ -839,6 +839,11 @@ struct i40e_profile_info {
 	uint8_t name[I40E_PPP_NAME_SIZE];
 };
 
+struct i40e_profile_list {
+	uint32_t p_count;
+	struct i40e_profile_info p_info[1];
+};
+
 int i40e_dev_switch_queues(struct i40e_pf *pf, bool on);
 int i40e_vsi_release(struct i40e_vsi *vsi);
 struct i40e_vsi *i40e_vsi_setup(struct i40e_pf *pf,
diff --git a/drivers/net/i40e/rte_pmd_i40e.h b/drivers/net/i40e/rte_pmd_i40e.h
index 7bd444c..a9daf6c 100644
--- a/drivers/net/i40e/rte_pmd_i40e.h
+++ b/drivers/net/i40e/rte_pmd_i40e.h
@@ -339,4 +339,11 @@ int rte_pmd_i40e_reset_vf_stats(uint8_t port,
  **/
 int i40e_process_package(uint8_t port, uint8_t *buff);
 
+/**
+ * i40e_get_ppp_list - Get loaded profiles
+ * @port: port id
+ * @buff: buffer for response
+ **/
+int i40e_get_ppp_list(uint8_t port, uint8_t *buff);
+
 #endif /* _PMD_I40E_H_ */
-- 
2.5.5



More information about the dev mailing list