DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: ferruh.yigit@intel.com
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,
	Wei Zhao <wei.zhao1@intel.com>
Subject: [dpdk-dev] [PATCH v2 19/40] net/ice/base: reduce profile to recip info get from firmware
Date: Fri, 11 Sep 2020 21:19:33 +0800	[thread overview]
Message-ID: <20200911131954.15999-20-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20200911131954.15999-1-qi.z.zhang@intel.com>

Only need to get profile_to_recip info from firmware for
profiles used by switch, no need for other free profile
in order that we can reduce the time consumed when
download a switch rule.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/base/ice_flex_pipe.c | 115 +++++++++++++++++++++++++----------
 drivers/net/ice/base/ice_switch.c    |   2 +-
 drivers/net/ice/base/ice_type.h      |   1 +
 3 files changed, 85 insertions(+), 33 deletions(-)

diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index 923d99448..8d918eff7 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -1345,6 +1345,88 @@ ice_chk_pkg_compat(struct ice_hw *hw, struct ice_pkg_hdr *ospkg,
 }
 
 /**
+ * ice_sw_fv_handler
+ * @sect_type: section type
+ * @section: pointer to section
+ * @index: index of the field vector entry to be returned
+ * @offset: ptr to variable that receives the offset in the field vector table
+ *
+ * This is a callback function that can be passed to ice_pkg_enum_entry.
+ * This function treats the given section as of type ice_sw_fv_section and
+ * enumerates offset field. "offset" is an index into the field vector table.
+ */
+static void *
+ice_sw_fv_handler(u32 sect_type, void *section, u32 index, u32 *offset)
+{
+	struct ice_sw_fv_section *fv_section =
+		(struct ice_sw_fv_section *)section;
+
+	if (!section || sect_type != ICE_SID_FLD_VEC_SW)
+		return NULL;
+	if (index >= LE16_TO_CPU(fv_section->count))
+		return NULL;
+	if (offset)
+		/* "index" passed in to this function is relative to a given
+		 * 4k block. To get to the true index into the field vector
+		 * table need to add the relative index to the base_offset
+		 * field of this section
+		 */
+		*offset = LE16_TO_CPU(fv_section->base_offset) + index;
+	return fv_section->fv + index;
+}
+
+/**
+ * ice_get_prof_index_max - get the max profile index for used profile
+ * @hw: pointer to the HW struct
+ *
+ * Calling this function will get the max profile index for used profile
+ * and store the index number in struct ice_switch_info *switch_info
+ * in hw for following use.
+ */
+static int ice_get_prof_index_max(struct ice_hw *hw)
+{
+	u16 prof_index = 0, j, max_prof_index = 0;
+	struct ice_pkg_enum state;
+	struct ice_seg *ice_seg;
+	bool flag = false;
+	struct ice_fv *fv;
+	u32 offset;
+
+	ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM);
+
+	if (!hw->seg)
+		return ICE_ERR_PARAM;
+
+	ice_seg = hw->seg;
+
+	do {
+		fv = (struct ice_fv *)
+			ice_pkg_enum_entry(ice_seg, &state, ICE_SID_FLD_VEC_SW,
+					   &offset, ice_sw_fv_handler);
+		if (!fv)
+			break;
+		ice_seg = NULL;
+
+		/* in the profile that not be used, the prot_id is set to 0xff
+		 * and the off is set to 0x1ff for all the field vectors.
+		 */
+		for (j = 0; j < hw->blk[ICE_BLK_SW].es.fvw; j++)
+			if (fv->ew[j].prot_id != ICE_PROT_INVALID ||
+			    fv->ew[j].off != ICE_FV_OFFSET_INVAL)
+				flag = true;
+		if (flag && prof_index > max_prof_index)
+			max_prof_index = prof_index;
+
+		prof_index++;
+		flag = false;
+	} while (fv);
+
+	hw->switch_info->max_used_prof_index = max_prof_index;
+
+	return ICE_SUCCESS;
+}
+
+/**
  * ice_init_pkg - initialize/download package
  * @hw: pointer to the hardware structure
  * @buf: pointer to the package buffer
@@ -1423,6 +1505,7 @@ enum ice_status ice_init_pkg(struct ice_hw *hw, u8 *buf, u32 len)
 		 */
 		ice_init_pkg_regs(hw);
 		ice_fill_blk_tbls(hw);
+		ice_get_prof_index_max(hw);
 	} else {
 		ice_debug(hw, ICE_DBG_INIT, "package load failed, %d\n",
 			  status);
@@ -1500,38 +1583,6 @@ static struct ice_buf_build *ice_pkg_buf_alloc(struct ice_hw *hw)
 }
 
 /**
- * ice_sw_fv_handler
- * @sect_type: section type
- * @section: pointer to section
- * @index: index of the field vector entry to be returned
- * @offset: ptr to variable that receives the offset in the field vector table
- *
- * This is a callback function that can be passed to ice_pkg_enum_entry.
- * This function treats the given section as of type ice_sw_fv_section and
- * enumerates offset field. "offset" is an index into the field vector
- * vector table.
- */
-static void *
-ice_sw_fv_handler(u32 sect_type, void *section, u32 index, u32 *offset)
-{
-	struct ice_sw_fv_section *fv_section =
-		(struct ice_sw_fv_section *)section;
-
-	if (!section || sect_type != ICE_SID_FLD_VEC_SW)
-		return NULL;
-	if (index >= LE16_TO_CPU(fv_section->count))
-		return NULL;
-	if (offset)
-		/* "index" passed in to this function is relative to a given
-		 * 4k block. To get to the true index into the field vector
-		 * table need to add the relative index to the base_offset
-		 * field of this section
-		 */
-		*offset = LE16_TO_CPU(fv_section->base_offset) + index;
-	return fv_section->fv + index;
-}
-
-/**
  * ice_get_sw_prof_type - determine switch profile type
  * @hw: pointer to the HW structure
  * @fv: pointer to the switch field vector
diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index a82af6fa0..4d193b30f 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -1591,7 +1591,7 @@ static void ice_get_recp_to_prof_map(struct ice_hw *hw)
 	ice_declare_bitmap(r_bitmap, ICE_MAX_NUM_RECIPES);
 	u16 i;
 
-	for (i = 0; i < ICE_MAX_NUM_PROFILES; i++) {
+	for (i = 0; i < hw->switch_info->max_used_prof_index + 1; i++) {
 		u16 j;
 
 		ice_zero_bitmap(profile_to_recipe[i], ICE_MAX_NUM_RECIPES);
diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h
index 997f97e0d..266f5500a 100644
--- a/drivers/net/ice/base/ice_type.h
+++ b/drivers/net/ice/base/ice_type.h
@@ -792,6 +792,7 @@ struct ice_switch_info {
 	struct LIST_HEAD_TYPE vsi_list_map_head;
 	struct ice_sw_recipe *recp_list;
 	u16 prof_res_bm_init;
+	u16 max_used_prof_index;
 
 	ice_declare_bitmap(prof_res_bm[ICE_MAX_NUM_PROFILES], ICE_MAX_FV_WORDS);
 };
-- 
2.13.6


  parent reply	other threads:[~2020-09-11 13:19 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-07 11:27 [dpdk-dev] [PATCH 00/40] ice base code update Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 01/40] net/ice/base: handle error gracefully in HW table calloc Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 02/40] net/ice/base: split caps discover into two functions Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 03/40] net/ice/base: avoid unnecessary single-member variable-length structs Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 04/40] net/ice/base: fix issues around move nodes Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 05/40] net/ice/base: cleanup stack hog Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 06/40] net/ice/base: clean the code wrapping Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 07/40] net/ice/base: cleanup misleading comment Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 08/40] net/ice/base: silence static analysis warning Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 09/40] net/ice/base: replace single-element array used for C struct hack Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 10/40] net/ice/base: introduce and use bitmap set API Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 11/40] net/ice/base: introduce and use bitmap hamming weight API Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 12/40] net/ice/base: add function header Qi Zhang
2020-09-07 11:27 ` [dpdk-dev] [PATCH 13/40] net/ice/base: introduce and use for each bit iterator Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 14/40] net/ice/base: correct abbreviations Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 15/40] net/ice/base: add AQ cmd 0X0A0A LLDP fltr control Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 16/40] net/ice/base: add support for GTP-U type switch rule Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 17/40] net/ice/base: join format strings to same line Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 18/40] net/ice/base: introduce Tx rate limiting on port level Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 19/40] net/ice/base: reduce profile to recip info get from firmware Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 20/40] net/ice/base: refactor DCB related variables Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 21/40] net/ice/base: support outer IP filter for GTPC Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 22/40] net/ice/base: support outer IP filter for GTPU without inner IP Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 23/40] net/ice/base: move a function Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 24/40] net/ice/base: clear advanced rules in reset preparation Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 25/40] net/ice/base: move a function Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 26/40] net/ice/base: add check for failed acts allocation Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 27/40] net/ice/base: remove repeated words Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 28/40] net/ice/base: remove function ACL count query Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 29/40] net/ice/base: preserve NVM capabilities in safe mode Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 30/40] net/ice/base: misc minor ACL changes Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 31/40] net/ice/base: adjust rate limit profile ids runtime database Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 32/40] net/ice/base: enable QinQ filter for switch advanced rule Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 33/40] net/ice/base: create flash info structure and separate NVM version Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 34/40] net/ice/base: remove unused parameter Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 35/40] net/ice/base: minor code clean Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 36/40] net/ice/base: cache NVM module bank information Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 37/40] net/ice/base: rename function Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 38/40] net/ice/base: remove unnecessary conditional Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 39/40] net/ice/base: rename ACL priority values Qi Zhang
2020-09-07 11:28 ` [dpdk-dev] [PATCH 40/40] net/ice/base: preserve default aggr vsi information Qi Zhang
2020-09-09  7:16 ` [dpdk-dev] [PATCH 00/40] ice base code update Yang, Qiming
2020-09-10  3:26   ` Zhang, Qi Z
2020-09-11 11:07     ` Ferruh Yigit
2020-09-11 11:52       ` Zhang, Qi Z
2020-09-11 12:23         ` Ferruh Yigit
2020-09-11 13:19 ` [dpdk-dev] [PATCH v2 " Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 01/40] net/ice/base: handle error gracefully in HW table calloc Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 02/40] net/ice/base: split caps discover into two functions Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 03/40] net/ice/base: avoid unnecessary single-member variable-length structs Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 04/40] net/ice/base: fix issues around move nodes Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 05/40] net/ice/base: cleanup stack hog Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 06/40] net/ice/base: clean the code wrapping Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 07/40] net/ice/base: cleanup misleading comment Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 08/40] net/ice/base: silence static analysis warning Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 09/40] net/ice/base: replace single-element array used for C struct hack Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 10/40] net/ice/base: introduce and use bitmap set API Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 11/40] net/ice/base: introduce and use bitmap hamming weight API Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 12/40] net/ice/base: add function header Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 13/40] net/ice/base: introduce and use for each bit iterator Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 14/40] net/ice/base: correct abbreviations Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 15/40] net/ice/base: add AQ cmd 0X0A0A LLDP fltr control Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 16/40] net/ice/base: add support for GTP-U type switch rule Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 17/40] net/ice/base: join format strings to same line Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 18/40] net/ice/base: introduce Tx rate limiting on port level Qi Zhang
2020-09-11 13:19   ` Qi Zhang [this message]
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 20/40] net/ice/base: refactor DCB related variables Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 21/40] net/ice/base: support outer IP filter for GTPC Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 22/40] net/ice/base: support outer IP filter for GTPU without inner IP Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 23/40] net/ice/base: move a function Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 24/40] net/ice/base: clear advanced rules in reset preparation Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 25/40] net/ice/base: move a function Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 26/40] net/ice/base: add check for failed acts allocation Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 27/40] net/ice/base: remove repeated words Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 28/40] net/ice/base: remove function ACL count query Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 29/40] net/ice/base: preserve NVM capabilities in safe mode Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 30/40] net/ice/base: misc minor ACL changes Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 31/40] net/ice/base: adjust rate limit profile ids runtime database Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 32/40] net/ice/base: enable QinQ filter for switch advanced rule Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 33/40] net/ice/base: create flash info structure and separate NVM version Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 34/40] net/ice/base: remove unused parameter Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 35/40] net/ice/base: minor code clean Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 36/40] net/ice/base: cache NVM module bank information Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 37/40] net/ice/base: rename function Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 38/40] net/ice/base: remove unnecessary conditional Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 39/40] net/ice/base: rename ACL priority values Qi Zhang
2020-09-11 13:19   ` [dpdk-dev] [PATCH v2 40/40] net/ice/base: preserve default aggr vsi information Qi Zhang

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=20200911131954.15999-20-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=wei.zhao1@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).