DPDK patches and discussions
 help / color / mirror / Atom feed
From: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 4/5] table: add table entry priority
Date: Mon, 15 Feb 2021 16:21:50 +0000	[thread overview]
Message-ID: <20210215162151.5655-4-cristian.dumitrescu@intel.com> (raw)
In-Reply-To: <20210215162151.5655-1-cristian.dumitrescu@intel.com>

Add support for table entry priority, which is required for the
wildcard match/ACL table type.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
---
 lib/librte_pipeline/rte_swx_ctl.c | 27 +++++++++++++++++++++++++++
 lib/librte_table/rte_swx_table.h  |  9 +++++++++
 2 files changed, 36 insertions(+)

diff --git a/lib/librte_pipeline/rte_swx_ctl.c b/lib/librte_pipeline/rte_swx_ctl.c
index 20e2ac067..690080d84 100644
--- a/lib/librte_pipeline/rte_swx_ctl.c
+++ b/lib/librte_pipeline/rte_swx_ctl.c
@@ -359,6 +359,9 @@ table_entry_duplicate(struct rte_swx_ctl_pipeline *ctl,
 			       entry->key_mask,
 			       table->params.key_size);
 		}
+
+		/* key_priority. */
+		new_entry->key_priority = entry->key_priority;
 	}
 
 	if (data_duplicate) {
@@ -1601,6 +1604,28 @@ rte_swx_ctl_pipeline_table_entry_read(struct rte_swx_ctl_pipeline *ctl,
 	tokens += 1 + table->info.n_match_fields;
 	n_tokens -= 1 + table->info.n_match_fields;
 
+	/*
+	 * Match priority.
+	 */
+	if (n_tokens && !strcmp(tokens[0], "priority")) {
+		char *priority = tokens[1];
+		uint32_t val;
+
+		if (n_tokens < 2)
+			goto error;
+
+		/* Parse. */
+		val = strtoul(priority, &priority, 0);
+		if (priority[0])
+			goto error;
+
+		/* Copy to entry. */
+		entry->key_priority = val;
+
+		tokens += 2;
+		n_tokens -= 2;
+	}
+
 	/*
 	 * Action.
 	 */
@@ -1697,6 +1722,8 @@ table_entry_printf(FILE *f,
 			fprintf(f, "%02x", entry->key_mask[i]);
 	}
 
+	fprintf(f, " priority %u", entry->key_priority);
+
 	fprintf(f, " action %s ", action->info.name);
 	for (i = 0; i < action->data_size; i++)
 		fprintf(f, "%02x", entry->action_data[i]);
diff --git a/lib/librte_table/rte_swx_table.h b/lib/librte_table/rte_swx_table.h
index 5a3137ec5..00446718f 100644
--- a/lib/librte_table/rte_swx_table.h
+++ b/lib/librte_table/rte_swx_table.h
@@ -89,6 +89,15 @@ struct rte_swx_table_entry {
 	 */
 	uint64_t key_signature;
 
+	/** Key priority for the current entry. Useful for wildcard match (as
+	 * match rules are commonly overlapping with other rules), ignored for
+	 * exact match (as match rules never overlap, hence all rules have the
+	 * same match priority) and for LPM (match priority is driven by the
+	 * prefix length, with non-overlapping prefixes essentially having the
+	 * same match priority). Value 0 indicates the highest match priority.
+	 */
+	uint32_t key_priority;
+
 	/** Action ID for the current entry. */
 	uint64_t action_id;
 
-- 
2.17.1


  parent reply	other threads:[~2021-02-15 16:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-15 16:21 [dpdk-dev] [PATCH 1/5] pipeline: improve table entry helpers Cristian Dumitrescu
2021-02-15 16:21 ` [dpdk-dev] [PATCH 2/5] pipeline: improve table entry parsing Cristian Dumitrescu
2021-02-15 16:21 ` [dpdk-dev] [PATCH 3/5] pipeline: support non-incremental table updates Cristian Dumitrescu
2021-02-15 16:21 ` Cristian Dumitrescu [this message]
2021-02-15 16:21 ` [dpdk-dev] [PATCH 5/5] table: add wildcard match table type Cristian Dumitrescu

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=20210215162151.5655-4-cristian.dumitrescu@intel.com \
    --to=cristian.dumitrescu@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).