DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wisam Jaddo <wisamm@mellanox.com>
To: dev@dpdk.org, thomas@monjalon.net, asafp@mellanox.com,
	akozyrev@nvidia.com, akozyrev@mellanox.com,
	arybchenko@solarflare.com, jackmin@mellanox.com
Subject: [dpdk-dev] [PATCH 11/13] app/flow-perf: add set port mask to options
Date: Sun, 30 Aug 2020 11:15:42 +0000	[thread overview]
Message-ID: <20200830111544.4190-12-wisamm@mellanox.com> (raw)
In-Reply-To: <20200830111544.4190-1-wisamm@mellanox.com>

Sometimes you need to check flow performance for
certain port and not all ports. Thus a portmask
option is needed.

Usage:
--portmask=N

Where N represent the hexadecimal bitmask of ports
used.

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-flow-perf/main.c              | 20 ++++++++++++++++++++
 doc/guides/rel_notes/release_20_08.rst |  4 +++-
 doc/guides/tools/flow-perf.rst         |  3 +++
 3 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index 0a030a462c..18199c6e2e 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -53,6 +53,7 @@ static uint64_t flow_actions[MAX_ACTIONS_NUM];
 static uint64_t flow_attrs[MAX_ATTRS_NUM];
 static uint8_t items_idx, actions_idx, attrs_idx;
 
+static uint64_t ports_mask;
 static volatile bool force_quit;
 static bool dump_iterations;
 static bool delete_flag;
@@ -106,6 +107,7 @@ usage(char *progname)
 	printf("  --dump-socket-mem: To dump all socket memory\n");
 	printf("  --enable-fwd: To enable packets forwarding"
 		" after insertion\n");
+	printf("  --portmask=N: hexadecimal bitmask of ports used\n");
 
 	printf("To set flow attributes:\n");
 	printf("  --ingress: set ingress attribute in flows\n");
@@ -189,8 +191,10 @@ usage(char *progname)
 static void
 args_parse(int argc, char **argv)
 {
+	uint64_t pm;
 	char **argvopt;
 	char *token;
+	char *end;
 	int n, opt;
 	int opt_idx;
 	size_t i;
@@ -514,6 +518,7 @@ args_parse(int argc, char **argv)
 		{ "deletion-rate",              0, 0, 0 },
 		{ "dump-socket-mem",            0, 0, 0 },
 		{ "enable-fwd",                 0, 0, 0 },
+		{ "portmask",                   1, 0, 0 },
 		/* Attributes */
 		{ "ingress",                    0, 0, 0 },
 		{ "egress",                     0, 0, 0 },
@@ -568,6 +573,9 @@ args_parse(int argc, char **argv)
 		{ "vxlan-decap",                0, 0, 0 },
 	};
 
+	RTE_ETH_FOREACH_DEV(i)
+		ports_mask |= 1 << i;
+
 	hairpin_queues_num = 0;
 	argvopt = argv;
 
@@ -703,6 +711,15 @@ args_parse(int argc, char **argv)
 			if (strcmp(lgopts[opt_idx].name,
 					"enable-fwd") == 0)
 				enable_fwd = true;
+			if (strcmp(lgopts[opt_idx].name,
+					"portmask") == 0) {
+				/* parse hexadecimal string */
+				end = NULL;
+				pm = strtoull(optarg, &end, 16);
+				if ((optarg[0] == '\0') || (end == NULL) || (*end != '\0'))
+					rte_exit(EXIT_FAILURE, "Invalid fwd port mask\n");
+				ports_mask = pm;
+			}
 			break;
 		default:
 			fprintf(stderr, "Invalid option: %s\n", argv[optind]);
@@ -880,6 +897,9 @@ flows_handler(void)
 		rte_exit(EXIT_FAILURE, "No Memory available!");
 
 	for (port_id = 0; port_id < nr_ports; port_id++) {
+		/* If port outside portmask */
+		if (!((ports_mask >> port_id) & 0x1))
+			continue;
 		cpu_time_used = 0;
 		flow_index = 0;
 		if (flow_group > 0) {
diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst
index c0f7ab6293..b21f0bfb03 100644
--- a/doc/guides/rel_notes/release_20_08.rst
+++ b/doc/guides/rel_notes/release_20_08.rst
@@ -284,7 +284,9 @@ New Features
   * Start supporting flag action.
   * Start supporting raw-encap and raw-decap actions.
   * Start supporting vxlan-encap and vxlan-decap actions.
-
+  * Add new option to set portmask for insertion/deletion:
+    ``--portmask=N`` Where N represent the hexadecimal
+    bitmask of ports used.
 
 Removed Items
 -------------
diff --git a/doc/guides/tools/flow-perf.rst b/doc/guides/tools/flow-perf.rst
index 15b4273cc0..bbefc978c6 100644
--- a/doc/guides/tools/flow-perf.rst
+++ b/doc/guides/tools/flow-perf.rst
@@ -84,6 +84,9 @@ The command line options are:
 *	``--enable-fwd``
 	Enable packets forwarding after insertion/deletion operations.
 
+*	``--portmask=N``
+	hexadecimal bitmask of ports to be used.
+
 
 Attributes:
 
-- 
2.17.1


  parent reply	other threads:[~2020-08-30 11:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-30 11:15 [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 01/13] app/flow-perf: fix actions mask macro usage Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 02/13] doc/flow-perf: fix app sections Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 03/13] app/flow-perf: start supporting user order Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 04/13] app/flow-perf: add header modify actions support Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 05/13] app/flow-perf: add flag action support Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 06/13] app/flow-perf: fix memory leak from RSS action Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 07/13] app/flow-perf: add raw encap/decap actions support Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 08/13] app/flow-perf: add VXLAN " Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 09/13] app/flow-perf: fix source ipv4 matching Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 10/13] app/flow-perf: add random mark id values Wisam Jaddo
2020-08-30 11:15 ` Wisam Jaddo [this message]
2020-08-30 11:15 ` [dpdk-dev] [PATCH 12/13] app/flow-perf: add icmp matching support Wisam Jaddo
2020-08-30 11:15 ` [dpdk-dev] [PATCH 13/13] app/flow-perf: allow fixed values for actions Wisam Jaddo
2020-09-14 18:15 ` [dpdk-dev] [PATCH 00/13] app/flow-perf: add support for new items/actions Ferruh Yigit
2020-09-21 21:36 ` 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=20200830111544.4190-12-wisamm@mellanox.com \
    --to=wisamm@mellanox.com \
    --cc=akozyrev@mellanox.com \
    --cc=akozyrev@nvidia.com \
    --cc=arybchenko@solarflare.com \
    --cc=asafp@mellanox.com \
    --cc=dev@dpdk.org \
    --cc=jackmin@mellanox.com \
    --cc=thomas@monjalon.net \
    /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).