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

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

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