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 37AC4A054D; Tue, 16 Feb 2021 21:47:08 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E24D916080C; Tue, 16 Feb 2021 21:46:54 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 6449F1607F4 for ; Tue, 16 Feb 2021 21:46:52 +0100 (CET) IronPort-SDR: 0ZSjfAULl9wgfIU3H/lZQrTYjMhIKXBoPNDEvyukvsybwYN8cf8Nl9h3xuAW77a/NTxyk9o0zs 8B8fqYFhL1FQ== X-IronPort-AV: E=McAfee;i="6000,8403,9897"; a="247078505" X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="247078505" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2021 12:46:49 -0800 IronPort-SDR: /vBDSpUTJC75Lz2gweleO/KKmxdpVaefQFh+UyHmQLjXdFYjpzxUVTEe3uFBHRhLVEVDsZAAfr aLy+ObxBaYGQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="493443111" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.107]) by fmsmga001.fm.intel.com with ESMTP; 16 Feb 2021 12:46:50 -0800 From: Cristian Dumitrescu To: dev@dpdk.org Date: Tue, 16 Feb 2021 20:46:45 +0000 Message-Id: <20210216204646.24196-4-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216204646.24196-1-cristian.dumitrescu@intel.com> References: <20210216202127.22803-1-cristian.dumitrescu@intel.com> <20210216204646.24196-1-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH v3 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 6bef9c311..2e4538bd0 100644 --- a/lib/librte_pipeline/rte_swx_ctl.c +++ b/lib/librte_pipeline/rte_swx_ctl.c @@ -386,6 +386,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) { @@ -1672,6 +1675,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. */ @@ -1768,6 +1793,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