DPDK patches and discussions
 help / color / mirror / Atom feed
From: Alexander Kozyrev <akozyrev@nvidia.com>
To: <dev@dpdk.org>
Cc: <rasland@nvidia.com>, <michaelba@nvidia.com>,
	<aman.deep.singh@intel.com>,  <yuying.zhang@intel.com>
Subject: [PATCH] app/testpmd: fix flow list for async flows
Date: Mon, 7 Nov 2022 15:16:16 +0200	[thread overview]
Message-ID: <20221107131616.2578401-1-akozyrev@nvidia.com> (raw)

Flows created with the new asynchronous Flow API lack attributes
(direction, priority, group number). These attributes are part of
a template table for flows created via rte_flow_async_create().

When testpmd tries to list all the flows it accesses flow
attributes via pointer and crashes. Save flow attributes during
the template table creation and use them in the "flow list" output.

Fixes: ecdc927b99 ("app/testpmd: add async flow create/destroy operations")

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
---
 app/test-pmd/config.c  | 5 +++--
 app/test-pmd/testpmd.h | 1 +
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index e8a1b77c2a..cc86d9af5f 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -2448,6 +2448,8 @@ port_flow_template_table_create(portid_t port_id, uint32_t id,
 	}
 	pt->nb_pattern_templates = nb_pattern_templates;
 	pt->nb_actions_templates = nb_actions_templates;
+	rte_memcpy(&pt->flow_attr, &table_attr->flow_attr,
+		   sizeof(struct rte_flow_attr));
 	printf("Template table #%u created\n", pt->id);
 	return 0;
 }
@@ -2510,7 +2512,6 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id,
 		       const struct rte_flow_action *actions)
 {
 	struct rte_flow_op_attr op_attr = { .postpone = postpone };
-	struct rte_flow_attr flow_attr = { 0 };
 	struct rte_flow *flow;
 	struct rte_port *port;
 	struct port_flow *pf;
@@ -2570,7 +2571,7 @@ port_queue_flow_create(portid_t port_id, queueid_t queue_id,
 	}
 	job->type = QUEUE_JOB_TYPE_FLOW_CREATE;
 
-	pf = port_flow_new(&flow_attr, pattern, actions, &error);
+	pf = port_flow_new(&pt->flow_attr, pattern, actions, &error);
 	if (!pf) {
 		free(job);
 		return port_flow_complain(&error);
diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h
index 93fdb9d331..248da710a3 100644
--- a/app/test-pmd/testpmd.h
+++ b/app/test-pmd/testpmd.h
@@ -204,6 +204,7 @@ struct port_table {
 	uint32_t id; /**< Table ID. */
 	uint32_t nb_pattern_templates; /**< Number of pattern templates. */
 	uint32_t nb_actions_templates; /**< Number of actions templates. */
+	struct rte_flow_attr flow_attr; /**< Flow attributes. */
 	struct rte_flow_template_table *table; /**< PMD opaque template object */
 };
 
-- 
2.18.2


             reply	other threads:[~2022-11-07 13:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 13:16 Alexander Kozyrev [this message]
2022-11-09 10:43 ` Andrew Rybchenko

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=20221107131616.2578401-1-akozyrev@nvidia.com \
    --to=akozyrev@nvidia.com \
    --cc=aman.deep.singh@intel.com \
    --cc=dev@dpdk.org \
    --cc=michaelba@nvidia.com \
    --cc=rasland@nvidia.com \
    --cc=yuying.zhang@intel.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).