From patchwork Fri Mar 3 07:39:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xing, Beilei" X-Patchwork-Id: 21242 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 47E61F96D; Fri, 3 Mar 2017 08:41:27 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id D206FF610 for ; Fri, 3 Mar 2017 08:41:01 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP; 02 Mar 2017 23:41:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,235,1484035200"; d="scan'208";a="55373003" Received: from unknown (HELO dpdk9.sh.intel.com) ([10.239.129.31]) by orsmga002.jf.intel.com with ESMTP; 02 Mar 2017 23:41:00 -0800 From: Beilei Xing To: jingjing.wu@intel.com Cc: helin.zhang@intel.com, dev@dpdk.org Date: Fri, 3 Mar 2017 15:39:44 +0800 Message-Id: <1488526784-16621-6-git-send-email-beilei.xing@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1488526784-16621-1-git-send-email-beilei.xing@intel.com> References: <1488525977-15321-7-git-send-email-beilei.xing@intel.com> <1488526784-16621-1-git-send-email-beilei.xing@intel.com> Subject: [dpdk-dev] [PATCH v2 5/5] app/testpmd: add command for getting loaded profiles X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list 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 testpmd CLI for getting all loaded profiles. Signed-off-by: Beilei Xing --- app/test-pmd/cmdline.c | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/testpmd.h | 1 + 2 files changed, 61 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 6b6af87..b231c04 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -12455,6 +12455,65 @@ cmdline_parse_inst_t cmd_write_ppp = { NULL, }, }; + +/* Get Pipeline Personalization Profile list*/ +#define PROFILE_INFO_SIZE 48 +#define MAX_PROFILE_NUM 16 + +struct cmd_get_ppp_list_result { + cmdline_fixed_string_t get; + cmdline_fixed_string_t ppp; + cmdline_fixed_string_t list; + uint8_t port_id; +}; + +cmdline_parse_token_string_t cmd_get_ppp_list_get = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, get, "get"); +cmdline_parse_token_string_t cmd_get_ppp_list_ppp = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, ppp, "ppp"); +cmdline_parse_token_string_t cmd_get_ppp_list_list = + TOKEN_STRING_INITIALIZER(struct cmd_get_ppp_list_result, list, "list"); +cmdline_parse_token_num_t cmd_get_ppp_list_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_get_ppp_list_result, port_id, UINT8); + +static void +cmd_get_ppp_list_parsed( + void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_get_ppp_list_result *res = parsed_result; + uint8_t *buff; + int ret; + + if (res->port_id > nb_ports) { + printf("Invalid port, range is [0, %d]\n", nb_ports - 1); + return; + } + + buff = (uint8_t *)malloc(PROFILE_INFO_SIZE * MAX_PROFILE_NUM + 4); + if (!buff) + printf("%s: Failed to malloc buffer\n", __func__); + + ret = i40e_get_ppp_list(res->port_id, buff); + if (ret < 0) + printf("Failed to get ppp list\n"); + + free(buff); +} + +cmdline_parse_inst_t cmd_get_ppp_list = { + .f = cmd_get_ppp_list_parsed, + .data = NULL, + .help_str = "get ppp list ", + .tokens = { + (void *)&cmd_get_ppp_list_get, + (void *)&cmd_get_ppp_list_ppp, + (void *)&cmd_get_ppp_list_list, + (void *)&cmd_get_ppp_list_port_id, + NULL, + }, +}; /* ******************************************************************************** */ /* list of instructions */ @@ -12631,6 +12690,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_vf_broadcast, (cmdline_parse_inst_t *)&cmd_set_vf_vlan_tag, (cmdline_parse_inst_t *)&cmd_write_ppp, + (cmdline_parse_inst_t *)&cmd_get_ppp_list, NULL, }; diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 2a7f683..a7aa218 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -624,6 +624,7 @@ void port_dcb_info_display(uint8_t port_id); uint8_t *open_package_file(const char *file_path); int close_package_file(uint8_t *buf); +void get_ppp_list(uint8_t port_id); enum print_warning { ENABLED_WARN = 0,