DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] pipeline: fix table entry read
@ 2021-07-05 22:51 Cristian Dumitrescu
  2021-07-05 22:56 ` [dpdk-dev] [PATCH V2] " Cristian Dumitrescu
  0 siblings, 1 reply; 3+ messages in thread
From: Cristian Dumitrescu @ 2021-07-05 22:51 UTC (permalink / raw)
  To: dev; +Cc: stable, Venkata Suresh Kumar P, Churchill Khangar

The rte_swx_pipeline_table_entry_read() function is used to read from
a character string a table entry that is to be added to the table,
deleted from the table or set as the default entry of teh table.
Addition needs both the match and the part of the entry, deletion
ignores the action part, while the default set ignores the match part,
hence the need to make both the match and the action part optional.
The logic for skipping the match or the action part was broken, hence
the current fix.

Fixes: b32c0a2c5e4c ("pipeline: add SWX table update high level API")
Cc: stable@dpdk.org

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Venkata Suresh Kumar P <venkata.suresh.kumar.p@intel.com>
Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
---
 lib/pipeline/rte_swx_ctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pipeline/rte_swx_ctl.c b/lib/pipeline/rte_swx_ctl.c
index 8cabce2b9..4ee47df10 100644
--- a/lib/pipeline/rte_swx_ctl.c
+++ b/lib/pipeline/rte_swx_ctl.c
@@ -2282,7 +2282,7 @@ rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
 	/*
 	 * Match.
 	 */
-	if (n_tokens && strcmp(tokens[0], "match"))
+	if (!(n_tokens && !strcmp(tokens[0], "match")))
 		goto action;
 
 	if (n_tokens < 1 + table->info.n_match_fields)
@@ -2365,7 +2365,7 @@ rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
 	 * Action.
 	 */
 action:
-	if (n_tokens && strcmp(tokens[0], "action"))
+	if (!(n_tokens && !strcmp(tokens[0], "action")))
 		goto other;
 
 	if (n_tokens < 2)
-- 
2.17.1


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

* [dpdk-dev] [PATCH V2] pipeline: fix table entry read
  2021-07-05 22:51 [dpdk-dev] [PATCH] pipeline: fix table entry read Cristian Dumitrescu
@ 2021-07-05 22:56 ` Cristian Dumitrescu
  2021-07-09 21:12   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Cristian Dumitrescu @ 2021-07-05 22:56 UTC (permalink / raw)
  To: dev; +Cc: stable, Venkata Suresh Kumar P, Churchill Khangar

The rte_swx_pipeline_table_entry_read() function is used to read from
a character string a table entry that is to be added to the table,
deleted from the table or set as the default entry of the table.
Addition needs both the match and the part of the entry, deletion
ignores the action part, while the default set ignores the match part,
hence the need to make both the match and the action part optional.
The logic for skipping the match or the action part was broken, hence
the current fix.

Fixes: b32c0a2c5e4c ("pipeline: add SWX table update high level API")
Cc: stable@dpdk.org

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Venkata Suresh Kumar P <venkata.suresh.kumar.p@intel.com>
Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
---
 lib/pipeline/rte_swx_ctl.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/pipeline/rte_swx_ctl.c b/lib/pipeline/rte_swx_ctl.c
index 8cabce2b9..4ee47df10 100644
--- a/lib/pipeline/rte_swx_ctl.c
+++ b/lib/pipeline/rte_swx_ctl.c
@@ -2282,7 +2282,7 @@ rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
 	/*
 	 * Match.
 	 */
-	if (n_tokens && strcmp(tokens[0], "match"))
+	if (!(n_tokens && !strcmp(tokens[0], "match")))
 		goto action;
 
 	if (n_tokens < 1 + table->info.n_match_fields)
@@ -2365,7 +2365,7 @@ rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
 	 * Action.
 	 */
 action:
-	if (n_tokens && strcmp(tokens[0], "action"))
+	if (!(n_tokens && !strcmp(tokens[0], "action")))
 		goto other;
 
 	if (n_tokens < 2)
-- 
2.17.1


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

* Re: [dpdk-dev] [PATCH V2] pipeline: fix table entry read
  2021-07-05 22:56 ` [dpdk-dev] [PATCH V2] " Cristian Dumitrescu
@ 2021-07-09 21:12   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2021-07-09 21:12 UTC (permalink / raw)
  To: Cristian Dumitrescu
  Cc: dev, stable, Venkata Suresh Kumar P, Churchill Khangar

06/07/2021 00:56, Cristian Dumitrescu:
> The rte_swx_pipeline_table_entry_read() function is used to read from
> a character string a table entry that is to be added to the table,
> deleted from the table or set as the default entry of the table.
> Addition needs both the match and the part of the entry, deletion
> ignores the action part, while the default set ignores the match part,
> hence the need to make both the match and the action part optional.
> The logic for skipping the match or the action part was broken, hence
> the current fix.
> 
> Fixes: b32c0a2c5e4c ("pipeline: add SWX table update high level API")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> Signed-off-by: Venkata Suresh Kumar P <venkata.suresh.kumar.p@intel.com>
> Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>

Applied, thanks



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

end of thread, other threads:[~2021-07-09 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-05 22:51 [dpdk-dev] [PATCH] pipeline: fix table entry read Cristian Dumitrescu
2021-07-05 22:56 ` [dpdk-dev] [PATCH V2] " Cristian Dumitrescu
2021-07-09 21:12   ` Thomas Monjalon

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