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 1C1D2A0A02; Fri, 26 Mar 2021 21:22:30 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8C747140DEA; Fri, 26 Mar 2021 21:22:29 +0100 (CET) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id A77C440685 for ; Fri, 26 Mar 2021 21:22:27 +0100 (CET) IronPort-SDR: DdTlIAqrZyDCBW+Frw0wp6cEr1ARmYEt0z5VJZn4SilWX9sT7cCLbnRd3NpMu0oAZHeRUgUY53 as/tzkKS5llg== X-IronPort-AV: E=McAfee;i="6000,8403,9935"; a="276358384" X-IronPort-AV: E=Sophos;i="5.81,281,1610438400"; d="scan'208";a="276358384" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Mar 2021 13:22:25 -0700 IronPort-SDR: rYo/l91M7TSZT7LsPhqQh2rU+vFZFHoN0xg2Bpf1uhYI7YJTfdYh3fs7W+AC4dfFhjWHU8sHbA C/n9lX5If6qQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,281,1610438400"; d="scan'208";a="443496857" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.107]) by fmsmga002.fm.intel.com with ESMTP; 26 Mar 2021 13:22:24 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: Churchill Khangar Date: Fri, 26 Mar 2021 20:22:24 +0000 Message-Id: <20210326202224.15655-1-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210326183630.9425-1-cristian.dumitrescu@intel.com> References: <20210326183630.9425-1-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH v2] table: relax requirements for table entry action data 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" From: Churchill Khangar Currently, the table entry action data is required to be NULL when the action data size is zero. We now require that action data is ignored when the action data size is zero. This is to allow for a table entry instance to be allocated once with max action data size for the table and reused repeatedly for actions of different sizes, including zero. Signed-off-by: Cristian Dumitrescu Signed-off-by: Churchill Khangar --- lib/librte_pipeline/rte_swx_ctl.c | 3 +-- lib/librte_table/rte_swx_table.h | 9 +++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/librte_pipeline/rte_swx_ctl.c b/lib/librte_pipeline/rte_swx_ctl.c index 2e4538bd0..ca30767ef 100644 --- a/lib/librte_pipeline/rte_swx_ctl.c +++ b/lib/librte_pipeline/rte_swx_ctl.c @@ -338,8 +338,7 @@ table_entry_check(struct rte_swx_ctl_pipeline *ctl, /* action_data. */ a = &ctl->actions[entry->action_id]; - CHECK((a->data_size && entry->action_data) || - (!a->data_size && !entry->action_data), EINVAL); + CHECK(!(a->data_size && !entry->action_data), EINVAL); } return 0; diff --git a/lib/librte_table/rte_swx_table.h b/lib/librte_table/rte_swx_table.h index 00446718f..e23f2304c 100644 --- a/lib/librte_table/rte_swx_table.h +++ b/lib/librte_table/rte_swx_table.h @@ -101,10 +101,11 @@ struct rte_swx_table_entry { /** Action ID for the current entry. */ uint64_t action_id; - /** Action data for the current entry. Its size is defined by the action - * specified by the *action_id*. It must be NULL when the action data - * size of the *action_id* action is NULL. It must never exceed the - * *action_data_size* of the table. + /** Action data for the current entry. Considering S as the action data + * size of the *action_id* action, which must be less than or equal to + * the table *action_data_size*, the *action_data* field must point to + * an array of S bytes when S is non-zero. The *action_data* field is + * ignored when S is zero. */ uint8_t *action_data; }; -- 2.17.1