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 BBB29A00C2; Wed, 17 Mar 2021 12:42:13 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D1314069F; Wed, 17 Mar 2021 12:42:13 +0100 (CET) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by mails.dpdk.org (Postfix) with ESMTP id 9935840687; Wed, 17 Mar 2021 12:42:10 +0100 (CET) IronPort-SDR: 9VBtgSFdlW5FAf6TYb6I12TPHqUtV0if7gnZNN03IkYlMaXnuy5ArCvt5dyNCEYAfqN/ZBwJkB Jh9TUiHhRU2g== X-IronPort-AV: E=McAfee;i="6000,8403,9925"; a="250803321" X-IronPort-AV: E=Sophos;i="5.81,256,1610438400"; d="scan'208";a="250803321" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2021 04:42:09 -0700 IronPort-SDR: 5gMXHuDZru9MFpnWtwiG/7uwN2zPPaKxW2Cxg3cUODra5hvXExrEq7tKSgwB+ZEeiauzpYPp4t peHH6S+02WYg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,256,1610438400"; d="scan'208";a="411436176" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.107]) by orsmga007.jf.intel.com with ESMTP; 17 Mar 2021 04:42:08 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: stable@dpdk.org, Churchill Khangar Date: Wed, 17 Mar 2021 11:42:07 +0000 Message-Id: <20210317114207.70660-1-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210316150909.55045-1-cristian.dumitrescu@intel.com> References: <20210316150909.55045-1-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH v3] table: fix actions with different data size 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 table layer provisions an action_id and action_data_size data bytes for each table key. This action_data_size is a maximal amount, as some actions (depending on action_id) can require zero or less data bytes than the maximal action_data_size. This fix allows for actions with different data sizes to co-exist within the same table. Fixes: d0a00966618b ("table: add exact match SWX table") Cc: stable@dpdk.org Signed-off-by: Churchill Khangar Signed-off-by: Cristian Dumitrescu Acked-by: Cristian Dumitrescu --- lib/librte_table/rte_swx_table_em.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/librte_table/rte_swx_table_em.c b/lib/librte_table/rte_swx_table_em.c index 5f6722306..788e25f6b 100644 --- a/lib/librte_table/rte_swx_table_em.c +++ b/lib/librte_table/rte_swx_table_em.c @@ -337,7 +337,7 @@ bkt_key_install(struct table *t, /* Key data. */ bkt_data = table_key_data(t, bkt_key_id); bkt_data[0] = input->action_id; - if (t->params.action_data_size) + if (t->params.action_data_size && input->action_data) memcpy(&bkt_data[1], input->action_data, t->params.action_data_size); @@ -358,7 +358,7 @@ bkt_key_data_update(struct table *t, /* Key data. */ bkt_data = table_key_data(t, bkt_key_id); bkt_data[0] = input->action_id; - if (t->params.action_data_size) + if (t->params.action_data_size && input->action_data) memcpy(&bkt_data[1], input->action_data, t->params.action_data_size); @@ -485,8 +485,6 @@ table_add(void *table, struct rte_swx_table_entry *entry) CHECK(t, EINVAL); CHECK(entry, EINVAL); CHECK(entry->key, EINVAL); - CHECK((!t->params.action_data_size && !entry->action_data) || - (t->params.action_data_size && entry->action_data), EINVAL); input_sig = hash(entry->key, t->key_mask, t->key_size, 0); bkt_id = input_sig & (t->n_buckets - 1); -- 2.17.1