From: Sarosh Arif <sarosh.arif@emumba.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, Sarosh Arif <sarosh.arif@emumba.com>
Subject: [dpdk-dev] [PATCH] testpmd: add speed capability in device info
Date: Fri, 4 Sep 2020 11:23:39 +0500 [thread overview]
Message-ID: <20200904062339.77430-1-sarosh.arif@emumba.com> (raw)
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
next reply other threads:[~2020-09-04 6:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-04 6:23 Sarosh Arif [this message]
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
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=20200904062339.77430-1-sarosh.arif@emumba.com \
--to=sarosh.arif@emumba.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).