From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4798C43457 for ; Thu, 8 Oct 2020 16:15:02 +0000 (UTC) Received: from dpdk.org (dpdk.org [92.243.14.124]) by mail.kernel.org (Postfix) with ESMTP id 0232B221F1 for ; Thu, 8 Oct 2020 16:15:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0232B221F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=dev-bounces@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id AF5E61BCBF; Thu, 8 Oct 2020 18:14:59 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by dpdk.org (Postfix) with ESMTP id B9D1B1BC86 for ; Thu, 8 Oct 2020 18:14:57 +0200 (CEST) IronPort-SDR: Cbh034kmSRot7WHdXMH5bXjHNm3Y01/SRfRAK+btc5hZPpMcaKGMwEAVY+fT2b9FRsD3TMLnZc gzrqTmgw+ARQ== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="153198464" X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="153198464" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Oct 2020 09:14:55 -0700 IronPort-SDR: 65FEsEM7xyz2+GEs5O5v2ACW3DVh1D+a/Ol+21ky0TFuJ0a7lQfYZC370P+MTiIepurSF8fmS/ blUZp4Y3ch2Q== X-IronPort-AV: E=Sophos;i="5.77,351,1596524400"; d="scan'208";a="461862614" 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 09:14:54 -0700 To: Sarosh Arif Cc: dev@dpdk.org References: <20200928100121.3332768-1-sarosh.arif@emumba.com> <20201008114924.355740-1-sarosh.arif@emumba.com> From: Ferruh Yigit Message-ID: <50e4724d-a256-be40-c7c0-440eddf3bffd@intel.com> Date: Thu, 8 Oct 2020 17:14:51 +0100 MIME-Version: 1.0 In-Reply-To: <20201008114924.355740-1-sarosh.arif@emumba.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [dpdk-dev] [PATCH v3] testpmd: add speed capability in device info 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 12:49 PM, Sarosh Arif wrote: > Called rte_eth_dev_info_get() in testpmd, to get device info > so that speed capabilities can be printed under "show device info" > ​ > Bugzilla ID: 496 > Signed-off-by: Sarosh Arif > --- > v2: > display all speed capabilities in a single line > remove switch case > v3: > add missing speeds > make a function for displaying speed capabilities > --- > app/test-pmd/config.c | 45 ++++++++++++++++++++++++++++++++++++++++++ > app/test-pmd/testpmd.h | 1 + > 2 files changed, 46 insertions(+) > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 30bee3324..95c2798c8 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -507,6 +507,46 @@ static int bus_match_all(const struct rte_bus *bus, const void *data) > return 0; > } > > +void > +device_infos_display_speeds(uint32_t speed_capa) > +{ Can you please make the function static? <...> > @@ -569,6 +611,9 @@ device_infos_display(const char *identifier) > &mac_addr); > rte_eth_dev_get_name_by_port(port_id, name); > printf("\n\tDevice name: %s", name); > + rte_eth_dev_info_get(port_id, &dev_info); It is very unlikely that it will fail but still it can be good add the return value check if (rte_eth_dev_info_get(port_id, &dev_info) > 0) device_infos_display_speeds(dev_info.speed_capa); > + speed_capa = dev_info.speed_capa; > + device_infos_display_speeds(speed_capa); Is the 'speed_capa' variable still needed? Why not directly use 'dev_info.speed_capa'? > printf("\n"); > } > } > diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h > index 25a12b14f..0773016f7 100644 > --- a/app/test-pmd/testpmd.h > +++ b/app/test-pmd/testpmd.h > @@ -694,6 +694,7 @@ void nic_stats_clear(portid_t port_id); > void nic_xstats_display(portid_t port_id); > void nic_xstats_clear(portid_t port_id); > void nic_stats_mapping_display(portid_t port_id); > +void device_infos_display_speeds(uint32_t speed_capa); If function becomes static this deceleration won't be needed.