DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] testpmd: add speed capability in device info
@ 2020-09-04  6:23 Sarosh Arif
  2020-09-08  8:36 ` Sarosh Arif
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Sarosh Arif @ 2020-09-04  6:23 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, Sarosh Arif

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];
 
 	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:
+					printf("\n\tDevice speed capability: %s",
+							"10 Mbps half-duplex");
+					break;
+				case ETH_LINK_SPEED_10M ...
+						ETH_LINK_SPEED_100M_HD-1:
+					printf("\n\tDevice speed capability: %s",
+							"10 Mbps full-duplex");
+					break;
+				case ETH_LINK_SPEED_100M_HD ...
+						ETH_LINK_SPEED_100M-1:
+					printf("\n\tDevice speed capability: %s",
+							"100 Mbps half-duplex");
+					break;
+				case ETH_LINK_SPEED_100M ...
+						ETH_LINK_SPEED_1G-1:
+					printf("\n\tDevice speed capability: %s",
+							"100 Mbps full-duplex");
+					break;
+				case ETH_LINK_SPEED_1G ...
+						ETH_LINK_SPEED_2_5G-1:
+					printf("\n\tDevice speed capability: %s",
+							"1 Gbps");
+					break;
+				case ETH_LINK_SPEED_2_5G ...
+						ETH_LINK_SPEED_5G-1:
+					printf("\n\tDevice speed capability: %s",
+							"2.5 Gbps");
+					break;
+				case ETH_LINK_SPEED_5G ...
+						ETH_LINK_SPEED_10G-1:
+					printf("\n\tDevice speed capability: %s",
+							"5 Gbps");
+					break;
+				case ETH_LINK_SPEED_10G ...
+						ETH_LINK_SPEED_20G-1:
+					printf("\n\tDevice speed capability: %s",
+							"10 Gbps");
+					break;
+				case ETH_LINK_SPEED_20G ...
+						ETH_LINK_SPEED_25G-1:
+					printf("\n\tDevice speed capability: %s",
+							"20 Gbps");
+					break;
+				case ETH_LINK_SPEED_25G ...
+						ETH_LINK_SPEED_50G-1:
+					printf("\n\tDevice speed capability: %s",
+							"25 Gbps");
+					break;
+				case ETH_LINK_SPEED_50G ...
+						ETH_LINK_SPEED_56G-1:
+					printf("\n\tDevice speed capability: %s",
+							"50 Gbps");
+					break;
+				case ETH_LINK_SPEED_56G ...
+						ETH_LINK_SPEED_100G-1:
+					printf("\n\tDevice speed capability: %s",
+							"56 Gbps");
+					break;
+				case ETH_LINK_SPEED_100G ...
+						ETH_LINK_SPEED_200G-1:
+					printf("\n\tDevice speed capability: %s",
+							"100 Gbps");
+					break;
+				case ETH_LINK_SPEED_200G:
+					printf("\n\tDevice speed capability: %s",
+							"200 Gbps");
+					break;
+				default:
+					printf("\n\tDevice speed capability: %s",
+							"not available");
+					break;
+				}
 				printf("\n");
 			}
 		}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH] testpmd: add speed capability in device info
  2020-09-04  6:23 [dpdk-dev] [PATCH] testpmd: add speed capability in device info 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-28 10:01 ` [dpdk-dev] [PATCH v2] " Sarosh Arif
  2 siblings, 1 reply; 14+ messages in thread
From: Sarosh Arif @ 2020-09-08  8:36 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev

delay_us_sleep_autotest is failing on this patch. To replicate it, I
ran the same test on my system and it did not fail. Can this test be
re-run?

On Fri, Sep 4, 2020 at 11:23 AM Sarosh Arif <sarosh.arif@emumba.com> 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];
>
>         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:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "10 Mbps half-duplex");
> +                                       break;
> +                               case ETH_LINK_SPEED_10M ...
> +                                               ETH_LINK_SPEED_100M_HD-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "10 Mbps full-duplex");
> +                                       break;
> +                               case ETH_LINK_SPEED_100M_HD ...
> +                                               ETH_LINK_SPEED_100M-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "100 Mbps half-duplex");
> +                                       break;
> +                               case ETH_LINK_SPEED_100M ...
> +                                               ETH_LINK_SPEED_1G-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "100 Mbps full-duplex");
> +                                       break;
> +                               case ETH_LINK_SPEED_1G ...
> +                                               ETH_LINK_SPEED_2_5G-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "1 Gbps");
> +                                       break;
> +                               case ETH_LINK_SPEED_2_5G ...
> +                                               ETH_LINK_SPEED_5G-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "2.5 Gbps");
> +                                       break;
> +                               case ETH_LINK_SPEED_5G ...
> +                                               ETH_LINK_SPEED_10G-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "5 Gbps");
> +                                       break;
> +                               case ETH_LINK_SPEED_10G ...
> +                                               ETH_LINK_SPEED_20G-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "10 Gbps");
> +                                       break;
> +                               case ETH_LINK_SPEED_20G ...
> +                                               ETH_LINK_SPEED_25G-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "20 Gbps");
> +                                       break;
> +                               case ETH_LINK_SPEED_25G ...
> +                                               ETH_LINK_SPEED_50G-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "25 Gbps");
> +                                       break;
> +                               case ETH_LINK_SPEED_50G ...
> +                                               ETH_LINK_SPEED_56G-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "50 Gbps");
> +                                       break;
> +                               case ETH_LINK_SPEED_56G ...
> +                                               ETH_LINK_SPEED_100G-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "56 Gbps");
> +                                       break;
> +                               case ETH_LINK_SPEED_100G ...
> +                                               ETH_LINK_SPEED_200G-1:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "100 Gbps");
> +                                       break;
> +                               case ETH_LINK_SPEED_200G:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "200 Gbps");
> +                                       break;
> +                               default:
> +                                       printf("\n\tDevice speed capability: %s",
> +                                                       "not available");
> +                                       break;
> +                               }
>                                 printf("\n");
>                         }
>                 }
> --
> 2.25.1
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH] testpmd: add speed capability in device info
  2020-09-08  8:36 ` Sarosh Arif
@ 2020-09-08 11:55   ` Ferruh Yigit
  0 siblings, 0 replies; 14+ messages in thread
From: Ferruh Yigit @ 2020-09-08 11:55 UTC (permalink / raw)
  To: Sarosh Arif; +Cc: dev, dpdklab

On 9/8/2020 9:36 AM, Sarosh Arif wrote:
> delay_us_sleep_autotest is failing on this patch. To replicate it, I
> ran the same test on my system and it did not fail. Can this test be
> re-run?

cc'ed lab people.
I clicked the 'rebuild' button for the test, but I can't see if it queued or not...

> 
> On Fri, Sep 4, 2020 at 11:23 AM Sarosh Arif <sarosh.arif@emumba.com> 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];
>>
>>         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:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "10 Mbps half-duplex");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_10M ...
>> +                                               ETH_LINK_SPEED_100M_HD-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "10 Mbps full-duplex");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_100M_HD ...
>> +                                               ETH_LINK_SPEED_100M-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "100 Mbps half-duplex");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_100M ...
>> +                                               ETH_LINK_SPEED_1G-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "100 Mbps full-duplex");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_1G ...
>> +                                               ETH_LINK_SPEED_2_5G-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "1 Gbps");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_2_5G ...
>> +                                               ETH_LINK_SPEED_5G-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "2.5 Gbps");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_5G ...
>> +                                               ETH_LINK_SPEED_10G-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "5 Gbps");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_10G ...
>> +                                               ETH_LINK_SPEED_20G-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "10 Gbps");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_20G ...
>> +                                               ETH_LINK_SPEED_25G-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "20 Gbps");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_25G ...
>> +                                               ETH_LINK_SPEED_50G-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "25 Gbps");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_50G ...
>> +                                               ETH_LINK_SPEED_56G-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "50 Gbps");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_56G ...
>> +                                               ETH_LINK_SPEED_100G-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "56 Gbps");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_100G ...
>> +                                               ETH_LINK_SPEED_200G-1:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "100 Gbps");
>> +                                       break;
>> +                               case ETH_LINK_SPEED_200G:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "200 Gbps");
>> +                                       break;
>> +                               default:
>> +                                       printf("\n\tDevice speed capability: %s",
>> +                                                       "not available");
>> +                                       break;
>> +                               }
>>                                 printf("\n");
>>                         }
>>                 }
>> --
>> 2.25.1
>>


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH] testpmd: add speed capability in device info
  2020-09-04  6:23 [dpdk-dev] [PATCH] testpmd: add speed capability in device info Sarosh Arif
  2020-09-08  8:36 ` Sarosh Arif
@ 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
  2 siblings, 1 reply; 14+ messages in thread
From: Ferruh Yigit @ 2020-09-17 15:56 UTC (permalink / raw)
  To: Sarosh Arif; +Cc: 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 <identifier>|all",
not sure speed capabilities really fits the device info display.

"show port info <port_id>|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.


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH] testpmd: add speed capability in device info
  2020-09-17 15:56 ` Ferruh Yigit
@ 2020-09-21 11:22   ` Sarosh Arif
  0 siblings, 0 replies; 14+ messages in thread
From: Sarosh Arif @ 2020-09-21 11:22 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: dev

On Thu, Sep 17, 2020 at 8:56 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> 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 <identifier>|all",
> not sure speed capabilities really fits the device info display.
>
> "show port info <port_id>|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.
In bug 496 on bugzilla, it is requested to display speed capabilities
of a device,
in order to create a test to confirm the correct speed capabilities of a device.
Since speed_capa is property of the device it should be printed under
show device info.


>
> >
> >       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?
>
It's a bit map so multiple bits can be one at a time resulting in
values in between.
> Also case range is not part of starndard, may be good to avoid for
> portability, like the case -pendantic is used etc..
I will submit v2 without using case range.
>
>
> > +                                     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.
I will correct this in v2
>
> 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 ..."
The intention is to be able create a test to confirm the correct speed
capabilities of a device.

>
> > +                             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.
Okay
>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dpdk-dev] [PATCH v2] testpmd: add speed capability in device info
  2020-09-04  6:23 [dpdk-dev] [PATCH] testpmd: add speed capability in device info Sarosh Arif
  2020-09-08  8:36 ` Sarosh Arif
  2020-09-17 15:56 ` Ferruh Yigit
@ 2020-09-28 10:01 ` Sarosh Arif
  2020-10-04  8:51   ` Asaf Penso
                     ` (3 more replies)
  2 siblings, 4 replies; 14+ messages in thread
From: Sarosh Arif @ 2020-09-28 10:01 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, Sarosh Arif

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);
+				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");
 			}
 		}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH v2] testpmd: add speed capability in device info
  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
  2020-10-08 11:49   ` [dpdk-dev] [PATCH v3] " Sarosh Arif
                     ` (2 subsequent siblings)
  3 siblings, 1 reply; 14+ messages in thread
From: Asaf Penso @ 2020-10-04  8:51 UTC (permalink / raw)
  To: Sarosh Arif, ferruh.yigit; +Cc: dev, NBU-Contact-Thomas Monjalon

>-----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");
> 			}
> 		}
>--
>2.25.1

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

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH v2] testpmd: add speed capability in device info
  2020-10-04  8:51   ` Asaf Penso
@ 2020-10-07 15:30     ` Ferruh Yigit
  0 siblings, 0 replies; 14+ messages in thread
From: Ferruh Yigit @ 2020-10-07 15:30 UTC (permalink / raw)
  To: Asaf Penso, Sarosh Arif; +Cc: dev, NBU-Contact-Thomas Monjalon

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>
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dpdk-dev] [PATCH v3] testpmd: add speed capability in device info
  2020-09-28 10:01 ` [dpdk-dev] [PATCH v2] " Sarosh Arif
  2020-10-04  8:51   ` Asaf Penso
@ 2020-10-08 11:49   ` 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
  3 siblings, 1 reply; 14+ messages in thread
From: Sarosh Arif @ 2020-10-08 11:49 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, Sarosh Arif

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>
---
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)
+{
+	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,7 +558,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 +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);
+				speed_capa = dev_info.speed_capa;
+				device_infos_display_speeds(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);
 void device_infos_display(const char *identifier);
 void port_infos_display(portid_t port_id);
 void port_summary_display(portid_t port_id);
-- 
2.25.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH v3] testpmd: add speed capability in device info
  2020-10-08 11:49   ` [dpdk-dev] [PATCH v3] " Sarosh Arif
@ 2020-10-08 16:14     ` Ferruh Yigit
  0 siblings, 0 replies; 14+ messages in thread
From: Ferruh Yigit @ 2020-10-08 16:14 UTC (permalink / raw)
  To: Sarosh Arif; +Cc: 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 <sarosh.arif@emumba.com>
> ---
> 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.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dpdk-dev] [PATCH v4] testpmd: add speed capability in device info
  2020-09-28 10:01 ` [dpdk-dev] [PATCH v2] " Sarosh Arif
  2020-10-04  8:51   ` Asaf Penso
  2020-10-08 11:49   ` [dpdk-dev] [PATCH v3] " Sarosh Arif
@ 2020-10-08 18:11   ` Sarosh Arif
  2020-10-08 18:25   ` [dpdk-dev] [PATCH v5] " Sarosh Arif
  3 siblings, 0 replies; 14+ messages in thread
From: Sarosh Arif @ 2020-10-08 18:11 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, Sarosh Arif

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>
---
v2:
display all speed capabilities in a single line
remove switch case
v3: 
add missing speeds
make a function for displaying speed capabilities
v4: 
make device_infos_display_speeds() function static
---
 app/test-pmd/config.c | 45 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 30bee3324..c3a4d8d5f 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,7 +558,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 +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);
+				speed_capa = dev_info.speed_capa;
+				device_infos_display_speeds(speed_capa);
 				printf("\n");
 			}
 		}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [dpdk-dev] [PATCH v5] testpmd: add speed capability in device info
  2020-09-28 10:01 ` [dpdk-dev] [PATCH v2] " Sarosh Arif
                     ` (2 preceding siblings ...)
  2020-10-08 18:11   ` [dpdk-dev] [PATCH v4] " Sarosh Arif
@ 2020-10-08 18:25   ` Sarosh Arif
  2020-10-09  9:27     ` Ferruh Yigit
  3 siblings, 1 reply; 14+ messages in thread
From: Sarosh Arif @ 2020-10-08 18:25 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, Sarosh Arif

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 | 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)
+					device_infos_display_speeds(dev_info.speed_capa);
 				printf("\n");
 			}
 		}
-- 
2.25.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH v5] testpmd: add speed capability in device info
  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
  0 siblings, 1 reply; 14+ messages in thread
From: Ferruh Yigit @ 2020-10-09  9:27 UTC (permalink / raw)
  To: Sarosh Arif; +Cc: 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 <sarosh.arif@emumba.com>
> ---
>   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 <ferruh.yigit@intel.com>

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [dpdk-dev] [PATCH v5] testpmd: add speed capability in device info
  2020-10-09  9:27     ` Ferruh Yigit
@ 2020-10-09 11:53       ` Ferruh Yigit
  0 siblings, 0 replies; 14+ messages in thread
From: Ferruh Yigit @ 2020-10-09 11:53 UTC (permalink / raw)
  To: Sarosh Arif; +Cc: dev

On 10/9/2020 10:27 AM, Ferruh Yigit wrote:
> 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 <sarosh.arif@emumba.com>
>
> Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
 >

Applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2020-10-09 11:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04  6:23 [dpdk-dev] [PATCH] testpmd: add speed capability in device info 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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).