DPDK patches and discussions
 help / color / mirror / Atom feed
From: Qi Zhang <qi.z.zhang@intel.com>
To: qiming.yang@intel.com
Cc: dev@dpdk.org, Qi Zhang <qi.z.zhang@intel.com>,
	Dan Nowlin <dan.nowlin@intel.com>
Subject: [dpdk-dev] [PATCH v3 09/21] net/ice/base: update to use package info from ice segment
Date: Wed, 28 Oct 2020 11:23:08 +0800	[thread overview]
Message-ID: <20201028032320.1755208-10-qi.z.zhang@intel.com> (raw)
In-Reply-To: <20201028032320.1755208-1-qi.z.zhang@intel.com>

There are two package versions in the package binary. Today, these two
version numbers are the same. However, in the future that may change.

Update code to use the package info from the ice segment metadata
section, which is the package information that is actually downloaded to
the firmware during the download package process.

Signed-off-by: Dan Nowlin <dan.nowlin@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
 drivers/net/ice/base/ice_adminq_cmd.h |  1 +
 drivers/net/ice/base/ice_flex_pipe.c  | 44 +++++++++++++++------------
 drivers/net/ice/base/ice_flex_type.h  |  8 +++++
 drivers/net/ice/base/ice_type.h       |  8 ++---
 4 files changed, 38 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h
index fd34be2524..cadd6df384 100644
--- a/drivers/net/ice/base/ice_adminq_cmd.h
+++ b/drivers/net/ice/base/ice_adminq_cmd.h
@@ -2558,6 +2558,7 @@ struct ice_pkg_ver {
 };
 
 #define ICE_PKG_NAME_SIZE	32
+#define ICE_SEG_ID_SIZE	28
 #define ICE_SEG_NAME_SIZE	28
 
 struct ice_aqc_get_pkg_info {
diff --git a/drivers/net/ice/base/ice_flex_pipe.c b/drivers/net/ice/base/ice_flex_pipe.c
index 8d918eff7d..4a27061b3d 100644
--- a/drivers/net/ice/base/ice_flex_pipe.c
+++ b/drivers/net/ice/base/ice_flex_pipe.c
@@ -1075,34 +1075,40 @@ ice_download_pkg(struct ice_hw *hw, struct ice_seg *ice_seg)
 static enum ice_status
 ice_init_pkg_info(struct ice_hw *hw, struct ice_pkg_hdr *pkg_hdr)
 {
-	struct ice_global_metadata_seg *meta_seg;
 	struct ice_generic_seg_hdr *seg_hdr;
 
 	ice_debug(hw, ICE_DBG_TRACE, "%s\n", __func__);
 	if (!pkg_hdr)
 		return ICE_ERR_PARAM;
 
-	meta_seg = (struct ice_global_metadata_seg *)
-		   ice_find_seg_in_pkg(hw, SEGMENT_TYPE_METADATA, pkg_hdr);
-	if (meta_seg) {
-		hw->pkg_ver = meta_seg->pkg_ver;
-		ice_memcpy(hw->pkg_name, meta_seg->pkg_name,
-			   sizeof(hw->pkg_name), ICE_NONDMA_TO_NONDMA);
+	seg_hdr = (struct ice_generic_seg_hdr *)
+		ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg_hdr);
+	if (seg_hdr) {
+		struct ice_meta_sect *meta;
+		struct ice_pkg_enum state;
+
+		ice_memset(&state, 0, sizeof(state), ICE_NONDMA_MEM);
+
+		/* Get package information from the Metadata Section */
+		meta = (struct ice_meta_sect *)
+			ice_pkg_enum_section((struct ice_seg *)seg_hdr, &state,
+					     ICE_SID_METADATA);
+		if (!meta) {
+			ice_debug(hw, ICE_DBG_INIT, "Did not find ice metadata section in package\n");
+			return ICE_ERR_CFG;
+		}
+
+		hw->pkg_ver = meta->ver;
+		ice_memcpy(hw->pkg_name, meta->name, sizeof(meta->name),
+			   ICE_NONDMA_TO_NONDMA);
 
 		ice_debug(hw, ICE_DBG_PKG, "Pkg: %d.%d.%d.%d, %s\n",
-			  meta_seg->pkg_ver.major, meta_seg->pkg_ver.minor,
-			  meta_seg->pkg_ver.update, meta_seg->pkg_ver.draft,
-			  meta_seg->pkg_name);
-	} else {
-		ice_debug(hw, ICE_DBG_INIT, "Did not find metadata segment in driver package\n");
-		return ICE_ERR_CFG;
-	}
+			  meta->ver.major, meta->ver.minor, meta->ver.update,
+			  meta->ver.draft, meta->name);
 
-	seg_hdr = ice_find_seg_in_pkg(hw, SEGMENT_TYPE_ICE, pkg_hdr);
-	if (seg_hdr) {
-		hw->ice_pkg_ver = seg_hdr->seg_format_ver;
-		ice_memcpy(hw->ice_pkg_name, seg_hdr->seg_id,
-			   sizeof(hw->ice_pkg_name), ICE_NONDMA_TO_NONDMA);
+		hw->ice_seg_fmt_ver = seg_hdr->seg_format_ver;
+		ice_memcpy(hw->ice_seg_id, seg_hdr->seg_id,
+			   sizeof(hw->ice_seg_id), ICE_NONDMA_TO_NONDMA);
 
 		ice_debug(hw, ICE_DBG_PKG, "Ice Seg: %d.%d.%d.%d, %s\n",
 			  seg_hdr->seg_format_ver.major,
diff --git a/drivers/net/ice/base/ice_flex_type.h b/drivers/net/ice/base/ice_flex_type.h
index 8f33efdd62..1dd57baccd 100644
--- a/drivers/net/ice/base/ice_flex_type.h
+++ b/drivers/net/ice/base/ice_flex_type.h
@@ -114,6 +114,7 @@ struct ice_buf_hdr {
 	(ent_sz))
 
 /* ice package section IDs */
+#define ICE_SID_METADATA		1
 #define ICE_SID_XLT0_SW			10
 #define ICE_SID_XLT_KEY_BUILDER_SW	11
 #define ICE_SID_XLT1_SW			12
@@ -343,6 +344,13 @@ struct ice_ptype_attributes {
 	enum ice_ptype_attrib_type attrib;
 };
 
+struct ice_meta_sect {
+	struct ice_pkg_ver ver;
+#define ICE_META_SECT_NAME_SIZE	28
+	char name[ICE_META_SECT_NAME_SIZE];
+	__le32 track_id;
+};
+
 /* Packet Type Groups (PTG) - Inner Most fields (IM) */
 #define ICE_PTG_IM_IPV4_TCP		16
 #define ICE_PTG_IM_IPV4_UDP		17
diff --git a/drivers/net/ice/base/ice_type.h b/drivers/net/ice/base/ice_type.h
index fb350faa60..3d231db61a 100644
--- a/drivers/net/ice/base/ice_type.h
+++ b/drivers/net/ice/base/ice_type.h
@@ -930,13 +930,13 @@ struct ice_hw {
 
 	enum ice_aq_err pkg_dwnld_status;
 
-	/* Driver's package ver - (from the Metadata seg) */
+	/* Driver's package ver - (from the Ice Metadata section) */
 	struct ice_pkg_ver pkg_ver;
 	u8 pkg_name[ICE_PKG_NAME_SIZE];
 
-	/* Driver's Ice package version (from the Ice seg) */
-	struct ice_pkg_ver ice_pkg_ver;
-	u8 ice_pkg_name[ICE_PKG_NAME_SIZE];
+	/* Driver's Ice segment format version and id (from the Ice seg) */
+	struct ice_pkg_ver ice_seg_fmt_ver;
+	u8 ice_seg_id[ICE_SEG_ID_SIZE];
 
 	/* Pointer to the ice segment */
 	struct ice_seg *seg;
-- 
2.25.4


  parent reply	other threads:[~2020-10-28  3:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-28  3:22 [dpdk-dev] [PATCH v3 00/21] ice: update base code Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 01/21] net/ice/base: add tunnel support for FDIR Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 02/21] net/ice/base: add NVM Write Response flags Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 03/21] net/ice/base: modify ptype bitmap for outer MAC Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 04/21] net/ice/base: rename ptype bitmap Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 05/21] net/ice/base: move sched function prototypes Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 06/21] net/ice/base: read security revision Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 07/21] net/ice/base: add functions to allocate and free a RSS global LUT Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 08/21] net/ice/base: add more capability to admin queue Qi Zhang
2020-10-28  3:23 ` Qi Zhang [this message]
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 10/21] net/ice/base: use malloc instead of calloc Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 11/21] net/ice/base: add support for class 5+ modules Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 12/21] net/ice/base: return error directly Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 13/21] net/ice/base: implement shared rate limiter Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 14/21] net/ice/base: recognize 860 as iSCSI port in CEE mode Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 15/21] net/ice/base: fix parameter name in comment Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 16/21] net/ice/base: support extended GPIO access Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 17/21] net/ice/base: remove duplicated AQ command flag setting Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 18/21] net/ice/base: introduce and use FLEX_ARRAY_SIZE where possible Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 19/21] net/ice/base: refactor RSS configure API Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 20/21] net/ice/base: add support for get/set RSS LUT to specify global LUT Qi Zhang
2020-10-28  3:23 ` [dpdk-dev] [PATCH v3 21/21] net/ice/base: update version Qi Zhang
2020-10-29  8:20 ` [dpdk-dev] [PATCH v3 00/21] ice: update base code Yang, Qiming
2020-10-29  8:31   ` Zhang, Qi Z

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=20201028032320.1755208-10-qi.z.zhang@intel.com \
    --to=qi.z.zhang@intel.com \
    --cc=dan.nowlin@intel.com \
    --cc=dev@dpdk.org \
    --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).