From mboxrd@z Thu Jan 1 00:00:00 1970 From: Beilei Xing Subject: [PATCH 5/6] net/i40e: add get all loaded profiles Date: Fri, 3 Mar 2017 15:26:16 +0800 Message-ID: <1488525977-15321-12-git-send-email-beilei.xing@intel.com> References: <1488525977-15321-1-git-send-email-beilei.xing@intel.com> Cc: helin.zhang@intel.com, dev@dpdk.org To: jingjing.wu@intel.com Return-path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id C50C42B93 for ; Fri, 3 Mar 2017 08:27:35 +0100 (CET) In-Reply-To: <1488525977-15321-1-git-send-email-beilei.xing@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch is to add get all loaded profiles function. Signed-off-by: Beilei Xing --- 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