DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] app/testpmd: fix flow list for async flows
@ 2022-11-07 13:16 Alexander Kozyrev
  2022-11-09 10:43 ` Andrew Rybchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kozyrev @ 2022-11-07 13:16 UTC (permalink / raw)
  To: dev; +Cc: rasland, michaelba, aman.deep.singh, yuying.zhang

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] app/testpmd: fix flow list for async flows
  2022-11-07 13:16 [PATCH] app/testpmd: fix flow list for async flows Alexander Kozyrev
@ 2022-11-09 10:43 ` Andrew Rybchenko
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Rybchenko @ 2022-11-09 10:43 UTC (permalink / raw)
  To: Alexander Kozyrev, dev; +Cc: rasland, michaelba, aman.deep.singh, yuying.zhang

On 11/7/22 16:16, Alexander Kozyrev wrote:
> 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>

Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>

Applied to dpdk-next-net/main, thanks.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-11-09 10:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-07 13:16 [PATCH] app/testpmd: fix flow list for async flows Alexander Kozyrev
2022-11-09 10:43 ` Andrew Rybchenko

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).