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 90B2CA054D; Tue, 16 Feb 2021 21:21:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2987E16077B; Tue, 16 Feb 2021 21:21:36 +0100 (CET) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by mails.dpdk.org (Postfix) with ESMTP id 337E140690 for ; Tue, 16 Feb 2021 21:21:33 +0100 (CET) IronPort-SDR: mz5MAdDyPxjko5I8Khzf/JfKwe0KAi0OlqethGHDeNc+xF86JyVWrdPbwSfCVK3NjkCooSMlEL paA6Fx6fZHDg== X-IronPort-AV: E=McAfee;i="6000,8403,9897"; a="170669079" X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="170669079" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2021 12:21:32 -0800 IronPort-SDR: DsK40J8dlavX0cdt8OCuK1W2/VsZetPRevcDmcPVsA8G5KwlNLOtLlPxaRL0hgI1UIear8VB/r PLaiHCibJs8g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.81,184,1610438400"; d="scan'208";a="592507256" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com) ([10.237.223.107]) by fmsmga005.fm.intel.com with ESMTP; 16 Feb 2021 12:21:31 -0800 From: Cristian Dumitrescu To: dev@dpdk.org Date: Tue, 16 Feb 2021 20:21:26 +0000 Message-Id: <20210216202127.22803-4-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210216202127.22803-1-cristian.dumitrescu@intel.com> References: <20210216202127.22803-1-cristian.dumitrescu@intel.com> Subject: [dpdk-dev] [PATCH v2 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 3e8e283c3..38711b15c 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) { @@ -1673,6 +1676,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. */ @@ -1769,6 +1794,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