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 00008A04C0; Thu, 17 Sep 2020 17:56:31 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id DA1361D6B5; Thu, 17 Sep 2020 17:56:31 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 110EB1D6B2 for ; Thu, 17 Sep 2020 17:56:30 +0200 (CEST) IronPort-SDR: wDyNAdjYelna0PBsjwTezMEIJV9wSqTlbNS5JZGiO0uwc8IPS/5/9vTNj/KbhhQRWFlPYvScvj b2Qfxc0DOa8g== X-IronPort-AV: E=McAfee;i="6000,8403,9747"; a="221279091" X-IronPort-AV: E=Sophos;i="5.77,271,1596524400"; d="scan'208";a="221279091" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2020 08:56:26 -0700 IronPort-SDR: 19j0rqs0hCB+8h+wsbAm7kW+tglF3l0LtiHfl44V1cxLbbbMSXEHRlw4U/Mo3ZLHzuJNf5K95c UdOI1DWN/ofQ== X-IronPort-AV: E=Sophos;i="5.77,271,1596524400"; d="scan'208";a="483799748" Received: from fyigit-mobl1.ger.corp.intel.com (HELO [10.213.228.143]) ([10.213.228.143]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2020 08:56:25 -0700 To: Sarosh Arif Cc: dev@dpdk.org References: <20200904062339.77430-1-sarosh.arif@emumba.com> From: Ferruh Yigit Message-ID: <84032779-1b74-0aed-2a49-9a0315c7b819@intel.com> Date: Thu, 17 Sep 2020 16:56:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.2.2 MIME-Version: 1.0 In-Reply-To: <20200904062339.77430-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] 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 9/4/2020 7:23 AM, Sarosh Arif wrote: > diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c > index 30bee3324..8824ad174 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -518,6 +518,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]; This is for the testpmd command "show device info |all", not sure speed capabilities really fits the device info display. "show port info |all" command may be better fit, but before that is there a specific need to see the speed capabilities of a port, it may help figuring out right place. > > memset(&da, 0, sizeof(da)); > @@ -569,6 +570,90 @@ 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); > + switch (dev_info.speed_capa) { > + case ETH_LINK_SPEED_AUTONEG: > + printf("\n\tDevice speed capability: %s", > + "Autonegotiate (all speeds)"); > + break; > + case ETH_LINK_SPEED_FIXED: > + printf("\n\tDevice speed capability: %s", > + "Disable autonegotiate (fixed speed)"); > + break; > + case ETH_LINK_SPEED_10M_HD ... > + ETH_LINK_SPEED_10M-1: Why ranges are used, there can't be any value in between? Also case range is not part of starndard, may be good to avoid for portability, like the case -pendantic is used etc.. > + printf("\n\tDevice speed capability: %s", > + "10 Mbps half-duplex"); > + break; You should not break. 'speed_capa' is list of speeds that device supports, so it won't be a single value, that is why breaking after first hit is wrong. Can you please confirm you intentions is not to display link speed, but "speed capability"? Btw, link speed is already displayed in "show port info ..." > + case ETH_LINK_SPEED_10M ... > + ETH_LINK_SPEED_100M_HD-1: > + printf("\n\tDevice speed capability: %s", > + "10 Mbps full-duplex"); Also no need to be this verbose, since there will be multiple values, this makes to much noise, instead can be an list of speeds in single line.