DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: qiming.yang@intel.com
Cc: junfeng.guo@intel.com, dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH v2 14/20] net/ice/base: add helper function for ptype markers match
Date: Fri, 17 Sep 2021 22:43:16 +0800	[thread overview]
Message-ID: <20210917144322.3141886-15-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20210917144322.3141886-1-qi.z.zhang@intel.com>

Add internal helper function ice_ptype_mk_tcam_match for ptype markers
matching in tcam table.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_ptype_mk.c | 22 ++++++++++++++++++++++
 drivers/net/ice/base/ice_ptype_mk.h |  3 +++
 2 files changed, 25 insertions(+)

diff --git a/drivers/net/ice/base/ice_ptype_mk.c b/drivers/net/ice/base/ice_ptype_mk.c
index 33623dcfbc..97c41cb586 100644
--- a/drivers/net/ice/base/ice_ptype_mk.c
+++ b/drivers/net/ice/base/ice_ptype_mk.c
@@ -52,3 +52,25 @@ struct ice_ptype_mk_tcam_item *ice_ptype_mk_tcam_table_get(struct ice_hw *hw)
 					ice_parser_sect_item_get,
 					_parse_ptype_mk_tcam_item, true);
 }
+
+/**
+ * ice_ptype_mk_tcam_match - match a pattern on a ptype marker tcam table
+ * @table: ptype marker tcam table to search
+ * @pat: pattern to match
+ * @len: length of the pattern
+ */
+struct ice_ptype_mk_tcam_item *
+ice_ptype_mk_tcam_match(struct ice_ptype_mk_tcam_item *table,
+			u8 *pat, int len)
+{
+	int i;
+
+	for (i = 0; i < ICE_PTYPE_MK_TCAM_TABLE_SIZE; i++) {
+		struct ice_ptype_mk_tcam_item *item = &table[i];
+
+		if (ice_ternary_match(item->key, item->key_inv, pat, len))
+			return item;
+	}
+
+	return NULL;
+}
diff --git a/drivers/net/ice/base/ice_ptype_mk.h b/drivers/net/ice/base/ice_ptype_mk.h
index c93cd8f0ad..2cd49b1b63 100644
--- a/drivers/net/ice/base/ice_ptype_mk.h
+++ b/drivers/net/ice/base/ice_ptype_mk.h
@@ -15,4 +15,7 @@ struct ice_ptype_mk_tcam_item {
 void ice_ptype_mk_tcam_dump(struct ice_hw *hw,
 			    struct ice_ptype_mk_tcam_item *item);
 struct ice_ptype_mk_tcam_item *ice_ptype_mk_tcam_table_get(struct ice_hw *hw);
+struct ice_ptype_mk_tcam_item *
+ice_ptype_mk_tcam_match(struct ice_ptype_mk_tcam_item *table,
+			u8 *pat, int len);
 #endif /* _ICE_PTYPE_MK_H_ */
-- 
2.26.2


  parent reply	other threads:[~2021-09-17 14:41 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17 14:43 [dpdk-dev] [PATCH v2 00/20] ice/base: add parser module Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 01/20] net/ice/base: add parser create and destroy skeleton Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 02/20] net/ice/base: init imem table for parser Qi Zhang
2021-09-21 12:51   ` Zhang, Qi Z
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 03/20] net/ice/base: init metainit " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 04/20] net/ice/base: init parse graph cam " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 05/20] net/ice/base: init boost TCAM " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 06/20] net/ice/base: init ptype marker " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 07/20] net/ice/base: init marker group " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 08/20] net/ice/base: init protocol " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 09/20] net/ice/base: init flag redirect " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 10/20] net/ice/base: init XLT key builder " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 11/20] net/ice/base: add parser runtime skeleton Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 12/20] net/ice/base: add helper function for boost TCAM match Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 13/20] net/ice/base: add helper functions for parse graph key matching Qi Zhang
2021-09-17 14:43 ` Qi Zhang [this message]
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 15/20] net/ice/base: add helper function to redirect flags Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 16/20] net/ice/base: add helper function to aggregate flags Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 17/20] net/ice/base: add parser execution main loop Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 18/20] net/ice/base: support double VLAN mode configure for parser Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 19/20] net/ice/base: add tunnel port support " Qi Zhang
2021-09-17 14:43 ` [dpdk-dev] [PATCH v2 20/20] net/ice/base: add API for parser profile initialization Qi Zhang
2021-09-18  1:59 ` [dpdk-dev] [PATCH v2 00/20] ice/base: add parser module Guo, Junfeng

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=20210917144322.3141886-15-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=junfeng.guo@intel.com \
    --cc=qiming.yang@intel.com \
    /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).