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 90488A0C46; Fri, 17 Sep 2021 13:01:29 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 120BD41167; Fri, 17 Sep 2021 13:00:02 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 3DCFB4115C for ; Fri, 17 Sep 2021 12:59:59 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10109"; a="286458735" X-IronPort-AV: E=Sophos;i="5.85,301,1624345200"; d="scan'208";a="286458735" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2021 03:59:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,301,1624345200"; d="scan'208";a="699440797" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by fmsmga006.fm.intel.com with ESMTP; 17 Sep 2021 03:59:57 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: junfeng.guo@intel.com, dev@dpdk.org, Qi Zhang Date: Fri, 17 Sep 2021 19:02:36 +0800 Message-Id: <20210917110242.3127658-15-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210917110242.3127658-1-qi.z.zhang@intel.com> References: <20210917110242.3127658-1-qi.z.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 14/20] net/ice/base: add helper function for ptype markers match 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 internal helper function ice_ptype_mk_tcam_match for ptype markers matching in tcam table. Signed-off-by: Qi Zhang --- 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