From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9DC70A0C45; Tue, 6 Jul 2021 00:51:16 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 108FB4067E; Tue, 6 Jul 2021 00:51:16 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mails.dpdk.org (Postfix) with ESMTP id F3E8A40040; Tue, 6 Jul 2021 00:51:13 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10036"; a="206022181" X-IronPort-AV: E=Sophos;i="5.83,326,1616482800"; d="scan'208";a="206022181" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2021 15:51:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,326,1616482800"; d="scan'208";a="485655557" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.107]) by FMSMGA003.fm.intel.com with ESMTP; 05 Jul 2021 15:51:09 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: stable@dpdk.org, Venkata Suresh Kumar P , Churchill Khangar Date: Mon, 5 Jul 2021 23:51:09 +0100 Message-Id: <20210705225109.92180-1-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 Subject: [dpdk-dev] [PATCH] pipeline: fix table entry read X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Signed-off-by: Venkata Suresh Kumar P Signed-off-by: Churchill Khangar --- 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