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 57184A054F; Mon, 15 Feb 2021 17:22:22 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 936771606EA; Mon, 15 Feb 2021 17:22:01 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id 0BD6B406FF for ; Mon, 15 Feb 2021 17:21:57 +0100 (CET) IronPort-SDR: 8W7aif+pld3hEhK3g1uPcror8NiZ0yib0ehYwzTcKLpSzqbYsjFKp6M7veLT/cg659FBHzV2oR EcBKcyS2bxOw== X-IronPort-AV: E=McAfee;i="6000,8403,9896"; a="201892851" X-IronPort-AV: E=Sophos;i="5.81,181,1610438400"; d="scan'208";a="201892851" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Feb 2021 08:21:56 -0800 IronPort-SDR: 4Syx7K/3QXNi3MBS3dZ+6uuEtjBJe3ihHJRE/magnugLP3FO7O9QaX3FQi52pJUz4eltXMGX08 bhRAayNRXFKw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,181,1610438400"; d="scan'208";a="383421606" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.107]) by fmsmga008.fm.intel.com with ESMTP; 15 Feb 2021 08:21:55 -0800 From: Cristian Dumitrescu To: dev@dpdk.org Date: Mon, 15 Feb 2021 16:21:50 +0000 Message-Id: <20210215162151.5655-4-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210215162151.5655-1-cristian.dumitrescu@intel.com> References: <20210215162151.5655-1-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH 4/5] table: add table entry priority 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" Add support for table entry priority, which is required for the wildcard match/ACL table type. Signed-off-by: Cristian Dumitrescu --- 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