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 C9A58A0C46; Fri, 17 Sep 2021 16:42:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D73F0411BF; Fri, 17 Sep 2021 16:40:52 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id A91E841197 for ; Fri, 17 Sep 2021 16:40:40 +0200 (CEST) X-IronPort-AV: E=McAfee;i="6200,9189,10110"; a="210040075" X-IronPort-AV: E=Sophos;i="5.85,301,1624345200"; d="scan'208";a="210040075" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Sep 2021 07:40:40 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,301,1624345200"; d="scan'208";a="546445491" Received: from dpdk51.sh.intel.com ([10.67.111.142]) by FMSMGA003.fm.intel.com with ESMTP; 17 Sep 2021 07:40:39 -0700 From: Qi Zhang To: qiming.yang@intel.com Cc: junfeng.guo@intel.com, dev@dpdk.org, Qi Zhang Date: Fri, 17 Sep 2021 22:43:17 +0800 Message-Id: <20210917144322.3141886-16-qi.z.zhang@intel.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210917144322.3141886-1-qi.z.zhang@intel.com> References: <20210917144322.3141886-1-qi.z.zhang@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH v2 15/20] net/ice/base: add helper function to redirect flags 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_flg_redirect to redirect parser flags to packet flags. Signed-off-by: Qi Zhang --- drivers/net/ice/base/ice_flg_rd.c | 23 +++++++++++++++++++++++ drivers/net/ice/base/ice_flg_rd.h | 1 + 2 files changed, 24 insertions(+) diff --git a/drivers/net/ice/base/ice_flg_rd.c b/drivers/net/ice/base/ice_flg_rd.c index 292916d9a8..833986cac3 100644 --- a/drivers/net/ice/base/ice_flg_rd.c +++ b/drivers/net/ice/base/ice_flg_rd.c @@ -51,3 +51,26 @@ struct ice_flg_rd_item *ice_flg_rd_table_get(struct ice_hw *hw) ice_parser_sect_item_get, _flg_rd_parse_item, false); } + +/** + * ice_flg_redirect - redirect a parser flag to packet flag + * @table: flag redirect table + * @psr_flg: parser flag to redirect + */ +u64 ice_flg_redirect(struct ice_flg_rd_item *table, u64 psr_flg) +{ + u64 flg = 0; + int i; + + for (i = 0; i < 64; i++) { + struct ice_flg_rd_item *item = &table[i]; + + if (!item->expose) + continue; + + if (psr_flg & (1ul << item->intr_flg_id)) + flg |= (1ul << i); + } + + return flg; +} diff --git a/drivers/net/ice/base/ice_flg_rd.h b/drivers/net/ice/base/ice_flg_rd.h index e65350f18c..6c3e01b0fa 100644 --- a/drivers/net/ice/base/ice_flg_rd.h +++ b/drivers/net/ice/base/ice_flg_rd.h @@ -13,4 +13,5 @@ struct ice_flg_rd_item { void ice_flg_rd_dump(struct ice_hw *hw, struct ice_flg_rd_item *item); struct ice_flg_rd_item *ice_flg_rd_table_get(struct ice_hw *hw); +u64 ice_flg_redirect(struct ice_flg_rd_item *table, u64 psr_flg); #endif /* _ICE_FLG_RD_H_ */ -- 2.26.2