ethdev: add Forward Error Correction support
PATCH v14 3/3 app/testpmd: add FEC command
In reply to Min Hu (Connor)This commit adds testpmd capability to query and config FEC function of device. This includes:
- show FEC capabilities, example:
testpmd> show port 0 fec capabilities
- show FEC mode, example:
testpmd> show port 0 fec_mode
- config FEC mode, example:
testpmd> set port <port_id> 0 <auto|off|rs|baser>
where:
auto|off|rs|baser are four kinds of FEC mode which dev support according to MAC link speed.
---v12->v13:
change fec get capa interface.
---v10->v11:
change mode to capa bitmask.
---v8->v9:
added acked-by.
---v6->v7:
used RTE_DIM(fec_mode_name) instead of RTE_ETH_FEC_NUM
---v5->v6:
fixed code styles according to DPDK coding style. added _eth prefix.
---v4->v5:
Add RTE_ prefix for public FEC mode enum.
---v3->v4:
adjust the display format of FEC mode
---v2->v3:
adjust the display format of FEC capability.
--- app/test-pmd/cmdline.c | 223 +++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 91 ++++++++++++++++++++ app/test-pmd/testpmd.h | 2 + 3 files changed, 316 insertions(+)
app/test-pmd/cmdline.c +223 -0
@@ -19161,6 +19161,226 @@ cmdline_parse_inst_t cmd_show_tx_metadata = { }, }; +/* *** show fec capability per port configuration *** */ +struct cmd_show_fec_capability_result { +cmdline_fixed_string_t cmd_show; +cmdline_fixed_string_t cmd_port; +cmdline_fixed_string_t cmd_fec; +cmdline_fixed_string_t cmd_keyword; +portid_t cmd_pid; +}; + +static void +cmd_show_fec_capability_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +#define FEC_CAP_NUM 2 +struct cmd_show_fec_capability_result *res = parsed_result; +struct rte_eth_fec_capa speed_fec_capa[FEC_CAP_NUM ]; +unsigned int num =FEC_CAP_NUM ; +unsigned int ret_num; +int ret; + +if (!rte_eth_dev_is_valid_port (res->cmd_pid)) { +printf ("Invalid port id %u\n" , res->cmd_pid); +return ; + } + + ret =rte_eth_fec_get_capability (res->cmd_pid, speed_fec_capa, num); +if (ret == -ENOTSUP ) { +printf ("Function not implemented\n" ); +return ; + }else if (ret <0 ) { +printf ("Get FEC capability failed\n" ); +return ; + } + + ret_num = (unsigned int )ret; +show_fec_capability (ret_num, speed_fec_capa); +} + +cmdline_parse_token_string_t cmd_show_fec_capability_show = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_show,"show" ); +cmdline_parse_token_string_t cmd_show_fec_capability_port = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_port,"port" ); +cmdline_parse_token_num_t cmd_show_fec_capability_pid = + TOKEN_NUM_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_pid,UINT16 ); +cmdline_parse_token_string_t cmd_show_fec_capability_fec = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_fec,"fec" ); +cmdline_parse_token_string_t cmd_show_fec_capability_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_keyword,"capabilities" ); + +cmdline_parse_inst_t cmd_show_capability = { + .f = cmd_show_fec_capability_parsed, + .data =NULL , + .help_str ="show port <port_id> fec capabilities" , + .tokens = { + (void *)&cmd_show_fec_capability_show, + (void *)&cmd_show_fec_capability_port, + (void *)&cmd_show_fec_capability_pid, + (void *)&cmd_show_fec_capability_fec, + (void *)&cmd_show_fec_capability_keyword, +NULL , + }, +}; + +/* *** show fec mode per port configuration *** */ +struct cmd_show_fec_metadata_result { +cmdline_fixed_string_t cmd_show; +cmdline_fixed_string_t cmd_port; +cmdline_fixed_string_t cmd_keyword; +portid_t cmd_pid; +}; + +static void +cmd_show_fec_mode_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +#define FEC_NAME_SIZE 16 +struct cmd_show_fec_metadata_result *res = parsed_result; +uint32_t mode; +char buf[FEC_NAME_SIZE ]; +int ret; + +if (!rte_eth_dev_is_valid_port (res->cmd_pid)) { +printf ("Invalid port id %u\n" , res->cmd_pid); +return ; + } + ret =rte_eth_fec_get (res->cmd_pid, &mode); +if (ret == -ENOTSUP ) { +printf ("Function not implemented\n" ); +return ; + }else if (ret <0 ) { +printf ("Get FEC mode failed\n" ); +return ; + } + +switch (mode) { +case RTE_ETH_FEC_MODE_CAPA_MASK (NOFEC ): +strlcpy (buf,"off" ,sizeof (buf)); +break ; +case RTE_ETH_FEC_MODE_CAPA_MASK (AUTO ): +strlcpy (buf,"auto" ,sizeof (buf)); +break ; +case RTE_ETH_FEC_MODE_CAPA_MASK (BASER ): +strlcpy (buf,"baser" ,sizeof (buf)); +break ; +case RTE_ETH_FEC_MODE_CAPA_MASK (RS ): +strlcpy (buf,"rs" ,sizeof (buf)); +break ; +default : +return ; + } + +printf ("%s\n" , buf); +} + +cmdline_parse_token_string_t cmd_show_fec_mode_show = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_show,"show" ); +cmdline_parse_token_string_t cmd_show_fec_mode_port = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_port,"port" ); +cmdline_parse_token_num_t cmd_show_fec_mode_pid = + TOKEN_NUM_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_pid,UINT16 ); +cmdline_parse_token_string_t cmd_show_fec_mode_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_keyword,"fec_mode" ); + +cmdline_parse_inst_t cmd_show_fec_mode = { + .f = cmd_show_fec_mode_parsed, + .data =NULL , + .help_str ="show port <port_id> fec_mode" , + .tokens = { + (void *)&cmd_show_fec_mode_show, + (void *)&cmd_show_fec_mode_port, + (void *)&cmd_show_fec_mode_pid, + (void *)&cmd_show_fec_mode_keyword, +NULL , + }, +}; + +/* *** set fec mode per port configuration *** */ +struct cmd_set_port_fec_mode { +cmdline_fixed_string_t set; +cmdline_fixed_string_t port; +portid_t port_id; +cmdline_fixed_string_t fec_mode; +cmdline_fixed_string_t fec_value; +}; + +/* Common CLI fields for set fec mode */ +cmdline_parse_token_string_t cmd_set_port_fec_mode_set = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + set,"set" ); +cmdline_parse_token_string_t cmd_set_port_fec_mode_port = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + port,"port" ); +cmdline_parse_token_num_t cmd_set_port_fec_mode_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_port_fec_mode, + port_id,UINT16 ); +cmdline_parse_token_string_t cmd_set_port_fec_mode_str = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + fec_mode,"fec_mode" ); +cmdline_parse_token_string_t cmd_set_port_fec_mode_value = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + fec_value,NULL ); + +static void +cmd_set_port_fec_mode_parsed ( +void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_port_fec_mode *res = parsed_result; +uint16_t port_id = res->port_id; +uint32_t mode; +int ret; + + ret =parse_fec_mode (res->fec_value, &mode); +if (ret <0 ) { +printf ("Unknown fec mode: %s for Port %d\n" , res->fec_value, + port_id); +return ; + } + + ret =rte_eth_fec_set (port_id, mode); +if (ret == -ENOTSUP ) { +printf ("Function not implemented\n" ); +return ; + }else if (ret <0 ) { +printf ("Set FEC mode failed\n" ); +return ; + } +} + +cmdline_parse_inst_t cmd_set_fec_mode = { + .f = cmd_set_port_fec_mode_parsed, + .data =NULL , + .help_str ="set port <port_id> fec_mode <auto|off|rs|baser>" , + .tokens = { + (void *)&cmd_set_port_fec_mode_set, + (void *)&cmd_set_port_fec_mode_port, + (void *)&cmd_set_port_fec_mode_port_id, + (void *)&cmd_set_port_fec_mode_str, + (void *)&cmd_set_port_fec_mode_value, +NULL , + }, +}; +/* show port supported ptypes */ /* Common result structure for show port ptypes */
@@ -19795,6 +20015,9 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_show_set_raw, (cmdline_parse_inst_t *)&cmd_show_set_raw_all, (cmdline_parse_inst_t *)&cmd_config_tx_dynf_specific, + (cmdline_parse_inst_t *)&cmd_show_fec_mode, + (cmdline_parse_inst_t *)&cmd_set_fec_mode, + (cmdline_parse_inst_t *)&cmd_show_capability, NULL, };
app/test-pmd/config.c +91 -0
103 lines not on this page · raw message
app/test-pmd/testpmd.h +2 -0
@@ -804,6 +804,8 @@ void show_tx_pkt_segments(void);void set_tx_pkt_times (unsigned int *tx_times);void show_tx_pkt_times (void );void set_tx_pkt_split (const char *name); +int parse_fec_mode (const char *name,enum rte_eth_fec_mode *mode); +void show_fec_capability (uint32_t num,struct rte_eth_fec_capa *speed_fec_capa);void set_nb_pkt_per_burst (uint16_t pkt_burst);char *list_pkt_forwarding_modes (void );char *list_pkt_forwarding_retry_modes (void );
Signature · 1 line
2.7.4
v15 cover add FEC support
In reply to Min Hu (Connor)This series add FEC support for ethdev.
Min Hu (Connor) (3):
ethdev: introduce FEC API
net/hns3: support FEC
app/testpmd: add FEC command
app/test-pmd/cmdline.c | 223 +++++++++++++++++++ app/test-pmd/config.c | 91 ++++++++ app/test-pmd/testpmd.h | 2 + doc/guides/rel_notes/release_20_11.rst | 10 + drivers/net/hns3/hns3_cmd.h | 19 +- drivers/net/hns3/hns3_ethdev.c | 356 +++++++++++++++++++++++++++++++ drivers/net/hns3/hns3_ethdev.h | 1 + lib/librte_ethdev/rte_ethdev.c | 44 ++++ lib/librte_ethdev/rte_ethdev.h | 105 +++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 88 ++++++++ lib/librte_ethdev/rte_ethdev_version.map | 3 + 11 files changed, 941 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
PATCH v15 1/3 ethdev: introduce FEC API
This patch adds Forward error correction(FEC) support for ethdev. Introduce APIs which support query and config FEC information in hardware.
---v14->v15:
change mode to fec_capa in fec set API.
---v13->v14:
change mode to fec_capa.
fix comment about API.
---v12->v13:
change fec get capa API.
fix comment styles.
---v10->v11:
allow to report capabilities per link speed.
specify what should be reported if link is down
when get FEC.
change mode to capa bitmask.
---v9->v10:
add macro RTE_ETH_FEC_MODE_CAPA_MASK(x) to indicate different FEC mode capa.
---v8->v9:
added reviewed-by and acked-by.
---v7->v8:
put AUTO just after NOFEC in rte_fec_mode definition.
---v6->v7:
deleted RTE_ETH_FEC_NUM to prevent ABI breakage. add new macro to indicate translation from fec mode to capa.
---v5->v6:
modified release notes.
deleted check duplicated for FEC API
fixed code styles according to DPDK coding style.
added _eth prefix.
---v4->v5:
Modifies FEC capa definitions using macros.
Add RTE_ prefix for public FEC mode enum.
add release notes about FEC for dpdk20_11.
---v2->v3:
add function return value "-ENOTSUP" for API.
--- doc/guides/rel_notes/release_20_11.rst | 5 ++ lib/librte_ethdev/rte_ethdev.c | 44 +++++++++++++ lib/librte_ethdev/rte_ethdev.h | 105 +++++++++++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 88 ++++++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_version.map | 3 + 5 files changed, 245 insertions(+)
doc/guides/rel_notes/release_20_11.rst +5 -0
@@ -78,6 +78,11 @@ New Features ``--portmask=N`` where N represents the hexadecimal bitmask of ports used. +* **Added the FEC API, for a generic FEC query and config.** + + Added the FEC API which provides functions for query FEC capabilities and + current FEC mode from device. Also, API for configuring FEC mode is also provided. + Removed Items -------------
lib/librte_ethdev/rte_ethdev.c +44 -0
50 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev.h +105 -0
117 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev_driver.h +88 -0
100 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev_version.map +3 -0
@@ -229,6 +229,9 @@ EXPERIMENTAL { # added in 20.11 rte_eth_link_speed_to_str; rte_eth_link_to_str; + rte_eth_fec_get_capability; + rte_eth_fec_get; + rte_eth_fec_set; }; INTERNAL {
Signature · 1 line
2.7.4
Re: [dpdk-dev] [PATCH V15 1/3] ethdev: introduce FEC API
Quoted 10 lines · Min Hu (Connor)
This patch adds Forward error correction(FEC) support for ethdev. Introduce APIs which support query and config FEC information in hardware.
Signed-off-by Min Hu (Connor) <[email protected]>Reviewed-by Wei Hu (Xavier) <[email protected]>Reviewed-by Chengwen Feng <[email protected]>Reviewed-by Chengchang Tang <[email protected]>Acked-by Andrew Rybchenko <[email protected]>
Quoted 2 lines
Re: [dpdk-dev] [PATCH V15 1/3] ethdev: introduce FEC API
Thank Ajit.
Hi, all,
Are there any suggestions for this set of patches? I wish this patch can be merged into 20.11,and this is urget. Please gives reply to me, thanks.
Quoted 23 lines · Ajit Khaparde
On Mon, Sep 28, 2020 at 6:06 PM Min Hu (Connor) <[email protected] <mailto:[email protected]>> wrote:
This patch adds Forward error correction(FEC) support for ethdev. Introduce APIs which support query and config FEC information in hardware.
Signed-off-by Min Hu (Connor) <[email protected]<mailto:[email protected]>>
Reviewed-by Wei Hu (Xavier) <[email protected]<mailto:[email protected]>>
Reviewed-by Chengwen Feng <[email protected]<mailto:[email protected]>>
Reviewed-by Chengchang Tang <[email protected]<mailto:[email protected]>>
Acked-by Andrew Rybchenko <[email protected]<mailto:[email protected]>>
Reviewed-by Ajit Khaparde <[email protected] <mailto:[email protected]>>
Re: [dpdk-dev] [PATCH V15 1/3] ethdev: introduce FEC API
Hi, all,
Are there any suggestions for this set of patches? I wish this patch can be merged into V20.11,and this is urgent. I only have one day to handle the patches, because from 10/1 to 10/8 we will be on holiday.
Please give reply to me, thanks.
Quoted 36 lines · Min Hu (Connor)
Thank Ajit.
Hi, all,
Are there any suggestions for this set of patches? I wish this patch can be merged into 20.11,and this is urget. Please gives reply to me, thanks.Quoted 12 lines · Ajit Khaparde
On Mon, Sep 28, 2020 at 6:06 PM Min Hu (Connor) <[email protected] <mailto:[email protected]>> wrote:
This patch adds Forward error correction(FEC) support for ethdev. Introduce APIs which support query and config FEC information in hardware.
Signed-off-by Min Hu (Connor) <[email protected]<mailto:[email protected]>>
Reviewed-by Wei Hu (Xavier) <[email protected]<mailto:[email protected]>>
Quoted 11 lines
Reviewed-by Chengwen Feng <[email protected]<mailto:[email protected]>>
Reviewed-by Chengchang Tang <[email protected]<mailto:[email protected]>>
Acked-by Andrew Rybchenko <[email protected]<mailto:[email protected]>>
Reviewed-by Ajit Khaparde <[email protected] <mailto:[email protected]>>_______________________________________________
Linuxarm mailing list
[email protected]
http://hulk.huawei.com/mailman/listinfo/linuxarm
Re: [dpdk-dev] [PATCH V15 1/3] ethdev: introduce FEC API
In reply to Min Hu (Connor)29/09/2020 10:44, Min Hu (Connor):
Quoted 4 lines
Hi, all,
Are there any suggestions for this set of patches? I wish this patch can be merged into 20.11,and this is urget. Please gives reply to me, thanks.
We all have urgent tasks to complete.
Please help by reviewing some other patches.
Re: [dpdk-dev] [PATCH V15 1/3] ethdev: introduce FEC API
In reply to Min Hu (Connor)Quoted 9 lines · Min Hu (Connor)
This patch adds Forward error correction(FEC) support for ethdev. Introduce APIs which support query and config FEC information in hardware.
Signed-off-by Min Hu (Connor) <[email protected]>Reviewed-by Wei Hu (Xavier) <[email protected]>Reviewed-by Chengwen Feng <[email protected]>Reviewed-by Chengchang Tang <[email protected]>Acked-by Andrew Rybchenko <[email protected]>
I confirm that it LGTM. However, I'd be happy if soneone else reread descriptions with fresh look. Thanks.
PATCH v15 2/3 net/hns3: support FEC
In reply to Min Hu (Connor)Forward error correction (FEC) is a bit error correction mode. It adds error correction information to data packets at the transmit end, and uses the error correction information to correct the bit errors generated during data packet transmission at the receive end. This improves signal quality but also brings a delay to signals. This function can be enabled or disabled as required.
This patch adds FEC support for ethdev.Introduce ethdev operations which support query and config FEC information in hardware.
---v13->v14:
change mode to fec_capa.
---v12->v13:
change fec get capa interface.
---v11->v12:
fix coding warning.
v10->v11:
allow to report capabilities per link speed.
specify what should be reported if link is down
when get FEC.
change mode to capa bitmask.
---v9->v10:
use RTE_ETH_FEC_MODE_CAPA_MASK(x) which is just defined.
---v7->v8:
FEC mode order defined in hns3 hardware is inconsistend with that defined in the ethdev library. So the sequence needs to be converted.
---v5->v6:
fixed code styles according to DPDK coding style.
added _eth prefix.
---v4->v5:
Data type for fec_cap is changed from uint8_t
to uint32_t for possible future expansion.
---v2->v3:
adjust the return value of function.
--- doc/guides/rel_notes/release_20_11.rst | 5 + drivers/net/hns3/hns3_cmd.h | 19 +- drivers/net/hns3/hns3_ethdev.c | 356 +++++++++++++++++++++++++++++++++ drivers/net/hns3/hns3_ethdev.h | 1 + 4 files changed, 380 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_20_11.rst +5 -0
@@ -83,6 +83,11 @@ New Features Added the FEC API which provides functions for query FEC capabilities and current FEC mode from device. Also, API for configuring FEC mode is also provided. +* **Added hns3 FEC PMD, for supporting query and config FEC mode.** + + Added the FEC PMD which provides functions for query FEC capabilities and + current FEC mode from device. Also, PMD for configuring FEC mode is also provided. + Removed Items -------------
drivers/net/hns3/hns3_cmd.h +18 -1
@@ -100,6 +100,7 @@ enum hns3_opcode_type {HNS3_OPC_QUERY_LINK_STATUS =0x0307 ,HNS3_OPC_CONFIG_MAX_FRM_SIZE =0x0308 ,HNS3_OPC_CONFIG_SPEED_DUP =0x0309 , +HNS3_OPC_CONFIG_FEC_MODE =0x031A ,/* PFC/Pause commands */ HNS3_OPC_CFG_MAC_PAUSE_EN = 0x0701,
@@ -684,9 +685,25 @@ struct hns3_config_auto_neg_cmd {uint8_t rsv[20 ]; }; +#define HNS3_MAC_CFG_FEC_AUTO_EN_B 0 +#define HNS3_MAC_CFG_FEC_MODE_S 1 +#define HNS3_MAC_CFG_FEC_MODE_M GENMASK(3, 1) +#define HNS3_MAC_FEC_OFF 0 +#define HNS3_MAC_FEC_BASER 1 +#define HNS3_MAC_FEC_RS 2 +struct hns3_sfp_speed_cmd {uint32_t sfp_speed; -uint32_t rsv[5 ]; +uint8_t query_type;/* 0: sfp speed, 1: active fec */ +uint8_t active_fec;/* current FEC mode */ +uint16_t rsv1; +uint32_t rsv2[4 ]; +}; + +/* Configure FEC mode, opcode:0x031A */ +struct hns3_config_fec_cmd { +uint8_t fec_mode; +uint8_t rsv[23 ]; };#define HNS3_MAC_MGR_MASK_VLAN_B BIT(0)
drivers/net/hns3/hns3_ethdev.c +356 -0
398 lines not on this page · raw message
drivers/net/hns3/hns3_ethdev.h +1 -0
@@ -620,6 +620,7 @@ struct hns3_pf {struct hns3_err_msix_intr_stats abn_int_stats;bool support_sfp_query; +uint32_t fec_mode;/* current FEC mode for ethdev */ struct hns3_vtag_cfg vtag_config; LIST_HEAD(vlan_tbl, hns3_user_vlan_table) vlan_list;
Signature · 1 line
2.7.4
PATCH v15 3/3 app/testpmd: add FEC command
In reply to Min Hu (Connor)This commit adds testpmd capability to query and config FEC function of device. This includes:
- show FEC capabilities, example:
testpmd> show port 0 fec capabilities
- show FEC mode, example:
testpmd> show port 0 fec_mode
- config FEC mode, example:
testpmd> set port <port_id> 0 <auto|off|rs|baser>
where:
auto|off|rs|baser are four kinds of FEC mode which dev support according to MAC link speed.
---v12->v13:
change fec get capa interface.
---v10->v11:
change mode to capa bitmask.
---v8->v9:
added acked-by.
---v6->v7:
used RTE_DIM(fec_mode_name) instead of RTE_ETH_FEC_NUM
---v5->v6:
fixed code styles according to DPDK coding style. added _eth prefix.
---v4->v5:
Add RTE_ prefix for public FEC mode enum.
---v3->v4:
adjust the display format of FEC mode
---v2->v3:
adjust the display format of FEC capability.
--- app/test-pmd/cmdline.c | 223 +++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 91 ++++++++++++++++++++ app/test-pmd/testpmd.h | 2 + 3 files changed, 316 insertions(+)
app/test-pmd/cmdline.c +223 -0
@@ -19161,6 +19161,226 @@ cmdline_parse_inst_t cmd_show_tx_metadata = { }, }; +/* *** show fec capability per port configuration *** */ +struct cmd_show_fec_capability_result { +cmdline_fixed_string_t cmd_show; +cmdline_fixed_string_t cmd_port; +cmdline_fixed_string_t cmd_fec; +cmdline_fixed_string_t cmd_keyword; +portid_t cmd_pid; +}; + +static void +cmd_show_fec_capability_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +#define FEC_CAP_NUM 2 +struct cmd_show_fec_capability_result *res = parsed_result; +struct rte_eth_fec_capa speed_fec_capa[FEC_CAP_NUM ]; +unsigned int num =FEC_CAP_NUM ; +unsigned int ret_num; +int ret; + +if (!rte_eth_dev_is_valid_port (res->cmd_pid)) { +printf ("Invalid port id %u\n" , res->cmd_pid); +return ; + } + + ret =rte_eth_fec_get_capability (res->cmd_pid, speed_fec_capa, num); +if (ret == -ENOTSUP ) { +printf ("Function not implemented\n" ); +return ; + }else if (ret <0 ) { +printf ("Get FEC capability failed\n" ); +return ; + } + + ret_num = (unsigned int )ret; +show_fec_capability (ret_num, speed_fec_capa); +} + +cmdline_parse_token_string_t cmd_show_fec_capability_show = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_show,"show" ); +cmdline_parse_token_string_t cmd_show_fec_capability_port = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_port,"port" ); +cmdline_parse_token_num_t cmd_show_fec_capability_pid = + TOKEN_NUM_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_pid,UINT16 ); +cmdline_parse_token_string_t cmd_show_fec_capability_fec = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_fec,"fec" ); +cmdline_parse_token_string_t cmd_show_fec_capability_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_keyword,"capabilities" ); + +cmdline_parse_inst_t cmd_show_capability = { + .f = cmd_show_fec_capability_parsed, + .data =NULL , + .help_str ="show port <port_id> fec capabilities" , + .tokens = { + (void *)&cmd_show_fec_capability_show, + (void *)&cmd_show_fec_capability_port, + (void *)&cmd_show_fec_capability_pid, + (void *)&cmd_show_fec_capability_fec, + (void *)&cmd_show_fec_capability_keyword, +NULL , + }, +}; + +/* *** show fec mode per port configuration *** */ +struct cmd_show_fec_metadata_result { +cmdline_fixed_string_t cmd_show; +cmdline_fixed_string_t cmd_port; +cmdline_fixed_string_t cmd_keyword; +portid_t cmd_pid; +}; + +static void +cmd_show_fec_mode_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +#define FEC_NAME_SIZE 16 +struct cmd_show_fec_metadata_result *res = parsed_result; +uint32_t mode; +char buf[FEC_NAME_SIZE ]; +int ret; + +if (!rte_eth_dev_is_valid_port (res->cmd_pid)) { +printf ("Invalid port id %u\n" , res->cmd_pid); +return ; + } + ret =rte_eth_fec_get (res->cmd_pid, &mode); +if (ret == -ENOTSUP ) { +printf ("Function not implemented\n" ); +return ; + }else if (ret <0 ) { +printf ("Get FEC mode failed\n" ); +return ; + } + +switch (mode) { +case RTE_ETH_FEC_MODE_CAPA_MASK (NOFEC ): +strlcpy (buf,"off" ,sizeof (buf)); +break ; +case RTE_ETH_FEC_MODE_CAPA_MASK (AUTO ): +strlcpy (buf,"auto" ,sizeof (buf)); +break ; +case RTE_ETH_FEC_MODE_CAPA_MASK (BASER ): +strlcpy (buf,"baser" ,sizeof (buf)); +break ; +case RTE_ETH_FEC_MODE_CAPA_MASK (RS ): +strlcpy (buf,"rs" ,sizeof (buf)); +break ; +default : +return ; + } + +printf ("%s\n" , buf); +} + +cmdline_parse_token_string_t cmd_show_fec_mode_show = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_show,"show" ); +cmdline_parse_token_string_t cmd_show_fec_mode_port = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_port,"port" ); +cmdline_parse_token_num_t cmd_show_fec_mode_pid = + TOKEN_NUM_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_pid,UINT16 ); +cmdline_parse_token_string_t cmd_show_fec_mode_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_keyword,"fec_mode" ); + +cmdline_parse_inst_t cmd_show_fec_mode = { + .f = cmd_show_fec_mode_parsed, + .data =NULL , + .help_str ="show port <port_id> fec_mode" , + .tokens = { + (void *)&cmd_show_fec_mode_show, + (void *)&cmd_show_fec_mode_port, + (void *)&cmd_show_fec_mode_pid, + (void *)&cmd_show_fec_mode_keyword, +NULL , + }, +}; + +/* *** set fec mode per port configuration *** */ +struct cmd_set_port_fec_mode { +cmdline_fixed_string_t set; +cmdline_fixed_string_t port; +portid_t port_id; +cmdline_fixed_string_t fec_mode; +cmdline_fixed_string_t fec_value; +}; + +/* Common CLI fields for set fec mode */ +cmdline_parse_token_string_t cmd_set_port_fec_mode_set = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + set,"set" ); +cmdline_parse_token_string_t cmd_set_port_fec_mode_port = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + port,"port" ); +cmdline_parse_token_num_t cmd_set_port_fec_mode_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_port_fec_mode, + port_id,UINT16 ); +cmdline_parse_token_string_t cmd_set_port_fec_mode_str = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + fec_mode,"fec_mode" ); +cmdline_parse_token_string_t cmd_set_port_fec_mode_value = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + fec_value,NULL ); + +static void +cmd_set_port_fec_mode_parsed ( +void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_port_fec_mode *res = parsed_result; +uint16_t port_id = res->port_id; +uint32_t mode; +int ret; + + ret =parse_fec_mode (res->fec_value, &mode); +if (ret <0 ) { +printf ("Unknown fec mode: %s for Port %d\n" , res->fec_value, + port_id); +return ; + } + + ret =rte_eth_fec_set (port_id, mode); +if (ret == -ENOTSUP ) { +printf ("Function not implemented\n" ); +return ; + }else if (ret <0 ) { +printf ("Set FEC mode failed\n" ); +return ; + } +} + +cmdline_parse_inst_t cmd_set_fec_mode = { + .f = cmd_set_port_fec_mode_parsed, + .data =NULL , + .help_str ="set port <port_id> fec_mode <auto|off|rs|baser>" , + .tokens = { + (void *)&cmd_set_port_fec_mode_set, + (void *)&cmd_set_port_fec_mode_port, + (void *)&cmd_set_port_fec_mode_port_id, + (void *)&cmd_set_port_fec_mode_str, + (void *)&cmd_set_port_fec_mode_value, +NULL , + }, +}; +/* show port supported ptypes */ /* Common result structure for show port ptypes */
@@ -19795,6 +20015,9 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_show_set_raw, (cmdline_parse_inst_t *)&cmd_show_set_raw_all, (cmdline_parse_inst_t *)&cmd_config_tx_dynf_specific, + (cmdline_parse_inst_t *)&cmd_show_fec_mode, + (cmdline_parse_inst_t *)&cmd_set_fec_mode, + (cmdline_parse_inst_t *)&cmd_show_capability, NULL, };
app/test-pmd/config.c +91 -0
103 lines not on this page · raw message
app/test-pmd/testpmd.h +2 -0
@@ -804,6 +804,8 @@ void show_tx_pkt_segments(void);void set_tx_pkt_times (unsigned int *tx_times);void show_tx_pkt_times (void );void set_tx_pkt_split (const char *name); +int parse_fec_mode (const char *name,enum rte_eth_fec_mode *mode); +void show_fec_capability (uint32_t num,struct rte_eth_fec_capa *speed_fec_capa);void set_nb_pkt_per_burst (uint16_t pkt_burst);char *list_pkt_forwarding_modes (void );char *list_pkt_forwarding_retry_modes (void );
Signature · 1 line
2.7.4
Re: [dpdk-dev] [PATCH V15 3/3] app/testpmd: add FEC command
Quoted 9 lines · Min Hu (Connor)
This commit adds testpmd capability to query and config FEC function of device. This includes:
- show FEC capabilities, example:
testpmd> show port 0 fec capabilities
- show FEC mode, example:
testpmd> show port 0fec_mode
- config FEC mode, example:
testpmd> set port <port_id> 0 <auto|off|rs|baser>
I guess it is:
set port <port_id> fec_mode <auto|off|rs|baser>
Quoted 42 lines
where:
auto|off|rs|baser are four kinds of FEC mode which dev support according to MAC link speed.
Signed-off-by Min Hu (Connor) <[email protected]>Reviewed-by Wei Hu (Xavier) <[email protected]>Reviewed-by Chengwen Feng <[email protected]>Reviewed-by Chengchang Tang <[email protected]>---
v12->v13:
change fec get capa interface.---
v10->v11:
change mode to capa bitmask.---
v8->v9:
added acked-by.---
v6->v7:
usedRTE_DIM(fec_mode_name)instead ofRTE_ETH_FEC_NUM---
v5->v6:
fixed code styles according to DPDK coding style. added_ethprefix.---
v4->v5:
AddRTE_prefix for public FEC mode enum.---
v3->v4:
adjust the display format of FEC mode---
v2->v3:
adjust the display format of FEC capability.
Quoted 5 lines
--- app/test-pmd/cmdline.c | 223 +++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 91 ++++++++++++++++++++ app/test-pmd/testpmd.h | 2 + 3 files changed, 316 insertions(+)
Can you please update the testpmd documenatation for the new commands?
Also can add the new command to the --help output? ('cmd_help_long_parsed()')
<...>
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_show_tx_metadata = { · line 19373
Quoted 4 lines
app/test-pmd/cmdline.c +4
-0+cmdline_parse_inst_t cmd_set_fec_mode = { + .f = cmd_set_port_fec_mode_parsed, + .data =NULL , + .help_str ="set port <port_id> fec_mode <auto|off|rs|baser>" ,
Can you please update the help string as:
"set port <port_id> fec_mode auto|off|rs|baser"
'<>' is to define the variable name, like in '<port_id>' you expect numbers like 0,1,2 .. but 'auto|off|rs|baser' are keywords, not variables.
Re: [dpdk-dev] [PATCH V15 3/3] app/testpmd: add FEC command
HI,Ferruh,
how about only considering the first patch:ethdev:add fec API. If this patch looks great to you, I wish it could be merged into 20.11.
To that patch, app/testpmd add fec command, I will fix it later.
thanks.
--------------------------------------------------
胡敏 Hu Min
Mobile: +86-13528728164<tel:+86-13528728164>
Email: [email protected]<mailto:[email protected]>
发件人:Ferruh Yigit <[email protected]>
收件人:humin (Q) <[email protected]>;dev <[email protected]>
抄 送:konstantin.ananyev <[email protected]>;thomas <[email protected]>;arybchenko <[email protected]>;Linuxarm <[email protected]> 时 间:2020-10-01 00:53:37
主 题:Re: [PATCH V15 3/3] app/testpmd: add FEC command
Quoted 9 lines · Min Hu (Connor)
This commit adds testpmd capability to query and config FEC function of device. This includes:
- show FEC capabilities, example:
testpmd> show port 0 fec capabilities
- show FEC mode, example:
testpmd> show port 0fec_mode
- config FEC mode, example:
testpmd> set port <port_id> 0 <auto|off|rs|baser>
I guess it is:
set port <port_id> fec_mode <auto|off|rs|baser>
Quoted 42 lines
where:
auto|off|rs|baser are four kinds of FEC mode which dev support according to MAC link speed.
Signed-off-by Min Hu (Connor) <[email protected]>Reviewed-by Wei Hu (Xavier) <[email protected]>Reviewed-by Chengwen Feng <[email protected]>Reviewed-by Chengchang Tang <[email protected]>---
v12->v13:
change fec get capa interface.---
v10->v11:
change mode to capa bitmask.---
v8->v9:
added acked-by.---
v6->v7:
usedRTE_DIM(fec_mode_name)instead ofRTE_ETH_FEC_NUM---
v5->v6:
fixed code styles according to DPDK coding style. added_ethprefix.---
v4->v5:
AddRTE_prefix for public FEC mode enum.---
v3->v4:
adjust the display format of FEC mode---
v2->v3:
adjust the display format of FEC capability.
Quoted 5 lines
--- app/test-pmd/cmdline.c | 223 +++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 91 ++++++++++++++++++++ app/test-pmd/testpmd.h | 2 + 3 files changed, 316 insertions(+)
Can you please update the testpmd documenatation for the new commands?
Also can add the new command to the --help output? ('cmd_help_long_parsed()')
<...>
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_show_tx_metadata = { · line 19373
Quoted 4 lines
app/test-pmd/cmdline.c +4
-0+cmdline_parse_inst_t cmd_set_fec_mode = { + .f = cmd_set_port_fec_mode_parsed, + .data =NULL , + .help_str ="set port <port_id> fec_mode <auto|off|rs|baser>" ,
Can you please update the help string as:
"set port <port_id> fec_mode auto|off|rs|baser"
'<>' is to define the variable name, like in '<port_id>' you expect numbers like 0,1,2 .. but 'auto|off|rs|baser' are keywords, not variables.
Re: [dpdk-dev] [PATCH V15 3/3] app/testpmd: add FEC command
In reply to Ferruh YigitQuoted 6 lines · humin (Q)
HI,Ferruh,
how about only considering the first patch:ethdev:add fec API. If this
patch looks great to you, I wish it could be merged into 20.11.To that patch, app/testpmd add fec command, I will fix it later.
Hi Connor,
Better to get them together if possible, -rc1 has been postponed to October 16, can this additional week help to get a new version?
Quoted 92 lines
thanks.
--------------------------------------------------
胡敏 Hu Min
Mobile: +86-13528728164 <tel:+86-13528728164>
Email: [email protected] <mailto:[email protected]>*发件人:*Ferruh Yigit <[email protected]>
*收件人:*humin (Q) <[email protected]>;dev <[email protected]>
*抄 送:*konstantin.ananyev <[email protected]>;thomas <[email protected]>;arybchenko <[email protected]>;Linuxarm <[email protected]> *时 间:*2020-10-01 00:53:37
*主 题:*Re: [PATCH V15 3/3] app/testpmd: add FEC commandQuoted 9 lines · Min Hu (Connor)
This commit adds testpmd capability to query and config FEC function of device. This includes:
- show FEC capabilities, example:
testpmd> show port 0 fec capabilities
- show FEC mode, example:
testpmd> show port 0fec_mode
- config FEC mode, example:
testpmd> set port <port_id> 0 <auto|off|rs|baser>I guess it is:
set port <port_id>fec_mode<auto|off|rs|baser>Quoted 42 lines
where:
auto|off|rs|baser are four kinds of FEC mode which dev support according to MAC link speed.
Signed-off-by Min Hu (Connor) <[email protected]>Reviewed-by Wei Hu (Xavier) <[email protected]>Reviewed-by Chengwen Feng <[email protected]>Reviewed-by Chengchang Tang <[email protected]>---
v12->v13:
change fec get capa interface.---
v10->v11:
change mode to capa bitmask.---
v8->v9:
added acked-by.---
v6->v7:
usedRTE_DIM(fec_mode_name)instead ofRTE_ETH_FEC_NUM---
v5->v6:
fixed code styles according to DPDK coding style. added_ethprefix.---
v4->v5:
AddRTE_prefix for public FEC mode enum.---
v3->v4:
adjust the display format of FEC mode---
v2->v3:
adjust the display format of FEC capability.Quoted 5 lines
---
app/test-pmd/cmdline.c| 223 +++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 91 ++++++++++++++++++++app/test-pmd/testpmd.h| 2 +3 files changed, 316 insertions(+)Can you please update the testpmd documenatation for the new commands?
Also can add the new command to the --help output? ('
cmd_help_long_parsed()')<...>
Quoted 4 lines
+cmdline_parse_inst_t
cmd_set_fec_mode= {
+ .f =cmd_set_port_fec_mode_parsed,
+ .data = NULL,
+ .help_str = "set port <port_id>fec_mode<auto|off|rs|baser>",Can you please update the help string as:
"set port <port_id>fec_modeauto|off|rs|baser"'<>' is to define the variable name, like in '<
port_id>' you expect numbers like 0,1,2 .. but 'auto|off|rs|baser' are keywords, not variables.
Re: [dpdk-dev] [PATCH V15 3/3] app/testpmd: add FEC command
HI,Ferry,
thank you very much. this is good news to me. I promise the new version will be sent in these two days.
thanks again.
--------------------------------------------------
胡敏 Hu Min
Mobile: +86-13528728164<tel:+86-13528728164>
Email: [email protected]<mailto:[email protected]>
发件人:Ferruh Yigit <[email protected]>
收件人:humin (Q) <[email protected]>;dev <[email protected]>
抄 送:konstantin.ananyev <[email protected]>;thomas <[email protected]>;arybchenko <[email protected]>;Linuxarm <[email protected]> 时 间:2020-10-07 17:30:09
主 题:Re: [PATCH V15 3/3] app/testpmd: add FEC command
Quoted 6 lines · humin (Q)
HI,Ferruh,
how about only considering the first patch:ethdev:add fec API. If this
patch looks great to you, I wish it could be merged into 20.11.To that patch, app/testpmd add fec command, I will fix it later.
Hi Connor,
Better to get them together if possible, -rc1 has been postponed to October 16, can this additional week help to get a new version?
Quoted 94 lines
thanks.
--------------------------------------------------
胡敏 Hu Min
Mobile: +86-13528728164 <tel:+86-13528728164>
Email: [email protected] <mailto:[email protected]>*发件人:*Ferruh Yigit <[email protected]>
*收件人:*humin (Q) <[email protected]>;dev <[email protected]>
*抄 送:*konstantin.ananyev <[email protected]>;thomas <[email protected]>;arybchenko <[email protected]>;Linuxarm <[email protected]>
*时 间:*2020-10-01 00:53:37
*主 题:*Re: [PATCH V15 3/3] app/testpmd: add FEC commandQuoted 9 lines · Min Hu (Connor)
This commit adds testpmd capability to query and config FEC function of device. This includes:
- show FEC capabilities, example:
testpmd> show port 0 fec capabilities
- show FEC mode, example:
testpmd> show port 0fec_mode
- config FEC mode, example:
testpmd> set port <port_id> 0 <auto|off|rs|baser>I guess it is:
set port <port_id>fec_mode<auto|off|rs|baser>Quoted 42 lines
where:
auto|off|rs|baser are four kinds of FEC mode which dev support according to MAC link speed.
Signed-off-by Min Hu (Connor) <[email protected]>Reviewed-by Wei Hu (Xavier) <[email protected]>Reviewed-by Chengwen Feng <[email protected]>Reviewed-by Chengchang Tang <[email protected]>---
v12->v13:
change fec get capa interface.---
v10->v11:
change mode to capa bitmask.---
v8->v9:
added acked-by.---
v6->v7:
usedRTE_DIM(fec_mode_name)instead ofRTE_ETH_FEC_NUM---
v5->v6:
fixed code styles according to DPDK coding style. added_ethprefix.---
v4->v5:
AddRTE_prefix for public FEC mode enum.---
v3->v4:
adjust the display format of FEC mode---
v2->v3:
adjust the display format of FEC capability.Quoted 5 lines
--- app/test-pmd/cmdline.c | 223 +++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 91 ++++++++++++++++++++ app/test-pmd/testpmd.h | 2 + 3 files changed, 316 insertions(+)Can you please update the testpmd documenatation for the new commands?
Also can add the new command to the --help output? ('
cmd_help_long_parsed()')<...>
app/test-pmd/cmdline.c cmdline_parse_inst_t cmd_show_tx_metadata = { · line 19373
Quoted 4 lines
app/test-pmd/cmdline.c +4
-0+cmdline_parse_inst_t cmd_set_fec_mode = { + .f = cmd_set_port_fec_mode_parsed, + .data =NULL , + .help_str ="set port <port_id> fec_mode <auto|off|rs|baser>" ,Can you please update the help string as:
"set port <port_id>fec_modeauto|off|rs|baser"'<>' is to define the variable name, like in '<
port_id>' you expect numbers like 0,1,2 .. but 'auto|off|rs|baser' are keywords, not variables.
Re: [dpdk-dev] [PATCH V15 3/3] app/testpmd: add FEC command
In reply to Ferruh YigitHi, Ferruh,
I have sent patches of new version named V16. Please check it
out, thanks.
Quoted 130 lines · humin (Q)
HI,Ferry,
thank you very much. this is good news to me. I promise the new
version will be sent in these two days.thanks again.
--------------------------------------------------
胡敏 Hu Min
Mobile: +86-13528728164 <tel:+86-13528728164>
Email: [email protected] <mailto:[email protected]>*发件人:*Ferruh Yigit <[email protected]>
*收件人:*humin (Q) <[email protected]>;dev <[email protected]>
*抄 送:*konstantin.ananyev <[email protected]>;thomas <[email protected]>;arybchenko <[email protected]>;Linuxarm <[email protected]> *时 间:*2020-10-07 17:30:09
*主 题:*Re: [PATCH V15 3/3] app/testpmd: add FEC commandQuoted 5 lines · humin (Q)
HI,Ferruh,
how about only considering the first patch:ethdev:add fec API. If this patch looks great to you, I wish it could be merged into 20.11.
To that patch, app/testpmd add fec command, I will fix it later.
Hi Connor,
Better to get them together if possible, -rc1 has been postponed to October 16, can this additional week help to get a new version?
Quoted 87 lines
thanks.
--------------------------------------------------
胡敏 Hu Min
Mobile: +86-13528728164 <tel:+86-13528728164>
Email: [email protected] <mailto:[email protected]>*发件人:*Ferruh Yigit <[email protected]>
*收件人:*humin (Q) <[email protected]>;dev <[email protected]>
*抄 送:*konstantin.ananyev <[email protected]>;thomas <[email protected]>;arybchenko <[email protected]>;Linuxarm <[email protected]> *时 间:*2020-10-01 00:53:37
*主 题:*Re: [PATCH V15 3/3] app/testpmd: add FEC commandQuoted 9 lines · Min Hu (Connor)
This commit adds testpmd capability to query and config FEC function of device. This includes:
- show FEC capabilities, example:
testpmd> show port 0 fec capabilities
- show FEC mode, example:
testpmd> show port 0fec_mode
- config FEC mode, example:
testpmd> set port <port_id> 0 <auto|off|rs|baser>I guess it is:
set port <port_id>fec_mode<auto|off|rs|baser>Quoted 42 lines
where:
auto|off|rs|baser are four kinds of FEC mode which dev support according to MAC link speed.
Signed-off-by Min Hu (Connor) <[email protected]>Reviewed-by Wei Hu (Xavier) <[email protected]>Reviewed-by Chengwen Feng <[email protected]>Reviewed-by Chengchang Tang <[email protected]>---
v12->v13:
change fec get capa interface.---
v10->v11:
change mode to capa bitmask.---
v8->v9:
added acked-by.---
v6->v7:
usedRTE_DIM(fec_mode_name)instead ofRTE_ETH_FEC_NUM---
v5->v6:
fixed code styles according to DPDK coding style. added_ethprefix.---
v4->v5:
AddRTE_prefix for public FEC mode enum.---
v3->v4:
adjust the display format of FEC mode---
v2->v3:
adjust the display format of FEC capability.Quoted 5 lines
---
app/test-pmd/cmdline.c| 223 +++++++++++++++++++++++++++++++++++++++++++++++++ app/test-pmd/config.c | 91 ++++++++++++++++++++app/test-pmd/testpmd.h| 2 +3 files changed, 316 insertions(+)Can you please update the testpmd documenatation for the new commands?
Also can add the new command to the --help output? ('
cmd_help_long_parsed()')<...>
Quoted 4 lines
+cmdline_parse_inst_t
cmd_set_fec_mode= {
+ .f =cmd_set_port_fec_mode_parsed,
+ .data = NULL,
+ .help_str = "set port <port_id>fec_mode<auto|off|rs|baser>",Quoted 5 lines
Can you please update the help string as:
"set port <port_id>fec_modeauto|off|rs|baser"'<>' is to define the variable name, like in '<
port_id>' you expect numbers like 0,1,2 .. but 'auto|off|rs|baser' are keywords, not variables._______________________________________________
Linuxarm mailing list
[email protected]
http://hulk.huawei.com/mailman/listinfo/linuxarm
v16 cover add FEC support
In reply to Min Hu (Connor)This series add FEC support for ethdev.
Min Hu (Connor) (3):
ethdev: introduce FEC API
net/hns3: support FEC
app/testpmd: add FEC command
app/test-pmd/cmdline.c | 232 ++++++++++++++++++ app/test-pmd/config.c | 91 +++++++ app/test-pmd/testpmd.h | 2 + doc/guides/rel_notes/release_20_11.rst | 10 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 22 ++ drivers/net/hns3/hns3_cmd.h | 19 +- drivers/net/hns3/hns3_ethdev.c | 356 ++++++++++++++++++++++++++++ drivers/net/hns3/hns3_ethdev.h | 1 + lib/librte_ethdev/rte_ethdev.c | 44 ++++ lib/librte_ethdev/rte_ethdev.h | 105 ++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 88 +++++++ lib/librte_ethdev/rte_ethdev_version.map | 3 + 12 files changed, 972 insertions(+), 1 deletion(-)
Signature · 1 line
2.7.4
PATCH v16 1/3 ethdev: introduce FEC API
This patch adds Forward error correction(FEC) support for ethdev. Introduce APIs which support query and config FEC information in hardware.
---v14->v15:
change mode to fec_capa in fec set API.
---v13->v14:
change mode to fec_capa.
fix comment about API.
---v12->v13:
change fec get capa API.
fix comment styles.
---v10->v11:
allow to report capabilities per link speed. specify what should be reported if link is down when get FEC.
change mode to capa bitmask.
---v9->v10:
add macro RTE_ETH_FEC_MODE_CAPA_MASK(x) to indicate different FEC mode capa.
---v8->v9:
added reviewed-by and acked-by.
---v7->v8:
put AUTO just after NOFEC in rte_fec_mode definition.
---v6->v7:
deleted RTE_ETH_FEC_NUM to prevent ABI breakage. add new macro to indicate translation from fec mode to capa.
---v5->v6:
modified release notes.
deleted check duplicated for FEC API
fixed code styles according to DPDK coding style. added _eth prefix.
---v4->v5:
Modifies FEC capa definitions using macros.
Add RTE_ prefix for public FEC mode enum.
add release notes about FEC for dpdk20_11.
---v2->v3:
add function return value "-ENOTSUP" for API.
--- doc/guides/rel_notes/release_20_11.rst | 5 ++ lib/librte_ethdev/rte_ethdev.c | 44 +++++++++++++ lib/librte_ethdev/rte_ethdev.h | 105 +++++++++++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 88 ++++++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_version.map | 3 + 5 files changed, 245 insertions(+)
doc/guides/rel_notes/release_20_11.rst +5 -0
@@ -78,6 +78,11 @@ New Features ``--portmask=N`` where N represents the hexadecimal bitmask of ports used. +* **Added the FEC API, for a generic FEC query and config.** + + Added the FEC API which provides functions for query FEC capabilities and + current FEC mode from device. Also, API for configuring FEC mode is also provided. + Removed Items -------------
lib/librte_ethdev/rte_ethdev.c +44 -0
50 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev.h +105 -0
117 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev_driver.h +88 -0
100 lines not on this page · raw message
lib/librte_ethdev/rte_ethdev_version.map +3 -0
@@ -229,6 +229,9 @@ EXPERIMENTAL { # added in 20.11 rte_eth_link_speed_to_str; rte_eth_link_to_str; + rte_eth_fec_get_capability; + rte_eth_fec_get; + rte_eth_fec_set; }; INTERNAL {
Signature · 1 line
2.7.4
Re: [dpdk-dev] [PATCH V16 1/3] ethdev: introduce FEC API
Quoted 10 lines · Min Hu (Connor)
This patch adds Forward error correction(FEC) support for ethdev. Introduce APIs which support query and config FEC information in hardware.
Signed-off-by Min Hu (Connor) <[email protected]>Reviewed-by Wei Hu (Xavier) <[email protected]>Reviewed-by Chengwen Feng <[email protected]>Reviewed-by Chengchang Tang <[email protected]>Acked-by Andrew Rybchenko <[email protected]>Reviewed-by Ajit Khaparde <[email protected]>
<...>
Quoted 7 lines
--- doc/guides/rel_notes/release_20_11.rst | 5 ++ lib/librte_ethdev/rte_ethdev.c | 44 +++++++++++++ lib/librte_ethdev/rte_ethdev.h | 105 +++++++++++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_driver.h | 88 ++++++++++++++++++++++++++ lib/librte_ethdev/rte_ethdev_version.map | 3 + 5 files changed, 245 insertions(+)
Hi Connor,
What do you think adding 'FEC' feature to the NIC feature list documentation. 'doc/guides/nics/features/default.ini', and explain new feature in the feature documentation:
'doc/guides/nics/features.rst'?
This is both good for documentation feature and NICs having a way to advertise this support.
Re: [dpdk-dev] [PATCH V16 1/3] ethdev: introduce FEC API
OK, I will add the info soon.
Quoted 32 lines · Ferruh Yigit
Quoted 10 lines · Min Hu (Connor)
This patch adds Forward error correction(FEC) support for ethdev. Introduce APIs which support query and config FEC information in hardware.
Signed-off-by Min Hu (Connor) <[email protected]>Reviewed-by Wei Hu (Xavier) <[email protected]>Reviewed-by Chengwen Feng <[email protected]>Reviewed-by Chengchang Tang <[email protected]>Acked-by Andrew Rybchenko <[email protected]>Reviewed-by Ajit Khaparde <[email protected]><...>
Quoted 9 lines
---
doc/guides/rel_notes/release_20_11.rst | 5 ++ lib/librte_ethdev/rte_ethdev.c | 44 +++++++++++++ lib/librte_ethdev/rte_ethdev.h | 105
+++++++++++++++++++++++++++++++
lib/librte_ethdev/rte_ethdev_driver.h | 88
++++++++++++++++++++++++++
lib/librte_ethdev/rte_ethdev_version.map| 3 +5 files changed, 245 insertions(+)Hi Connor,
What do you think adding 'FEC' feature to the NIC feature list documentation. 'doc/guides/nics/features/default.ini', and explain new feature in the feature documentation:
'doc/guides/nics/features.rst'?This is both good for documentation feature and NICs having a way to advertise this support. .
PATCH v16 2/3 net/hns3: support FEC
In reply to Min Hu (Connor)Forward error correction (FEC) is a bit error correction mode. It adds error correction information to data packets at the transmit end, and uses the error correction information to correct the bit errors generated during data packet transmission at the receive end. This improves signal quality but also brings a delay to signals. This function can be enabled or disabled as required.
This patch adds FEC support for ethdev.Introduce ethdev operations which support query and config FEC information in hardware.
---v13->v14:
change mode to fec_capa.
---v12->v13:
change fec get capa interface.
---v11->v12:
fix coding warning.
v10->v11:
allow to report capabilities per link speed.
specify what should be reported if link is down
when get FEC.
change mode to capa bitmask.
---v9->v10:
use RTE_ETH_FEC_MODE_CAPA_MASK(x) which is just defined.
---v7->v8:
FEC mode order defined in hns3 hardware is inconsistend with that defined in the ethdev library. So the sequence needs to be converted.
---v5->v6:
fixed code styles according to DPDK coding style.
added _eth prefix.
---v4->v5:
Data type for fec_cap is changed from uint8_t
to uint32_t for possible future expansion.
---v2->v3:
adjust the return value of function.
--- doc/guides/rel_notes/release_20_11.rst | 5 + drivers/net/hns3/hns3_cmd.h | 19 +- drivers/net/hns3/hns3_ethdev.c | 356 +++++++++++++++++++++++++++++++++ drivers/net/hns3/hns3_ethdev.h | 1 + 4 files changed, 380 insertions(+), 1 deletion(-)
doc/guides/rel_notes/release_20_11.rst +5 -0
@@ -83,6 +83,11 @@ New Features Added the FEC API which provides functions for query FEC capabilities and current FEC mode from device. Also, API for configuring FEC mode is also provided. +* **Added hns3 FEC PMD, for supporting query and config FEC mode.** + + Added the FEC PMD which provides functions for query FEC capabilities and + current FEC mode from device. Also, PMD for configuring FEC mode is also provided. + Removed Items -------------
drivers/net/hns3/hns3_cmd.h +18 -1
@@ -100,6 +100,7 @@ enum hns3_opcode_type {HNS3_OPC_QUERY_LINK_STATUS =0x0307 ,HNS3_OPC_CONFIG_MAX_FRM_SIZE =0x0308 ,HNS3_OPC_CONFIG_SPEED_DUP =0x0309 , +HNS3_OPC_CONFIG_FEC_MODE =0x031A ,/* PFC/Pause commands */ HNS3_OPC_CFG_MAC_PAUSE_EN = 0x0701,
@@ -684,9 +685,25 @@ struct hns3_config_auto_neg_cmd {uint8_t rsv[20 ]; }; +#define HNS3_MAC_CFG_FEC_AUTO_EN_B 0 +#define HNS3_MAC_CFG_FEC_MODE_S 1 +#define HNS3_MAC_CFG_FEC_MODE_M GENMASK(3, 1) +#define HNS3_MAC_FEC_OFF 0 +#define HNS3_MAC_FEC_BASER 1 +#define HNS3_MAC_FEC_RS 2 +struct hns3_sfp_speed_cmd {uint32_t sfp_speed; -uint32_t rsv[5 ]; +uint8_t query_type;/* 0: sfp speed, 1: active fec */ +uint8_t active_fec;/* current FEC mode */ +uint16_t rsv1; +uint32_t rsv2[4 ]; +}; + +/* Configure FEC mode, opcode:0x031A */ +struct hns3_config_fec_cmd { +uint8_t fec_mode; +uint8_t rsv[23 ]; };#define HNS3_MAC_MGR_MASK_VLAN_B BIT(0)
drivers/net/hns3/hns3_ethdev.c +356 -0
398 lines not on this page · raw message
drivers/net/hns3/hns3_ethdev.h +1 -0
@@ -620,6 +620,7 @@ struct hns3_pf {struct hns3_err_msix_intr_stats abn_int_stats;bool support_sfp_query; +uint32_t fec_mode;/* current FEC mode for ethdev */ struct hns3_vtag_cfg vtag_config; LIST_HEAD(vlan_tbl, hns3_user_vlan_table) vlan_list;
Signature · 1 line
2.7.4
PATCH v16 3/3 app/testpmd: add FEC command
In reply to Min Hu (Connor)This commit adds testpmd capability to query and config FEC function of device. This includes:
- show FEC capabilities, example:
testpmd> show port 0 fec capabilities
- show FEC mode, example:
testpmd> show port 0 fec_mode
- config FEC mode, example:
testpmd> set port <port_id> fec_mode auto|off|rs|baser
where:
auto|off|rs|baser are four kinds of FEC mode which dev support according to MAC link speed.
---v15->v16:
add fec command help info.
---v12->v13:
change fec get capa interface.
---v10->v11:
change mode to capa bitmask.
---v8->v9:
added acked-by.
---v6->v7:
used RTE_DIM(fec_mode_name) instead of RTE_ETH_FEC_NUM
---v5->v6:
fixed code styles according to DPDK coding style. added _eth prefix.
---v4->v5:
Add RTE_ prefix for public FEC mode enum.
---v3->v4:
adjust the display format of FEC mode
---v2->v3:
adjust the display format of FEC capability.
--- app/test-pmd/cmdline.c | 232 ++++++++++++++++++++++++++++ app/test-pmd/config.c | 91 +++++++++++ app/test-pmd/testpmd.h | 2 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 22 +++ 4 files changed, 347 insertions(+)
app/test-pmd/cmdline.c +232 -0
@@ -245,6 +245,12 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (port_id) macs|mcast_macs" " Display list of mac addresses added to port.\n\n" + +"show port (port_id) fec capabilities" +" Show fec capabilities of a port.\n\n" + +"show port (port_id) fec_mode" +" Show fec mode of a port.\n\n" ); }
@@ -748,6 +754,9 @@ static void cmd_help_long_parsed(void *parsed_result,"show port (port_id) queue-region\n" " show all queue region related configuration info\n\n" +"set port (port_id) fec_mode auto|off|rs|baser\n" +" set fec mode for a specific port\n\n" + ,list_pkt_forwarding_modes () ); }
@@ -19161,6 +19170,226 @@ cmdline_parse_inst_t cmd_show_tx_metadata = { }, }; +/* *** show fec capability per port configuration *** */ +struct cmd_show_fec_capability_result { +cmdline_fixed_string_t cmd_show; +cmdline_fixed_string_t cmd_port; +cmdline_fixed_string_t cmd_fec; +cmdline_fixed_string_t cmd_keyword; +portid_t cmd_pid; +}; + +static void +cmd_show_fec_capability_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +#define FEC_CAP_NUM 2 +struct cmd_show_fec_capability_result *res = parsed_result; +struct rte_eth_fec_capa speed_fec_capa[FEC_CAP_NUM ]; +unsigned int num =FEC_CAP_NUM ; +unsigned int ret_num; +int ret; + +if (!rte_eth_dev_is_valid_port (res->cmd_pid)) { +printf ("Invalid port id %u\n" , res->cmd_pid); +return ; + } + + ret =rte_eth_fec_get_capability (res->cmd_pid, speed_fec_capa, num); +if (ret == -ENOTSUP ) { +printf ("Function not implemented\n" ); +return ; + }else if (ret <0 ) { +printf ("Get FEC capability failed\n" ); +return ; + } + + ret_num = (unsigned int )ret; +show_fec_capability (ret_num, speed_fec_capa); +} + +cmdline_parse_token_string_t cmd_show_fec_capability_show = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_show,"show" ); +cmdline_parse_token_string_t cmd_show_fec_capability_port = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_port,"port" ); +cmdline_parse_token_num_t cmd_show_fec_capability_pid = + TOKEN_NUM_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_pid,UINT16 ); +cmdline_parse_token_string_t cmd_show_fec_capability_fec = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_fec,"fec" ); +cmdline_parse_token_string_t cmd_show_fec_capability_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_capability_result, + cmd_keyword,"capabilities" ); + +cmdline_parse_inst_t cmd_show_capability = { + .f = cmd_show_fec_capability_parsed, + .data =NULL , + .help_str ="show port <port_id> fec capabilities" , + .tokens = { + (void *)&cmd_show_fec_capability_show, + (void *)&cmd_show_fec_capability_port, + (void *)&cmd_show_fec_capability_pid, + (void *)&cmd_show_fec_capability_fec, + (void *)&cmd_show_fec_capability_keyword, +NULL , + }, +}; + +/* *** show fec mode per port configuration *** */ +struct cmd_show_fec_metadata_result { +cmdline_fixed_string_t cmd_show; +cmdline_fixed_string_t cmd_port; +cmdline_fixed_string_t cmd_keyword; +portid_t cmd_pid; +}; + +static void +cmd_show_fec_mode_parsed (void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +#define FEC_NAME_SIZE 16 +struct cmd_show_fec_metadata_result *res = parsed_result; +uint32_t mode; +char buf[FEC_NAME_SIZE ]; +int ret; + +if (!rte_eth_dev_is_valid_port (res->cmd_pid)) { +printf ("Invalid port id %u\n" , res->cmd_pid); +return ; + } + ret =rte_eth_fec_get (res->cmd_pid, &mode); +if (ret == -ENOTSUP ) { +printf ("Function not implemented\n" ); +return ; + }else if (ret <0 ) { +printf ("Get FEC mode failed\n" ); +return ; + } + +switch (mode) { +case RTE_ETH_FEC_MODE_CAPA_MASK (NOFEC ): +strlcpy (buf,"off" ,sizeof (buf)); +break ; +case RTE_ETH_FEC_MODE_CAPA_MASK (AUTO ): +strlcpy (buf,"auto" ,sizeof (buf)); +break ; +case RTE_ETH_FEC_MODE_CAPA_MASK (BASER ): +strlcpy (buf,"baser" ,sizeof (buf)); +break ; +case RTE_ETH_FEC_MODE_CAPA_MASK (RS ): +strlcpy (buf,"rs" ,sizeof (buf)); +break ; +default : +return ; + } + +printf ("%s\n" , buf); +} + +cmdline_parse_token_string_t cmd_show_fec_mode_show = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_show,"show" ); +cmdline_parse_token_string_t cmd_show_fec_mode_port = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_port,"port" ); +cmdline_parse_token_num_t cmd_show_fec_mode_pid = + TOKEN_NUM_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_pid,UINT16 ); +cmdline_parse_token_string_t cmd_show_fec_mode_keyword = + TOKEN_STRING_INITIALIZER(struct cmd_show_fec_metadata_result, + cmd_keyword,"fec_mode" ); + +cmdline_parse_inst_t cmd_show_fec_mode = { + .f = cmd_show_fec_mode_parsed, + .data =NULL , + .help_str ="show port <port_id> fec_mode" , + .tokens = { + (void *)&cmd_show_fec_mode_show, + (void *)&cmd_show_fec_mode_port, + (void *)&cmd_show_fec_mode_pid, + (void *)&cmd_show_fec_mode_keyword, +NULL , + }, +}; + +/* *** set fec mode per port configuration *** */ +struct cmd_set_port_fec_mode { +cmdline_fixed_string_t set; +cmdline_fixed_string_t port; +portid_t port_id; +cmdline_fixed_string_t fec_mode; +cmdline_fixed_string_t fec_value; +}; + +/* Common CLI fields for set fec mode */ +cmdline_parse_token_string_t cmd_set_port_fec_mode_set = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + set,"set" ); +cmdline_parse_token_string_t cmd_set_port_fec_mode_port = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + port,"port" ); +cmdline_parse_token_num_t cmd_set_port_fec_mode_port_id = +TOKEN_NUM_INITIALIZER + (struct cmd_set_port_fec_mode, + port_id,UINT16 ); +cmdline_parse_token_string_t cmd_set_port_fec_mode_str = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + fec_mode,"fec_mode" ); +cmdline_parse_token_string_t cmd_set_port_fec_mode_value = +TOKEN_STRING_INITIALIZER + (struct cmd_set_port_fec_mode, + fec_value,NULL ); + +static void +cmd_set_port_fec_mode_parsed ( +void *parsed_result, + __rte_unused struct cmdline *cl, + __rte_unused void *data) +{ +struct cmd_set_port_fec_mode *res = parsed_result; +uint16_t port_id = res->port_id; +uint32_t mode; +int ret; + + ret =parse_fec_mode (res->fec_value, &mode); +if (ret <0 ) { +printf ("Unknown fec mode: %s for Port %d\n" , res->fec_value, + port_id); +return ; + } + + ret =rte_eth_fec_set (port_id, mode); +if (ret == -ENOTSUP ) { +printf ("Function not implemented\n" ); +return ; + }else if (ret <0 ) { +printf ("Set FEC mode failed\n" ); +return ; + } +} + +cmdline_parse_inst_t cmd_set_fec_mode = { + .f = cmd_set_port_fec_mode_parsed, + .data =NULL , + .help_str ="set port <port_id> fec_mode auto|off|rs|baser" , + .tokens = { + (void *)&cmd_set_port_fec_mode_set, + (void *)&cmd_set_port_fec_mode_port, + (void *)&cmd_set_port_fec_mode_port_id, + (void *)&cmd_set_port_fec_mode_str, + (void *)&cmd_set_port_fec_mode_value, +NULL , + }, +}; +/* show port supported ptypes */ /* Common result structure for show port ptypes */
@@ -19795,6 +20024,9 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_show_set_raw, (cmdline_parse_inst_t *)&cmd_show_set_raw_all, (cmdline_parse_inst_t *)&cmd_config_tx_dynf_specific, + (cmdline_parse_inst_t *)&cmd_show_fec_mode, + (cmdline_parse_inst_t *)&cmd_set_fec_mode, + (cmdline_parse_inst_t *)&cmd_show_capability, NULL, };
app/test-pmd/config.c +91 -0
103 lines not on this page · raw message
app/test-pmd/testpmd.h +2 -0
@@ -804,6 +804,8 @@ void show_tx_pkt_segments(void);void set_tx_pkt_times (unsigned int *tx_times);void show_tx_pkt_times (void );void set_tx_pkt_split (const char *name); +int parse_fec_mode (const char *name,enum rte_eth_fec_mode *mode); +void show_fec_capability (uint32_t num,struct rte_eth_fec_capa *speed_fec_capa);void set_nb_pkt_per_burst (uint16_t pkt_burst);char *list_pkt_forwarding_modes (void );char *list_pkt_forwarding_retry_modes (void );
doc/guides/testpmd_app_ug/testpmd_funcs.rst +22 -0
@@ -612,6 +612,20 @@ For example:: 00000020: 03 06 00 00 00 FA 00 00 00 00 08 00 00 00 00 00 | ................ 00000030: 06 00 | .. +show fec capabilities +~~~~~~~~~~~~~~~~~~~~~ + +Show fec capabilities of a port:: + + testpmd> show port (port_id) fec capabilities + +show fec mode +~~~~~~~~~~~~~ + +Show fec mode of a port:: + + testpmd> show port (port_id) fec_mode + Configuration Functions -----------------------
@@ -2005,6 +2019,14 @@ during the flow rule creation:: Otherwise the default index ``0`` is used. +Set fec mode +~~~~~~~~~~~~ + +Set fec mode for a specific port:: + + testpmd> set port (port_id) fec_mode auto|off|rs|baser + + Port Functions --------------
Signature · 1 line
2.7.4
Re: [dpdk-dev] [PATCH V16 3/3] app/testpmd: add FEC command
Quoted 18 lines · Min Hu (Connor)
This commit adds testpmd capability to query and config FEC function of device. This includes:
- show FEC capabilities, example:
testpmd> show port 0 fec capabilities
- show FEC mode, example:
testpmd> show port 0fec_mode
- config FEC mode, example:
testpmd> set port <port_id>fec_modeauto|off|rs|baserwhere:
auto|off|rs|baser are four kinds of FEC mode which dev support according to MAC link speed.
Signed-off-by Min Hu (Connor) <[email protected]>Reviewed-by Wei Hu (Xavier) <[email protected]>Reviewed-by Chengwen Feng <[email protected]>Reviewed-by Chengchang Tang <[email protected]>
<...>
Quoted 65 lines
app/test-pmd/config.c +58
-0+static const struct { +uint32_t speed; +const char *name; +} eth_speed_name[] = { + { + .speed =ETH_SPEED_NUM_10G , + .name ="Speed 10G" , + }, + { + .speed =ETH_SPEED_NUM_25G , + .name ="Speed 25G" , + }, + { + .speed =ETH_SPEED_NUM_40G , + .name ="Speed 40G" , + }, + { + .speed =ETH_SPEED_NUM_50G , + .name ="Speed 50G" , + }, + { + .speed =ETH_SPEED_NUM_100G , + .name ="Speed 100G" , + }, + { + .speed =ETH_SPEED_NUM_200G , + .name ="Speed 200G" , + }, +}; +static void print_ethaddr (const char *name,struct rte_ether_addr *eth_addr) {@@ -2969,6 +3021,45 @@ set_tx_pkt_split(const char *name)printf ("unknown value: \"%s\"\n" , name); } +int +parse_fec_mode (const char *name,uint32_t *mode) +{ +uint8_t i; + +for (i =0 ; i <RTE_DIM (fec_mode_name); i++) { +if (strcmp (fec_mode_name[i].name, name) ==0 ) { + *mode =RTE_ETH_FEC_MODE_TO_CAPA (fec_mode_name[i].mode); +return 0 ; + } + } +return -1 ; +} + +void +show_fec_capability (unsigned int num,struct rte_eth_fec_capa *speed_fec_capa) +{ +unsigned int i, j, k; + +printf ("FEC capabilities:\n" ); + +for (i =0 ; i < num; i++) { +for (j =0 ; j <RTE_DIM (eth_speed_name); j++) { +if (eth_speed_name[j].speed == + speed_fec_capa[i].speed) { +printf ("%s : " , eth_speed_name[j].name); +break ; + }
app/test-pmd/config.c set_tx_pkt_split(const char *name) · line 3061
Quoted 10 lines
app/test-pmd/config.c +10
-0+ } + +for (k =RTE_ETH_FEC_AUTO ; k <RTE_DIM (fec_mode_name); k++) { +if (RTE_ETH_FEC_MODE_TO_CAPA (k) & + speed_fec_capa[i].capa) +printf ("%s " , fec_mode_name[k].name); + } +printf ("\n" ); + } +}
Hi Connor,
Sorry for catching this late, but there is a new 'rte_eth_link_speed_to_str()' API in the ethdev, which may enable removing above global 'eth_speed_name' array [1].
I will proceed with this patchset, but can you please send an increamental patch to use the 'rte_eth_link_speed_to_str()'? If it comes before the next-net pulled I can squash it, if not it can stay as individual patch.
Thanks,
ferruh
[1]
printf("%s : ", rte_eth_link_speed_to_str(speed_fec_capa[i].speed));Re: [dpdk-dev] [PATCH V16 3/3] app/testpmd: add FEC command
Hi Ferruh,
I have fixed it, and send the patch.
Please check it out, thanks.
https://patches.dpdk.org/patch/80097/
Quoted 113 lines · Ferruh Yigit
Quoted 18 lines · Min Hu (Connor)
This commit adds testpmd capability to query and config FEC function of device. This includes:
- show FEC capabilities, example:
testpmd> show port 0 fec capabilities
- show FEC mode, example:
testpmd> show port 0fec_mode
- config FEC mode, example:
testpmd> set port <port_id>fec_modeauto|off|rs|baserwhere:
auto|off|rs|baser are four kinds of FEC mode which dev support according to MAC link speed.
Signed-off-by Min Hu (Connor) <[email protected]>Reviewed-by Wei Hu (Xavier) <[email protected]>Reviewed-by Chengwen Feng <[email protected]>Reviewed-by Chengchang Tang <[email protected]><...>
Quoted 65 lines
app/test-pmd/config.c +30
-0+static const struct { + uint32_t speed; + const char *name; +} eth_speed_name[] = { + { + .speed = ETH_SPEED_NUM_10G, + .name = "Speed 10G", + }, + { + .speed = ETH_SPEED_NUM_25G, + .name = "Speed 25G", + }, + { + .speed = ETH_SPEED_NUM_40G, + .name = "Speed 40G", + }, + { + .speed = ETH_SPEED_NUM_50G, + .name = "Speed 50G", + }, + { + .speed = ETH_SPEED_NUM_100G, + .name = "Speed 100G", + }, + { + .speed = ETH_SPEED_NUM_200G, + .name = "Speed 200G", + }, +}; +static void
print_ethaddr(const char *name, struct rte_ether_addr *eth_addr){app/test-pmd/config.c +28
-0@@ -2969,6 +3021,45 @@ set_tx_pkt_split(const char *name) printf("unknown value: \"%s\"\n", name); } +int +parse_fec_mode (const char *name,uint32_t *mode) +{ + uint8_t i; + + for (i = 0; i < RTE_DIM(fec_mode_name); i++) { + if (strcmp(fec_mode_name[i].name, name) == 0) { + *mode = RTE_ETH_FEC_MODE_TO_CAPA(fec_mode_name[i].mode); + return 0; + } + } + return -1; +} + +void +show_fec_capability (unsigned int num,struct rte_eth_fec_capa *speed_fec_capa) +{ + unsigned int i, j, k; + + printf("FEC capabilities:\n"); + + for (i = 0; i < num; i++) { + for (j = 0; j < RTE_DIM(eth_speed_name); j++) { + if (eth_speed_name[j].speed == + speed_fec_capa[i].speed) { + printf("%s : ", eth_speed_name[j].name); + break; + }app/test-pmd/config.c set_tx_pkt_split(const char *name) · line 3061
Quoted 10 lines
app/test-pmd/config.c +10
-0+ } + + for (k = RTE_ETH_FEC_AUTO; k < RTE_DIM(fec_mode_name); k++) { + if (RTE_ETH_FEC_MODE_TO_CAPA(k) & + speed_fec_capa[i].capa) + printf("%s ", fec_mode_name[k].name); + } + printf("\n"); + } +}Hi Connor,
Sorry for catching this late, but there is a new '
rte_eth_link_speed_to_str()' API in the ethdev, which may enable removing above global 'eth_speed_name' array [1].I will proceed with this patchset, but can you please send an increamental patch to use the '
rte_eth_link_speed_to_str()'? If it comes before the next-net pulled I can squash it, if not it can stay as individual patch.Thanks,
ferruh[1]
printf("%s : ", rte_eth_link_speed_to_str(speed_fec_capa[i].speed));.
Re: [dpdk-dev] [PATCH V16 0/3] add FEC support
In reply to Min Hu (Connor)Quoted 7 lines · Min Hu (Connor)
This series add FEC support for ethdev.
Min Hu (Connor) (3):
ethdev: introduce FEC API
net/hns3: support FEC
app/testpmd: add FEC command
Series applied to dpdk-next-net/main, thanks.
I put a comment to 1/3 can you please check it, as additional update?
Thanks,
ferruh