From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
Jerin Jacob <jerinj@marvell.com>,
Ajit Khaparde <ajit.khaparde@broadcom.com>,
Raslan Darawsheh <rasland@nvidia.com>,
David Marchand <david.marchand@redhat.com>,
Aman Singh <aman.deep.singh@intel.com>,
Yuying Zhang <yuying.zhang@intel.com>,
Ferruh Yigit <ferruh.yigit@amd.com>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
Maxime Coquelin <maxime.coquelin@redhat.com>,
Chenbo Xia <chenbo.xia@intel.com>
Subject: [PATCH] ethdev: add link speed 400G
Date: Thu, 16 Feb 2023 11:43:50 +0100 [thread overview]
Message-ID: <20230216104350.1639394-1-thomas@monjalon.net> (raw)
There are some devices supporting 400G speed,
and it is well standardized in IEEE.
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
app/test-pmd/cmdline.c | 2 ++
app/test-pmd/config.c | 2 ++
app/test-pmd/parameters.c | 3 +++
app/test/test_ethdev_link.c | 3 ++-
drivers/net/virtio/virtio_ethdev.c | 2 ++
lib/ethdev/rte_ethdev.c | 6 ++++++
lib/ethdev/rte_ethdev.h | 2 ++
7 files changed, 19 insertions(+), 1 deletion(-)
diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c
index bb7ff2b449..e312aa93d6 100644
--- a/app/test-pmd/cmdline.c
+++ b/app/test-pmd/cmdline.c
@@ -1352,6 +1352,8 @@ parse_and_check_speed_duplex(char *speedstr, char *duplexstr, uint32_t *speed)
*speed = RTE_ETH_LINK_SPEED_100G;
} else if (!strcmp(speedstr, "200000")) {
*speed = RTE_ETH_LINK_SPEED_200G;
+ } else if (!strcmp(speedstr, "400000")) {
+ *speed = RTE_ETH_LINK_SPEED_400G;
} else if (!strcmp(speedstr, "auto")) {
*speed = RTE_ETH_LINK_SPEED_AUTONEG;
} else {
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index 41484c3dde..8f162645ec 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -612,6 +612,8 @@ device_infos_display_speeds(uint32_t speed_capa)
printf(" 100 Gbps ");
if (speed_capa & RTE_ETH_LINK_SPEED_200G)
printf(" 200 Gbps ");
+ if (speed_capa & RTE_ETH_LINK_SPEED_400G)
+ printf(" 400 Gbps ");
}
void
diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c
index e734ad9a02..3b37809baf 100644
--- a/app/test-pmd/parameters.c
+++ b/app/test-pmd/parameters.c
@@ -568,6 +568,9 @@ parse_link_speed(int n)
case 200000:
speed |= RTE_ETH_LINK_SPEED_200G;
break;
+ case 400000:
+ speed |= RTE_ETH_LINK_SPEED_400G;
+ break;
case 100:
case 10:
default:
diff --git a/app/test/test_ethdev_link.c b/app/test/test_ethdev_link.c
index 6248aea49a..ab52385a12 100644
--- a/app/test/test_ethdev_link.c
+++ b/app/test/test_ethdev_link.c
@@ -54,7 +54,7 @@ test_link_status_up_default(void)
"string with HDX");
/* test max str len */
- link_status.link_speed = RTE_ETH_SPEED_NUM_200G;
+ link_status.link_speed = RTE_ETH_SPEED_NUM_400G;
link_status.link_duplex = RTE_ETH_LINK_HALF_DUPLEX;
link_status.link_autoneg = RTE_ETH_LINK_AUTONEG;
ret = rte_eth_link_to_str(text, sizeof(text), &link_status);
@@ -130,6 +130,7 @@ test_link_speed_all_values(void)
{ "56 Gbps", RTE_ETH_SPEED_NUM_56G },
{ "100 Gbps", RTE_ETH_SPEED_NUM_100G },
{ "200 Gbps", RTE_ETH_SPEED_NUM_200G },
+ { "400 Gbps", RTE_ETH_SPEED_NUM_400G },
{ "Unknown", RTE_ETH_SPEED_NUM_UNKNOWN },
{ "Invalid", 50505 }
};
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 0103d95920..dc6856d749 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -2046,6 +2046,8 @@ virtio_dev_speed_capa_get(uint32_t speed)
return RTE_ETH_LINK_SPEED_100G;
case RTE_ETH_SPEED_NUM_200G:
return RTE_ETH_LINK_SPEED_200G;
+ case RTE_ETH_SPEED_NUM_400G:
+ return RTE_ETH_LINK_SPEED_400G;
default:
return 0;
}
diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
index 055c46082b..27c0ecbf7d 100644
--- a/lib/ethdev/rte_ethdev.c
+++ b/lib/ethdev/rte_ethdev.c
@@ -978,6 +978,9 @@ rte_eth_speed_bitflag(uint32_t speed, int duplex)
case RTE_ETH_SPEED_NUM_200G:
ret = RTE_ETH_LINK_SPEED_200G;
break;
+ case RTE_ETH_SPEED_NUM_400G:
+ ret = RTE_ETH_LINK_SPEED_400G;
+ break;
default:
ret = 0;
}
@@ -2882,6 +2885,9 @@ rte_eth_link_speed_to_str(uint32_t link_speed)
case RTE_ETH_SPEED_NUM_200G:
ret = "200 Gbps";
break;
+ case RTE_ETH_SPEED_NUM_400G:
+ ret = "400 Gbps";
+ break;
case RTE_ETH_SPEED_NUM_UNKNOWN:
ret = "Unknown";
break;
diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h
index c129ca1eaf..89b25c9a0f 100644
--- a/lib/ethdev/rte_ethdev.h
+++ b/lib/ethdev/rte_ethdev.h
@@ -304,6 +304,7 @@ struct rte_eth_stats {
#define RTE_ETH_LINK_SPEED_56G RTE_BIT32(13) /**< 56 Gbps */
#define RTE_ETH_LINK_SPEED_100G RTE_BIT32(14) /**< 100 Gbps */
#define RTE_ETH_LINK_SPEED_200G RTE_BIT32(15) /**< 200 Gbps */
+#define RTE_ETH_LINK_SPEED_400G RTE_BIT32(16) /**< 400 Gbps */
/**@}*/
/**@{@name Link speed
@@ -323,6 +324,7 @@ struct rte_eth_stats {
#define RTE_ETH_SPEED_NUM_56G 56000 /**< 56 Gbps */
#define RTE_ETH_SPEED_NUM_100G 100000 /**< 100 Gbps */
#define RTE_ETH_SPEED_NUM_200G 200000 /**< 200 Gbps */
+#define RTE_ETH_SPEED_NUM_400G 400000 /**< 400 Gbps */
#define RTE_ETH_SPEED_NUM_UNKNOWN UINT32_MAX /**< Unknown */
/**@}*/
--
2.39.1
next reply other threads:[~2023-02-16 10:44 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-16 10:43 Thomas Monjalon [this message]
2023-02-16 10:49 ` Morten Brørup
2023-02-16 11:23 ` Andrew Rybchenko
2023-02-16 11:27 ` fengchengwen
2023-02-16 12:30 ` Ferruh Yigit
2023-02-16 23:56 ` Thomas Monjalon
2023-03-01 11:16 ` [PATCH v2] " Thomas Monjalon
2023-03-01 14:50 ` Ajit Khaparde
2023-03-02 8:58 ` 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=20230216104350.1639394-1-thomas@monjalon.net \
--to=thomas@monjalon.net \
--cc=ajit.khaparde@broadcom.com \
--cc=aman.deep.singh@intel.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=bruce.richardson@intel.com \
--cc=chenbo.xia@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=jerinj@marvell.com \
--cc=maxime.coquelin@redhat.com \
--cc=rasland@nvidia.com \
--cc=yuying.zhang@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).