DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v2] table: fix actions with different data size
@ 2021-03-16 15:09 Cristian Dumitrescu
  2021-03-17 11:42 ` [dpdk-dev] [PATCH v3] " Cristian Dumitrescu
  0 siblings, 1 reply; 3+ messages in thread
From: Cristian Dumitrescu @ 2021-03-16 15:09 UTC (permalink / raw)
  To: dev; +Cc: stable, Churchill Khangar

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 <churchill.khangar@intel.com>
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_table/rte_swx_table_em.c | 7 +++----
 1 file changed, 3 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..6886a82ba 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,7 @@ 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);
+	CHECK(!entry->action_data || t->params.action_data_size, EINVAL);
 
 	input_sig = hash(entry->key, t->key_mask, t->key_size, 0);
 	bkt_id = input_sig & (t->n_buckets - 1);
-- 
2.17.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-dev] [PATCH v3] table: fix actions with different data size
  2021-03-16 15:09 [dpdk-dev] [PATCH v2] table: fix actions with different data size Cristian Dumitrescu
@ 2021-03-17 11:42 ` Cristian Dumitrescu
  2021-03-23 17:35   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Cristian Dumitrescu @ 2021-03-17 11:42 UTC (permalink / raw)
  To: dev; +Cc: stable, Churchill Khangar

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 <churchill.khangar@intel.com>
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH v3] table: fix actions with different data size
  2021-03-17 11:42 ` [dpdk-dev] [PATCH v3] " Cristian Dumitrescu
@ 2021-03-23 17:35   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2021-03-23 17:35 UTC (permalink / raw)
  To: Churchill Khangar; +Cc: dev, stable, Cristian Dumitrescu

17/03/2021 12:42, Cristian Dumitrescu:
> 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 <churchill.khangar@intel.com>
> Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
> Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>

Applied, thanks




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-03-23 17:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-16 15:09 [dpdk-dev] [PATCH v2] table: fix actions with different data size Cristian Dumitrescu
2021-03-17 11:42 ` [dpdk-dev] [PATCH v3] " Cristian Dumitrescu
2021-03-23 17:35   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).