* Re: [dpdk-dev] [PATCH] app/testpmd: add eth peer CLI command [not found] <1514205777-22188-1-git-send-email-wisamm@mellanox.com> @ 2018-01-04 9:05 ` Wisam Monther 2018-01-10 6:57 ` Lu, Wenzhuo 2018-01-14 8:27 ` [dpdk-dev] [PATCH v2] " Wisam Jaddo 0 siblings, 2 replies; 5+ messages in thread From: Wisam Monther @ 2018-01-04 9:05 UTC (permalink / raw) To: jingjing.wu, Raslan Darawsheh; +Cc: dev, Ori Kam, Shahaf Shuler, Wisam Monther +Raslan. BRs, Wisam Jaddo -----Original Message----- From: Wisam Jaddo [mailto:wisamm@mellanox.com] Sent: Monday, December 25, 2017 2:43 PM To: jingjing.wu@intel.com Cc: dev@dpdk.org; Ori Kam; Wisam Monther; Shahaf Shuler Subject: [PATCH] app/testpmd: add eth peer CLI command This command will simulate the process of setting the eth-peer from command line. It will be useful to preform extra testing. usage: testpmd> set eth-peer <port_id> <peer_addr>. Signed-off-by: Wisam Jaddo <wisamm@mellanox.com> --- app/test-pmd/cmdline.c | 49 +++++++++++++++++++++++++++++ app/test-pmd/config.c | 19 +++++++++++ app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 ++++++ 4 files changed, 78 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f71d963..605720d 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -277,6 +277,9 @@ static void cmd_help_long_parsed(void *parsed_result, "set nbcore (num)\n" " Set number of cores.\n\n" + "set eth-peer (port_id) (peer_addr)\n" + " set the peer address for certain port.\n\n" + "set coremask (mask)\n" " Set the forwarding cores hexadecimal mask.\n\n" @@ -2954,6 +2957,51 @@ cmdline_parse_inst_t cmd_set_fwd_mask = { }, }; +/* *** SET THE PEER ADDRESS FOR CERTAIN PORT *** */ struct +cmd_eth_peer_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t eth_peer; + portid_t port_id; + cmdline_fixed_string_t peer_addr; +}; + +static void cmd_set_eth_peer_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_eth_peer_result *res = parsed_result; + + if (test_done == 0) { + printf("Please stop forwarding first\n"); + return; + } + if (!strcmp(res->eth_peer, "eth-peer")) { + set_fwd_eth_peer(res->port_id, res->peer_addr); + fwd_config_setup(); + } +} +cmdline_parse_token_string_t cmd_eth_peer_set = + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, set, "set"); +cmdline_parse_token_string_t cmd_eth_peer = + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, eth_peer, +"eth-peer"); cmdline_parse_token_num_t cmd_eth_peer_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_eth_peer_result, port_id, UINT16); +cmdline_parse_token_string_t cmd_eth_peer_addr = + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, peer_addr, NULL); + +cmdline_parse_inst_t cmd_set_fwd_eth_peer = { + .f = cmd_set_eth_peer_parsed, + .data = NULL, + .help_str = "set eth-peer <port_id> <peer_mac>", + .tokens = { + (void *)&cmd_eth_peer_set, + (void *)&cmd_eth_peer, + (void *)&cmd_eth_peer_port_id, + (void *)&cmd_eth_peer_addr, + NULL, + }, +}; + /* * SET NBPORT, NBCORE, PACKET BURST, and VERBOSE LEVEL CONFIGURATION */ @@ -15558,6 +15606,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_txsplit, (cmdline_parse_inst_t *)&cmd_set_fwd_list, (cmdline_parse_inst_t *)&cmd_set_fwd_mask, + (cmdline_parse_inst_t *)&cmd_set_fwd_eth_peer, (cmdline_parse_inst_t *)&cmd_set_fwd_mode, (cmdline_parse_inst_t *)&cmd_set_fwd_retry_mode, (cmdline_parse_inst_t *)&cmd_set_burst_tx_retry, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index cd2ac11..876ee83 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -78,6 +78,7 @@ #include <rte_pmd_bnxt.h> #endif #include <rte_gro.h> +#include <cmdline_parse_etheraddr.h> #include "testpmd.h" @@ -2234,6 +2235,24 @@ set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc) return 0; } +void +set_fwd_eth_peer(portid_t port_id, char *peer_addr) { + uint8_t c, new_peer_addr[6]; + if (!rte_eth_dev_is_valid_port(port_id)) { + printf("Error: Invalid port number %i\n", port_id); + return; + } + if (cmdline_parse_etheraddr(NULL, peer_addr, &new_peer_addr, + sizeof(new_peer_addr)) < 0) { + printf("Error: Invalid ethernet address: %s\n", peer_addr); + return; + } + for (c = 0; c < 6; c++) + peer_eth_addrs[port_id].addr_bytes[c] = + new_peer_addr[c]; +} + int set_fwd_lcores_mask(uint64_t lcoremask) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 1639d27..a2e1a5c 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -632,6 +632,7 @@ int set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc); int set_fwd_lcores_mask(uint64_t lcoremask); void set_fwd_lcores_number(uint16_t nb_lc); +void set_fwd_eth_peer(portid_t port_id, char *peer_addr); void set_fwd_ports_list(unsigned int *portlist, unsigned int nb_pt); void set_fwd_ports_mask(uint64_t portmask); void set_fwd_ports_number(uint16_t nb_pt); diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 9789139..7f09cf9 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -459,6 +459,15 @@ set nbport (num) This is equivalent to the ``--nb-ports`` command-line option. +set eth-peer +~~~~~~~~~~~~ + +Set the forwarding peer address for certain port:: + + testpmd> set eth-peer (port_id) (perr_addr) + +This is equivalent to the ``--eth-peer`` command-line option. + set nbcore ~~~~~~~~~~ -- 2.7.4 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: add eth peer CLI command 2018-01-04 9:05 ` [dpdk-dev] [PATCH] app/testpmd: add eth peer CLI command Wisam Monther @ 2018-01-10 6:57 ` Lu, Wenzhuo 2018-01-12 18:00 ` Thomas Monjalon 2018-01-14 8:27 ` [dpdk-dev] [PATCH v2] " Wisam Jaddo 1 sibling, 1 reply; 5+ messages in thread From: Lu, Wenzhuo @ 2018-01-10 6:57 UTC (permalink / raw) To: Wisam Monther, Wu, Jingjing, Raslan Darawsheh; +Cc: dev, Ori Kam, Shahaf Shuler Hi, > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wisam Monther > Sent: Thursday, January 4, 2018 5:06 PM > To: Wu, Jingjing <jingjing.wu@intel.com>; Raslan Darawsheh > <rasland@mellanox.com> > Cc: dev@dpdk.org; Ori Kam <orika@mellanox.com>; Shahaf Shuler > <shahafs@mellanox.com>; Wisam Monther <wisamm@mellanox.com> > Subject: Re: [dpdk-dev] [PATCH] app/testpmd: add eth peer CLI command > > +Raslan. > > BRs, > Wisam Jaddo > > -----Original Message----- > From: Wisam Jaddo [mailto:wisamm@mellanox.com] > Sent: Monday, December 25, 2017 2:43 PM > To: jingjing.wu@intel.com > Cc: dev@dpdk.org; Ori Kam; Wisam Monther; Shahaf Shuler > Subject: [PATCH] app/testpmd: add eth peer CLI command > > This command will simulate the process of setting the eth-peer from > command line. > > It will be useful to preform extra testing. > > usage: > testpmd> set eth-peer <port_id> <peer_addr>. > > Signed-off-by: Wisam Jaddo <wisamm@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH] app/testpmd: add eth peer CLI command 2018-01-10 6:57 ` Lu, Wenzhuo @ 2018-01-12 18:00 ` Thomas Monjalon 0 siblings, 0 replies; 5+ messages in thread From: Thomas Monjalon @ 2018-01-12 18:00 UTC (permalink / raw) To: Wisam Monther Cc: dev, Lu, Wenzhuo, Wu, Jingjing, Raslan Darawsheh, Ori Kam, Shahaf Shuler > > This command will simulate the process of setting the eth-peer from > > command line. > > > > It will be useful to preform extra testing. > > > > usage: > > testpmd> set eth-peer <port_id> <peer_addr>. > > > > Signed-off-by: Wisam Jaddo <wisamm@mellanox.com> > Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> The patch has not been received on the mailing list. Please Wisam, send a v2 (keeping this ack). ^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v2] app/testpmd: add eth peer CLI command 2018-01-04 9:05 ` [dpdk-dev] [PATCH] app/testpmd: add eth peer CLI command Wisam Monther 2018-01-10 6:57 ` Lu, Wenzhuo @ 2018-01-14 8:27 ` Wisam Jaddo 2018-01-15 10:54 ` Thomas Monjalon 1 sibling, 1 reply; 5+ messages in thread From: Wisam Jaddo @ 2018-01-14 8:27 UTC (permalink / raw) To: jingjing.wu; +Cc: dev, wenzhuo.lu, orika, shahafs, rasland, thomas This command will simulate the process of setting the eth-peer from command line. It will be useful to preform extra testing. usage: testpmd> set eth-peer <port_id> <peer_addr>. Signed-off-by: Wisam Jaddo <wisamm@mellanox.com> Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> --- changes in v2: added Ack from Wenzhuo, and sending to ML again due to the issue of not receiving it from the first time. --- app/test-pmd/cmdline.c | 49 +++++++++++++++++++++++++++++ app/test-pmd/config.c | 19 +++++++++++ app/test-pmd/testpmd.h | 1 + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 ++++++ 4 files changed, 78 insertions(+) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index f71d963..605720d 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -277,6 +277,9 @@ static void cmd_help_long_parsed(void *parsed_result, "set nbcore (num)\n" " Set number of cores.\n\n" + "set eth-peer (port_id) (peer_addr)\n" + " set the peer address for certain port.\n\n" + "set coremask (mask)\n" " Set the forwarding cores hexadecimal mask.\n\n" @@ -2954,6 +2957,51 @@ cmdline_parse_inst_t cmd_set_fwd_mask = { }, }; +/* *** SET THE PEER ADDRESS FOR CERTAIN PORT *** */ +struct cmd_eth_peer_result { + cmdline_fixed_string_t set; + cmdline_fixed_string_t eth_peer; + portid_t port_id; + cmdline_fixed_string_t peer_addr; +}; + +static void cmd_set_eth_peer_parsed(void *parsed_result, + __attribute__((unused)) struct cmdline *cl, + __attribute__((unused)) void *data) +{ + struct cmd_eth_peer_result *res = parsed_result; + + if (test_done == 0) { + printf("Please stop forwarding first\n"); + return; + } + if (!strcmp(res->eth_peer, "eth-peer")) { + set_fwd_eth_peer(res->port_id, res->peer_addr); + fwd_config_setup(); + } +} +cmdline_parse_token_string_t cmd_eth_peer_set = + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, set, "set"); +cmdline_parse_token_string_t cmd_eth_peer = + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, eth_peer, "eth-peer"); +cmdline_parse_token_num_t cmd_eth_peer_port_id = + TOKEN_NUM_INITIALIZER(struct cmd_eth_peer_result, port_id, UINT16); +cmdline_parse_token_string_t cmd_eth_peer_addr = + TOKEN_STRING_INITIALIZER(struct cmd_eth_peer_result, peer_addr, NULL); + +cmdline_parse_inst_t cmd_set_fwd_eth_peer = { + .f = cmd_set_eth_peer_parsed, + .data = NULL, + .help_str = "set eth-peer <port_id> <peer_mac>", + .tokens = { + (void *)&cmd_eth_peer_set, + (void *)&cmd_eth_peer, + (void *)&cmd_eth_peer_port_id, + (void *)&cmd_eth_peer_addr, + NULL, + }, +}; + /* * SET NBPORT, NBCORE, PACKET BURST, and VERBOSE LEVEL CONFIGURATION */ @@ -15558,6 +15606,7 @@ cmdline_parse_ctx_t main_ctx[] = { (cmdline_parse_inst_t *)&cmd_set_txsplit, (cmdline_parse_inst_t *)&cmd_set_fwd_list, (cmdline_parse_inst_t *)&cmd_set_fwd_mask, + (cmdline_parse_inst_t *)&cmd_set_fwd_eth_peer, (cmdline_parse_inst_t *)&cmd_set_fwd_mode, (cmdline_parse_inst_t *)&cmd_set_fwd_retry_mode, (cmdline_parse_inst_t *)&cmd_set_burst_tx_retry, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index cd2ac11..876ee83 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -78,6 +78,7 @@ #include <rte_pmd_bnxt.h> #endif #include <rte_gro.h> +#include <cmdline_parse_etheraddr.h> #include "testpmd.h" @@ -2234,6 +2235,24 @@ set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc) return 0; } +void +set_fwd_eth_peer(portid_t port_id, char *peer_addr) +{ + uint8_t c, new_peer_addr[6]; + if (!rte_eth_dev_is_valid_port(port_id)) { + printf("Error: Invalid port number %i\n", port_id); + return; + } + if (cmdline_parse_etheraddr(NULL, peer_addr, &new_peer_addr, + sizeof(new_peer_addr)) < 0) { + printf("Error: Invalid ethernet address: %s\n", peer_addr); + return; + } + for (c = 0; c < 6; c++) + peer_eth_addrs[port_id].addr_bytes[c] = + new_peer_addr[c]; +} + int set_fwd_lcores_mask(uint64_t lcoremask) { diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h index 1639d27..a2e1a5c 100644 --- a/app/test-pmd/testpmd.h +++ b/app/test-pmd/testpmd.h @@ -632,6 +632,7 @@ int set_fwd_lcores_list(unsigned int *lcorelist, unsigned int nb_lc); int set_fwd_lcores_mask(uint64_t lcoremask); void set_fwd_lcores_number(uint16_t nb_lc); +void set_fwd_eth_peer(portid_t port_id, char *peer_addr); void set_fwd_ports_list(unsigned int *portlist, unsigned int nb_pt); void set_fwd_ports_mask(uint64_t portmask); void set_fwd_ports_number(uint16_t nb_pt); diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 9789139..7f09cf9 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -459,6 +459,15 @@ set nbport (num) This is equivalent to the ``--nb-ports`` command-line option. +set eth-peer +~~~~~~~~~~~~ + +Set the forwarding peer address for certain port:: + + testpmd> set eth-peer (port_id) (perr_addr) + +This is equivalent to the ``--eth-peer`` command-line option. + set nbcore ~~~~~~~~~~ -- 2.7.4 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] app/testpmd: add eth peer CLI command 2018-01-14 8:27 ` [dpdk-dev] [PATCH v2] " Wisam Jaddo @ 2018-01-15 10:54 ` Thomas Monjalon 0 siblings, 0 replies; 5+ messages in thread From: Thomas Monjalon @ 2018-01-15 10:54 UTC (permalink / raw) To: Wisam Jaddo; +Cc: dev, jingjing.wu, wenzhuo.lu, orika, shahafs, rasland 14/01/2018 09:27, Wisam Jaddo: > This command will simulate the process of setting the > eth-peer from command line. > > It will be useful to preform extra testing. > > usage: > testpmd> set eth-peer <port_id> <peer_addr>. > > Signed-off-by: Wisam Jaddo <wisamm@mellanox.com> > Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com> > > --- > changes in v2: > added Ack from Wenzhuo, and sending to ML again > due to the issue of not receiving it from the first time. > --- Applied, thanks ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-15 10:55 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <1514205777-22188-1-git-send-email-wisamm@mellanox.com> 2018-01-04 9:05 ` [dpdk-dev] [PATCH] app/testpmd: add eth peer CLI command Wisam Monther 2018-01-10 6:57 ` Lu, Wenzhuo 2018-01-12 18:00 ` Thomas Monjalon 2018-01-14 8:27 ` [dpdk-dev] [PATCH v2] " Wisam Jaddo 2018-01-15 10:54 ` Thomas Monjalon
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).