DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Asaf Penso <asafp@nvidia.com>, Sarosh Arif <sarosh.arif@emumba.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	NBU-Contact-Thomas Monjalon <thomas@monjalon.net>
Subject: Re: [dpdk-dev] [PATCH v2] testpmd: add speed capability in device info
Date: Wed, 7 Oct 2020 16:30:23 +0100
Message-ID: <27726e10-fd7d-afe6-4f7f-f5bf9c16985c@intel.com> (raw)
In-Reply-To: <DM5PR12MB2406B43D91558D435195CE5ACD0F0@DM5PR12MB2406.namprd12.prod.outlook.com>

On 10/4/2020 9:51 AM, Asaf Penso wrote:
>> -----Original Message-----
>> From: dev <dev-bounces@dpdk.org> On Behalf Of Sarosh Arif
>> Sent: Monday, September 28, 2020 1:01 PM
>> To: ferruh.yigit@intel.com
>> Cc: dev@dpdk.org; Sarosh Arif <sarosh.arif@emumba.com>
>> Subject: [dpdk-dev] [PATCH v2] testpmd: add speed capability in device info
>>
>> 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 <sarosh.arif@emumba.com>
>> ---
>> app/test-pmd/config.c | 38 ++++++++++++++++++++++++++++++++++++++
>> 1 file changed, 38 insertions(+)
>>
>> diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index
>> 30bee3324..e2b3975a3 100644
>> --- a/app/test-pmd/config.c
>> +++ b/app/test-pmd/config.c
>> @@ -518,7 +518,9 @@ 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];
>> +	uint32_t speed_capa;
>>
>> 	memset(&da, 0, sizeof(da));
>> 	if (!identifier)
>> @@ -569,6 +571,42 @@ device_infos_display(const char *identifier)
>> 						      &mac_addr);
>> 				rte_eth_dev_get_name_by_port(port_id,
>> name);
>> 				printf("\n\tDevice name: %s", name);
> 
> How about extracting the below to a dedicated helper function to make the code more readable?
> Something like: void device_infos_display_speeds(uint32_t speed_capa)
> 
>> +				rte_eth_dev_info_get(port_id, &dev_info);
>> +				speed_capa = dev_info.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_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  ");
>> 				printf("\n");

Some speeds are missing, please add all.

And +1 to Asaf's comment to extract it into its own function.
	

>> 			}
>> 		}
>> --
>> 2.25.1
> 
> I'm ok also to leave is as-is.
> Reviewed-By: Asaf Penso <asafp@nvidia.com>
> 


  reply	other threads:[~2020-10-07 15:30 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04  6:23 [dpdk-dev] [PATCH] " Sarosh Arif
2020-09-08  8:36 ` Sarosh Arif
2020-09-08 11:55   ` Ferruh Yigit
2020-09-17 15:56 ` Ferruh Yigit
2020-09-21 11:22   ` Sarosh Arif
2020-09-28 10:01 ` [dpdk-dev] [PATCH v2] " Sarosh Arif
2020-10-04  8:51   ` Asaf Penso
2020-10-07 15:30     ` Ferruh Yigit [this message]
2020-10-08 11:49   ` [dpdk-dev] [PATCH v3] " Sarosh Arif
2020-10-08 16:14     ` Ferruh Yigit
2020-10-08 18:11   ` [dpdk-dev] [PATCH v4] " Sarosh Arif
2020-10-08 18:25   ` [dpdk-dev] [PATCH v5] " Sarosh Arif
2020-10-09  9:27     ` Ferruh Yigit
2020-10-09 11:53       ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27726e10-fd7d-afe6-4f7f-f5bf9c16985c@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=asafp@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=sarosh.arif@emumba.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git