From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 6FD79A04BC; Thu, 8 Oct 2020 17:57:50 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 884631C1C0; Thu, 8 Oct 2020 17:57:48 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by dpdk.org (Postfix) with ESMTP id D516C1C1B2 for ; Thu, 8 Oct 2020 17:57:45 +0200 (CEST) IronPort-SDR: WiDWaQdrxAXKwxIIWWHYyV0S71eKrM9ksa0voYXhu5eTmM1MTZJb+sAj/XAQfRae3QktH42ucs iV3342SBWS6Q== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="144683111" X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="144683111" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 08:57:43 -0700 IronPort-SDR: 3gkB6aS2xYDLij3M+8P1uPzbYauyMe+Y7iW6DyTjTKw7EKqPbA/JCD8GEqvWfRgtw+goViJID+ Wk1StMx8HjVA== X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="461855648" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.226.103]) ([10.213.226.103]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 08:57:41 -0700 To: "Min Hu (Connor)" , dev@dpdk.org Cc: konstantin.ananyev@intel.com, thomas@monjalon.net, arybchenko@solarflare.com, linuxarm@huawei.com References: <1599534347-20430-1-git-send-email-humin29@huawei.com> <1602151376-23766-1-git-send-email-humin29@huawei.com> <1602151376-23766-4-git-send-email-humin29@huawei.com> From: Ferruh Yigit Message-ID: Date: Thu, 8 Oct 2020 16:57:37 +0100 MIME-Version: 1.0 In-Reply-To: <1602151376-23766-4-git-send-email-humin29@huawei.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH V16 3/3] app/testpmd: add FEC command 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" On 10/8/2020 11:02 AM, Min Hu (Connor) wrote: > This commit adds testpmd capability to query and config FEC > function of device. This includes: > - show FEC capabilities, example: > testpmd> show port 0 fec capabilities > - show FEC mode, example: > testpmd> show port 0 fec_mode > - config FEC mode, example: > testpmd> set port fec_mode auto|off|rs|baser > > where: > > auto|off|rs|baser are four kinds of FEC mode which dev > support according to MAC link speed. > > Signed-off-by: Min Hu (Connor) > Reviewed-by: Wei Hu (Xavier) > Reviewed-by: Chengwen Feng > Reviewed-by: Chengchang Tang <...> > +static const struct { > + uint32_t speed; > + const char *name; > +} eth_speed_name[] = { > + { > + .speed = ETH_SPEED_NUM_10G, > + .name = "Speed 10G", > + }, > + { > + .speed = ETH_SPEED_NUM_25G, > + .name = "Speed 25G", > + }, > + { > + .speed = ETH_SPEED_NUM_40G, > + .name = "Speed 40G", > + }, > + { > + .speed = ETH_SPEED_NUM_50G, > + .name = "Speed 50G", > + }, > + { > + .speed = ETH_SPEED_NUM_100G, > + .name = "Speed 100G", > + }, > + { > + .speed = ETH_SPEED_NUM_200G, > + .name = "Speed 200G", > + }, > +}; > + > static void > print_ethaddr(const char *name, struct rte_ether_addr *eth_addr) > { > @@ -2969,6 +3021,45 @@ set_tx_pkt_split(const char *name) > printf("unknown value: \"%s\"\n", name); > } > > +int > +parse_fec_mode(const char *name, uint32_t *mode) > +{ > + uint8_t i; > + > + for (i = 0; i < RTE_DIM(fec_mode_name); i++) { > + if (strcmp(fec_mode_name[i].name, name) == 0) { > + *mode = RTE_ETH_FEC_MODE_TO_CAPA(fec_mode_name[i].mode); > + return 0; > + } > + } > + return -1; > +} > + > +void > +show_fec_capability(unsigned int num, struct rte_eth_fec_capa *speed_fec_capa) > +{ > + unsigned int i, j, k; > + > + printf("FEC capabilities:\n"); > + > + for (i = 0; i < num; i++) { > + for (j = 0; j < RTE_DIM(eth_speed_name); j++) { > + if (eth_speed_name[j].speed == > + speed_fec_capa[i].speed) { > + printf("%s : ", eth_speed_name[j].name); > + break; > + } > + } > + > + for (k = RTE_ETH_FEC_AUTO; k < RTE_DIM(fec_mode_name); k++) { > + if (RTE_ETH_FEC_MODE_TO_CAPA(k) & > + speed_fec_capa[i].capa) > + printf("%s ", fec_mode_name[k].name); > + } > + printf("\n"); > + } > +} Hi Connor, Sorry for catching this late, but there is a new 'rte_eth_link_speed_to_str()' API in the ethdev, which may enable removing above global 'eth_speed_name' array [1]. I will proceed with this patchset, but can you please send an increamental patch to use the 'rte_eth_link_speed_to_str()'? If it comes before the next-net pulled I can squash it, if not it can stay as individual patch. Thanks, ferruh [1] printf("%s : ", rte_eth_link_speed_to_str(speed_fec_capa[i].speed));