From: Wisam Monther <wisamm@mellanox.com>
To: "jingjing.wu@intel.com" <jingjing.wu@intel.com>,
Raslan Darawsheh <rasland@mellanox.com>
Cc: "dev@dpdk.org" <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
Date: Thu, 4 Jan 2018 09:05:43 +0000 [thread overview]
Message-ID: <AM5PR0502MB2865B9251D604A9840AC3485A91F0@AM5PR0502MB2865.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <1514205777-22188-1-git-send-email-wisamm@mellanox.com>
+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
next parent reply other threads:[~2018-01-04 9:05 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1514205777-22188-1-git-send-email-wisamm@mellanox.com>
2018-01-04 9:05 ` Wisam Monther [this message]
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
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=AM5PR0502MB2865B9251D604A9840AC3485A91F0@AM5PR0502MB2865.eurprd05.prod.outlook.com \
--to=wisamm@mellanox.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.com \
--cc=orika@mellanox.com \
--cc=rasland@mellanox.com \
--cc=shahafs@mellanox.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).