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 5EE1AA04BC; Fri, 9 Oct 2020 11:27:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B0ECA1C236; Fri, 9 Oct 2020 11:27:47 +0200 (CEST) Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 4743E1C234 for ; Fri, 9 Oct 2020 11:27:46 +0200 (CEST) IronPort-SDR: 3pU4WepfuormvPwUh8QpcMH6n1jYNE2vOAjSk1vUzE77+WGPyIa/134QLDIa5z4ECwKnjLtiUl Ch1itx49Pzbw== X-IronPort-AV: E=McAfee;i="6000,8403,9768"; a="165577637" X-IronPort-AV: E=Sophos;i="5.77,354,1596524400"; d="scan'208";a="165577637" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2020 02:27:44 -0700 IronPort-SDR: VSWwbAoJvD0Uy8OcxzXdWK8dRshDjVEWg7Vlu/az+kqdpaJCWJ9LAR8ctMOMyJkOkI5L2+cx0J QyDvqhWU5vTQ== X-IronPort-AV: E=Sophos;i="5.77,354,1596524400"; d="scan'208";a="528856405" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.252.18.7]) ([10.252.18.7]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Oct 2020 02:27:43 -0700 To: Sarosh Arif Cc: dev@dpdk.org References: <20200928100121.3332768-1-sarosh.arif@emumba.com> <20201008182513.369420-1-sarosh.arif@emumba.com> From: Ferruh Yigit Message-ID: <0f504a2a-d8ff-5fe2-7cdc-80ee770e6e7e@intel.com> Date: Fri, 9 Oct 2020 10:27:40 +0100 MIME-Version: 1.0 In-Reply-To: <20201008182513.369420-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 v5] 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 7:25 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 > --- > app/test-pmd/config.c | 43 +++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 43 insertions(+) > > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 30bee3324..68a7de7cf 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; > } > > +static void > +device_infos_display_speeds(uint32_t speed_capa) > +{ > + printf("\n\tDevice speed capability:"); > + if (speed_capa == ETH_LINK_SPEED_AUTONEG) > + printf(" Autonegotiate (all speeds)"); > + if (speed_capa & ETH_LINK_SPEED_FIXED) > + printf(" Disable autonegotiate (fixed speed) "); > + if (speed_capa & ETH_LINK_SPEED_10M_HD) > + printf(" 10 Mbps half-duplex "); > + if (speed_capa & ETH_LINK_SPEED_10M) > + printf(" 10 Mbps full-duplex "); > + if (speed_capa & ETH_LINK_SPEED_100M_HD) > + printf(" 100 Mbps half-duplex "); > + if (speed_capa & ETH_LINK_SPEED_100M) > + printf(" 100 Mbps full-duplex "); > + if (speed_capa & ETH_LINK_SPEED_1G) > + printf(" 1 Gbps "); > + if (speed_capa & ETH_LINK_SPEED_2_5G) > + printf(" 2.5 Gbps "); > + if (speed_capa & ETH_LINK_SPEED_5G) > + printf(" 5 Gbps "); > + if (speed_capa & ETH_LINK_SPEED_10G) > + printf(" 10 Gbps "); > + if (speed_capa & ETH_LINK_SPEED_20G) > + printf(" 20 Gbps "); > + if (speed_capa & ETH_LINK_SPEED_25G) > + printf(" 25 Gbps "); > + if (speed_capa & ETH_LINK_SPEED_40G) > + printf(" 40 Gbps "); > + if (speed_capa & ETH_LINK_SPEED_50G) > + printf(" 50 Gbps "); > + if (speed_capa & ETH_LINK_SPEED_56G) > + printf(" 56 Gbps "); > + if (speed_capa & ETH_LINK_SPEED_100G) > + printf(" 100 Gbps "); > + if (speed_capa & ETH_LINK_SPEED_200G) > + printf(" 200 Gbps "); > +} > + > void > device_infos_display(const char *identifier) > { > @@ -518,6 +558,7 @@ device_infos_display(const char *identifier) > struct rte_device *dev; > struct rte_devargs da; > portid_t port_id; > + struct rte_eth_dev_info dev_info; > char devstr[128]; > > memset(&da, 0, sizeof(da)); > @@ -569,6 +610,8 @@ device_infos_display(const char *identifier) > &mac_addr); > rte_eth_dev_get_name_by_port(port_id, name); > printf("\n\tDevice name: %s", name); > + if (rte_eth_dev_info_get(port_id, &dev_info) > 0) My bad, this should be (rte_eth_dev_info_get(port_id, &dev_info) == 0), I can fix while merging. Except from above, Reviewed-by: Ferruh Yigit