DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wisam Jaddo <wisamm@mellanox.com>
To: thomas@monjalon.net, jackmin@mellanox.com, asafp@mellanox.com
Cc: dev@dpdk.org, wisamm@mellanox.com
Subject: [dpdk-dev] [PATCH v4] app/flow-perf: fix condition of hairpin queues setup
Date: Thu, 16 Jul 2020 14:16:56 +0000
Message-ID: <20200716141656.10596-1-wisamm@mellanox.com> (raw)
In-Reply-To: <20200706083241.9073-1-wisamm@mellanox.com>

The hairpin queue is the one that start from normal rxq,
and will be less than nr_queues where nr_queues is the
sum of normal and hairpin

Fixes: bf3688f1e816 ("app/flow-perf: add insertion rate calculation")
Cc: wisamm@mellanox.com

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Reviewed-by: Asaf Penso <asafp@mellanox.com>
---
v4:
* Rename hairpin variables to meaningful names.

v3:
* Add variable documentation variable declaration.

v2:
* Add documentation of hairpin peering and allocating logic.
* Add documentation for some variables.
---
 app/test-flow-perf/main.c | 40 ++++++++++++++++++++++-----------------
 1 file changed, 23 insertions(+), 17 deletions(-)

diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c
index e155e49c37..9fb8d1feaf 100644
--- a/app/test-flow-perf/main.c
+++ b/app/test-flow-perf/main.c
@@ -59,7 +59,7 @@ static struct rte_mempool *mbuf_mp;
 static uint32_t nb_lcores;
 static uint32_t flows_count;
 static uint32_t iterations_number;
-static uint32_t hairpinq;
+static uint32_t hairpin_queues_num; /* total hairpin q number - default: 0 */
 static uint32_t nb_lcores;
 
 #define MAX_PKT_BURST    32
@@ -323,7 +323,7 @@ args_parse(int argc, char **argv)
 	flow_items = 0;
 	flow_actions = 0;
 	flow_attrs = 0;
-	hairpinq = 0;
+	hairpin_queues_num = 0;
 	argvopt = argv;
 
 	printf(":: Flow -> ");
@@ -358,7 +358,7 @@ args_parse(int argc, char **argv)
 					"hairpin-rss") == 0) {
 				n = atoi(optarg);
 				if (n > 0)
-					hairpinq = n;
+					hairpin_queues_num = n;
 				else
 					rte_exit(EXIT_SUCCESS,
 						"Hairpin queues should be > 0\n");
@@ -370,7 +370,7 @@ args_parse(int argc, char **argv)
 					"hairpin-queue") == 0) {
 				n = atoi(optarg);
 				if (n > 0)
-					hairpinq = n;
+					hairpin_queues_num = n;
 				else
 					rte_exit(EXIT_SUCCESS,
 						"Hairpin queues should be > 0\n");
@@ -604,7 +604,8 @@ flows_handler(void)
 		for (i = 0; i < flows_count; i++) {
 			flow = generate_flow(port_id, flow_group,
 				flow_attrs, flow_items, flow_actions,
-				JUMP_ACTION_TABLE, i, hairpinq, &error);
+				JUMP_ACTION_TABLE, i,
+				hairpin_queues_num, &error);
 
 			if (force_quit)
 				i = flows_count;
@@ -929,7 +930,7 @@ init_port(void)
 {
 	int ret;
 	uint16_t std_queue;
-	uint16_t hairpin_q;
+	uint16_t hairpin_queue;
 	uint16_t port_id;
 	uint16_t nr_ports;
 	uint16_t nr_queues;
@@ -947,8 +948,8 @@ init_port(void)
 	struct rte_eth_dev_info dev_info;
 
 	nr_queues = RXQ_NUM;
-	if (hairpinq != 0)
-		nr_queues = RXQ_NUM + hairpinq;
+	if (hairpin_queues_num != 0)
+		nr_queues = RXQ_NUM + hairpin_queues_num;
 
 	nr_ports = rte_eth_dev_count_avail();
 	if (nr_ports == 0)
@@ -1011,15 +1012,20 @@ init_port(void)
 				":: promiscuous mode enable failed: err=%s, port=%u\n",
 				rte_strerror(-ret), port_id);
 
-		if (hairpinq != 0) {
-			for (hairpin_q = RXQ_NUM, std_queue = 0;
-					std_queue < nr_queues;
-					hairpin_q++, std_queue++) {
+		if (hairpin_queues_num != 0) {
+			/*
+			 * Configure peer which represents hairpin Tx.
+			 * Hairpin queue numbers start after standard queues
+			 * (RXQ_NUM and TXQ_NUM).
+			 */
+			for (hairpin_queue = RXQ_NUM, std_queue = 0;
+					hairpin_queue < nr_queues;
+					hairpin_queue++, std_queue++) {
 				hairpin_conf.peers[0].port = port_id;
 				hairpin_conf.peers[0].queue =
 					std_queue + TXQ_NUM;
 				ret = rte_eth_rx_hairpin_queue_setup(
-						port_id, hairpin_q,
+						port_id, hairpin_queue,
 						NR_RXD, &hairpin_conf);
 				if (ret != 0)
 					rte_exit(EXIT_FAILURE,
@@ -1027,14 +1033,14 @@ init_port(void)
 						ret, port_id);
 			}
 
-			for (hairpin_q = TXQ_NUM, std_queue = 0;
-					std_queue < nr_queues;
-					hairpin_q++, std_queue++) {
+			for (hairpin_queue = TXQ_NUM, std_queue = 0;
+					hairpin_queue < nr_queues;
+					hairpin_queue++, std_queue++) {
 				hairpin_conf.peers[0].port = port_id;
 				hairpin_conf.peers[0].queue =
 					std_queue + RXQ_NUM;
 				ret = rte_eth_tx_hairpin_queue_setup(
-						port_id, hairpin_q,
+						port_id, hairpin_queue,
 						NR_TXD, &hairpin_conf);
 				if (ret != 0)
 					rte_exit(EXIT_FAILURE,
-- 
2.17.1


  reply	other threads:[~2020-07-16 14:17 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-30  8:10 [dpdk-dev] [PATCH] " Wisam Jaddo
2020-07-05 15:39 ` Asaf Penso
2020-07-05 20:39 ` Thomas Monjalon
2020-07-06  8:00   ` Wisam Monther
2020-07-06  7:53 ` [dpdk-dev] [PATCH v2] " Wisam Jaddo
2020-07-06  8:15   ` Thomas Monjalon
2020-07-06  8:32   ` [dpdk-dev] [PATCH v3] " Wisam Jaddo
2020-07-16 14:16     ` Wisam Jaddo [this message]
2020-07-19 13:11       ` [dpdk-dev] [PATCH v4] " 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=20200716141656.10596-1-wisamm@mellanox.com \
    --to=wisamm@mellanox.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

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git