From f6eb39384933a69a5725c01447faeb903e670cb5 Mon Sep 17 00:00:00 2001 From: Asaf Penso Date: Wed, 6 May 2020 12:22:08 +0000 Subject: [PATCH] ethdev: add 200G link speed There is no way to report back a link speed of 200Gbps. Adding 200G link speed. Signed-off-by: Asaf Penso Reviewed-by: Ferruh Yigit --- app/test-pmd/cmdline.c | 12 +++++++----- doc/guides/rel_notes/release_20_05.rst | 2 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +- lib/librte_ethdev/rte_ethdev.c | 2 ++ lib/librte_ethdev/rte_ethdev.h | 2 ++ 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index bcf9080c48..b040630c54 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -769,7 +769,7 @@ static void cmd_help_long_parsed(void *parsed_result, " Detach physical or virtual dev by port_id\n\n" "port config (port_id|all)" - " speed (10|100|1000|10000|25000|40000|50000|100000|auto)" + " speed (10|100|1000|10000|25000|40000|50000|100000|200000|auto)" " duplex (half|full|auto)\n" " Set speed and duplex for all ports or port_id\n\n" @@ -1623,6 +1623,8 @@ parse_and_check_speed_duplex(char *speedstr, char *duplexstr, uint32_t *speed) *speed = ETH_LINK_SPEED_50G; } else if (!strcmp(speedstr, "100000")) { *speed = ETH_LINK_SPEED_100G; + } else if (!strcmp(speedstr, "200000")) { + *speed = ETH_LINK_SPEED_200G; } else if (!strcmp(speedstr, "auto")) { *speed = ETH_LINK_SPEED_AUTONEG; } else { @@ -1670,7 +1672,7 @@ cmdline_parse_token_string_t cmd_config_speed_all_item1 = TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all, item1, "speed"); cmdline_parse_token_string_t cmd_config_speed_all_value1 = TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all, value1, - "10#100#1000#10000#25000#40000#50000#100000#auto"); + "10#100#1000#10000#25000#40000#50000#100000#200000#auto"); cmdline_parse_token_string_t cmd_config_speed_all_item2 = TOKEN_STRING_INITIALIZER(struct cmd_config_speed_all, item2, "duplex"); cmdline_parse_token_string_t cmd_config_speed_all_value2 = @@ -1681,7 +1683,7 @@ cmdline_parse_inst_t cmd_config_speed_all = { .f = cmd_config_speed_all_parsed, .data = NULL, .help_str = "port config all speed " - "10|100|1000|10000|25000|40000|50000|100000|auto duplex " + "10|100|1000|10000|25000|40000|50000|100000|200000|auto duplex " "half|full|auto", .tokens = { (void *)&cmd_config_speed_all_port, @@ -1745,7 +1747,7 @@ cmdline_parse_token_string_t cmd_config_speed_specific_item1 = "speed"); cmdline_parse_token_string_t cmd_config_speed_specific_value1 = TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific, value1, - "10#100#1000#10000#25000#40000#50000#100000#auto"); + "10#100#1000#10000#25000#40000#50000#100000#200000#auto"); cmdline_parse_token_string_t cmd_config_speed_specific_item2 = TOKEN_STRING_INITIALIZER(struct cmd_config_speed_specific, item2, "duplex"); @@ -1757,7 +1759,7 @@ cmdline_parse_inst_t cmd_config_speed_specific = { .f = cmd_config_speed_specific_parsed, .data = NULL, .help_str = "port config speed " - "10|100|1000|10000|25000|40000|50000|100000|auto duplex " + "10|100|1000|10000|25000|40000|50000|100000|200000|auto duplex " "half|full|auto", .tokens = { (void *)&cmd_config_speed_specific_port, diff --git a/doc/guides/rel_notes/release_20_05.rst b/doc/guides/rel_notes/release_20_05.rst index 0fa39eaddf..1eb05c73e9 100644 --- a/doc/guides/rel_notes/release_20_05.rst +++ b/doc/guides/rel_notes/release_20_05.rst @@ -93,6 +93,8 @@ New Features * Added new query: ``rte_flow_get_aged_flows`` to get the aged-out flows contexts from the port. +* **ethdev: Added a new value to link speed for 200Gbps** + * **Updated Amazon ena driver.** Updated ena PMD with new features and improvements, including: diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 581cd45ebb..3ded179ee7 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2153,7 +2153,7 @@ port config - speed Set the speed and duplex mode for all ports or a specific port:: - testpmd> port config (port_id|all) speed (10|100|1000|10000|25000|40000|50000|100000|auto) \ + testpmd> port config (port_id|all) speed (10|100|1000|10000|25000|40000|50000|100000|200000|auto) \ duplex (half|full|auto) port config - queues/descriptors diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 74e94feb0a..8e10a6fc36 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1100,6 +1100,8 @@ rte_eth_speed_bitflag(uint32_t speed, int duplex) return ETH_LINK_SPEED_56G; case ETH_SPEED_NUM_100G: return ETH_LINK_SPEED_100G; + case ETH_SPEED_NUM_200G: + return ETH_LINK_SPEED_200G; default: return 0; } diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h index 0f6d0530dd..a49242bcd2 100644 --- a/lib/librte_ethdev/rte_ethdev.h +++ b/lib/librte_ethdev/rte_ethdev.h @@ -284,6 +284,7 @@ struct rte_eth_stats { #define ETH_LINK_SPEED_50G (1 << 12) /**< 50 Gbps */ #define ETH_LINK_SPEED_56G (1 << 13) /**< 56 Gbps */ #define ETH_LINK_SPEED_100G (1 << 14) /**< 100 Gbps */ +#define ETH_LINK_SPEED_200G (1 << 15) /**< 200 Gbps */ /** * Ethernet numeric link speeds in Mbps @@ -301,6 +302,7 @@ struct rte_eth_stats { #define ETH_SPEED_NUM_50G 50000 /**< 50 Gbps */ #define ETH_SPEED_NUM_56G 56000 /**< 56 Gbps */ #define ETH_SPEED_NUM_100G 100000 /**< 100 Gbps */ +#define ETH_SPEED_NUM_200G 200000 /**< 200 Gbps */ /** * A structure used to retrieve link-level information of an Ethernet port. -- 2.20.1