From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id F2565A0032; Thu, 12 May 2022 04:15:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 844DD42831; Thu, 12 May 2022 04:15:07 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by mails.dpdk.org (Postfix) with ESMTP id 76E6142830 for ; Thu, 12 May 2022 04:15:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652321706; x=1683857706; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ooMBmJ2syzLADvE7kHSsXX842+Tpvep7GHjA2bTjVEI=; b=nfrBJt8Q4GBzg55pDPT7dbkqb27ktbHB8DiHfHbgNK2wEAPxRhc+flic C7zF02HpK8tkObaGzXh+fhTGbHV23aVaUbok3h930oBYy7M4EZiKwxyoA yWegOuWYXlE6xdSkcGY5tK3RZYc+3RyzbvgK1eodZXGXn+fDurN9pTiLW Ee64nOykQeUsL0PdHN/DM773ZG0+pBwqnhPhgp+uOJp8le5qnKb5Qz3ea m+DmSpceEDFSITzAUt6J1LTEGQEbKvXg+l2GQ8XKTmyH8ILqxUuDSJDt+ nKwPyMZxzQ6qTvXIDp2Ep+jHaeC5wPxlakPaD102vN4L00U0w/Vls9sVL Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="269804724" X-IronPort-AV: E=Sophos;i="5.91,218,1647327600"; d="scan'208";a="269804724" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 19:15:06 -0700 X-IronPort-AV: E=Sophos;i="5.91,218,1647327600"; d="scan'208";a="594435285" Received: from intel-cd-odc-steve.cd.intel.com ([10.240.178.191]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 May 2022 19:15:03 -0700 From: Steve Yang To: dev@dpdk.org Cc: yuying.zhang@intel.com, qiming.yang@intel.com, qi.z.zhang@intel.com, mdr@ashroe.eu, Steve Yang Subject: [PATCH v2 2/2] app/testpmd: support dump_pkg command for ice Date: Thu, 12 May 2022 02:06:18 +0000 Message-Id: <20220512020618.474816-3-stevex.yang@intel.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220512020618.474816-1-stevex.yang@intel.com> References: <20220511080247.261043-1-stevex.yang@intel.com> <20220512020618.474816-1-stevex.yang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Support dump ice PF ddp package via testpmd command line. Add command line: ddp dump Parameters: the PF Port ID dumped package profile file, if not a absolute path, it will be dumped to testpmd running directory. For example: testpmd> ddp dump 0 current.pkg If you want to dump ice VF ddp package, you need bind other unused PF port of the NIC first, and then dump the PF ddp package as target output. Signed-off-by: Steve Yang --- app/test-pmd/cmdline.c | 74 ++++++++++++++++++++++++++++++++++++++++ app/test-pmd/meson.build | 3 ++ 2 files changed, 77 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 6ffea8e21a..e55532223b 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -60,6 +60,9 @@ #ifdef RTE_NET_I40E #include #endif +#ifdef RTE_NET_ICE +#include +#endif #ifdef RTE_NET_BNXT #include #endif @@ -654,6 +657,9 @@ static void cmd_help_long_parsed(void *parsed_result, "set link-down port (port_id)\n" " Set link down for a port.\n\n" + "ddp dump (port_id) (profile_path)\n" + " Dump a profile package on a port\n\n" + "ddp add (port_id) (profile_path[,backup_profile_path])\n" " Load a profile package on a port\n\n" @@ -14471,6 +14477,73 @@ cmdline_parse_inst_t cmd_strict_link_prio = { }, }; +/* Dump device ddp package, only for ice PF */ +struct cmd_ddp_dump_result { + cmdline_fixed_string_t ddp; + cmdline_fixed_string_t add; + portid_t port_id; + char filepath[]; +}; + +cmdline_parse_token_string_t cmd_ddp_dump_ddp = + TOKEN_STRING_INITIALIZER(struct cmd_ddp_dump_result, ddp, "ddp"); +cmdline_parse_token_string_t cmd_ddp_dump_dump = + TOKEN_STRING_INITIALIZER(struct cmd_ddp_dump_result, add, "dump"); +cmdline_parse_token_num_t cmd_ddp_dump_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_ddp_dump_result, port_id, RTE_UINT16); +cmdline_parse_token_string_t cmd_ddp_dump_filepath = + TOKEN_STRING_INITIALIZER(struct cmd_ddp_dump_result, filepath, NULL); + +static void +cmd_ddp_dump_parsed( + void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ + struct cmd_ddp_dump_result *res = parsed_result; + uint8_t *buff; + uint32_t size; + int ret = -ENOTSUP; + +#define ICE_BUFF_SIZE 0x000c9000 + size = ICE_BUFF_SIZE; + buff = (uint8_t *)malloc(ICE_BUFF_SIZE); + if (buff) { +#ifdef RTE_NET_ICE + ret = rte_pmd_ice_dump_package(res->port_id, &buff, &size); +#endif + switch (ret) { + case 0: + save_file(res->filepath, buff, size); + break; + case -EINVAL: + fprintf(stderr, "Invalid buffer size\n"); + break; + case -ENOTSUP: + fprintf(stderr, + "Device doesn't support dump package.\n"); + break; + default: + fprintf(stderr, "Failed to dump package file," + " error: (%s)\n", strerror(-ret)); + } + } + free(buff); +} + +cmdline_parse_inst_t cmd_ddp_dump = { + .f = cmd_ddp_dump_parsed, + .data = NULL, + .help_str = "ddp dump ", + .tokens = { + (void *)&cmd_ddp_dump_ddp, + (void *)&cmd_ddp_dump_dump, + (void *)&cmd_ddp_dump_port_id, + (void *)&cmd_ddp_dump_filepath, + NULL, + }, +}; + /* Load dynamic device personalization*/ struct cmd_ddp_add_result { cmdline_fixed_string_t ddp; @@ -18025,6 +18098,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_ddp_del, (cmdline_parse_inst_t *)&cmd_ddp_get_list, (cmdline_parse_inst_t *)&cmd_ddp_get_info, + (cmdline_parse_inst_t *)&cmd_ddp_dump, (cmdline_parse_inst_t *)&cmd_cfg_input_set, (cmdline_parse_inst_t *)&cmd_clear_input_set, (cmdline_parse_inst_t *)&cmd_show_vf_stats, diff --git a/app/test-pmd/meson.build b/app/test-pmd/meson.build index 43130c8856..569e039bf7 100644 --- a/app/test-pmd/meson.build +++ b/app/test-pmd/meson.build @@ -67,6 +67,9 @@ endif if dpdk_conf.has('RTE_NET_I40E') deps += 'net_i40e' endif +if dpdk_conf.has('RTE_NET_ICE') + deps += 'net_ice' +endif if dpdk_conf.has('RTE_NET_IXGBE') deps += 'net_ixgbe' endif -- 2.27.0