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 B5EF4A0C45; Tue, 6 Jul 2021 00:56:55 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DC754067E; Tue, 6 Jul 2021 00:56:55 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id 6292C40040; Tue, 6 Jul 2021 00:56:53 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10036"; a="196196645" X-IronPort-AV: E=Sophos;i="5.83,326,1616482800"; d="scan'208";a="196196645" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Jul 2021 15:56:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,326,1616482800"; d="scan'208";a="460501318" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.107]) by fmsmga008.fm.intel.com with ESMTP; 05 Jul 2021 15:56:50 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: stable@dpdk.org, Venkata Suresh Kumar P , Churchill Khangar Date: Mon, 5 Jul 2021 23:56:50 +0100 Message-Id: <20210705225650.92268-1-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210705225109.92180-1-cristian.dumitrescu@intel.com> References: <20210705225109.92180-1-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH V2] 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 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 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