]> git.droids-corp.org - dpdk.git/commitdiff
pipeline: fix table entry read
authorCristian Dumitrescu <cristian.dumitrescu@intel.com>
Mon, 5 Jul 2021 22:56:50 +0000 (23:56 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 9 Jul 2021 20:52:19 +0000 (22:52 +0200)
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

index 5d04e750f4cb4669275af7bf8257376e37d9e04c..d1a5ba431f26d5eb56823ec0824703f9a3c8b7bf 100644 (file)
@@ -1636,7 +1636,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)
@@ -1719,7 +1719,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)