DPDK patches and discussions
 help / color / mirror / Atom feed
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Cc: Churchill Khangar <churchill.khangar@intel.com>
Subject: [dpdk-dev] [PATCH v2] table: relax requirements for table entry action data
Date: Fri, 26 Mar 2021 20:22:24 +0000	[thread overview]
Message-ID: <20210326202224.15655-1-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20210326183630.9425-1-cristian.dumitrescu@intel.com>

From: Churchill Khangar <churchill.khangar@intel.com>

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


  reply	other threads:[~2021-03-26 20:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-26 18:36 [dpdk-dev] [PATCH] " Cristian Dumitrescu
2021-03-26 20:22 ` Cristian Dumitrescu [this message]
2021-04-19 18:21   ` [dpdk-dev] [PATCH v2] " Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210326202224.15655-1-cristian.dumitrescu@intel.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=churchill.khangar@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).