From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id AB51745500;
	Wed, 26 Jun 2024 13:56:12 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 43FD243297;
	Wed, 26 Jun 2024 13:55:09 +0200 (CEST)
Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9])
 by mails.dpdk.org (Postfix) with ESMTP id 2E71942E95
 for <dev@dpdk.org>; Wed, 26 Jun 2024 13:43:20 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple;
 d=intel.com; i=@intel.com; q=dns/txt; s=Intel;
 t=1719402200; x=1750938200;
 h=from:to:cc:subject:date:message-id:in-reply-to:
 references:mime-version:content-transfer-encoding;
 bh=kK4zQuDbAhH/RBnsSWEIFfkKd9gPavCJRr2Ak8CGILs=;
 b=CEBjKIhg3ofqscLr1fwilFQev5/5a0zvG70aSi/rI2TZw/whJTaNt2oj
 nJ+U1lBYjScen0vCIPDgz02eu+wvmg9nW6shfIMrCiLNcD6O4LJD82Fn7
 NCku2TstqS+2UmXWDy1cCVEjZmIU2t5FTnpz7Dhmj7iQr+L1bCN4391Dp
 uUekwWK+G4jwQ2XM4VSU8NZoOiK3IKh9L4Zqgvglyb/8aFpwx1IySZu9W
 jUFSwe1etR2TTLFWPq5VsYQW1d+qnb/x+FOauOgJ4LiIVzb5xghEfx1nD
 yVISy1DUbvDmOq9Qphm2FSEpZGSwkkurzncQp5fsx25tQMMBUvFH/d+eF A==;
X-CSE-ConnectionGUID: VBK//tRYQVGCDing0yYLHQ==
X-CSE-MsgGUID: L1DHbPy/TTqV0ATUP8Wlcg==
X-IronPort-AV: E=McAfee;i="6700,10204,11114"; a="38979305"
X-IronPort-AV: E=Sophos;i="6.08,266,1712646000"; d="scan'208";a="38979305"
Received: from orviesa010.jf.intel.com ([10.64.159.150])
 by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;
 26 Jun 2024 04:43:19 -0700
X-CSE-ConnectionGUID: B48RzxC5TBWV8AsGMGsRaA==
X-CSE-MsgGUID: cOs/jBT/ShCz8y4xsDWLSw==
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="6.08,266,1712646000"; d="scan'208";a="43873478"
Received: from unknown (HELO silpixa00401119.ir.intel.com) ([10.55.129.167])
 by orviesa010.jf.intel.com with ESMTP; 26 Jun 2024 04:43:19 -0700
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Cc: Stefan Wegrzyn <stefan.wegrzyn@intel.com>, ian.stokes@intel.com,
 bruce.richardson@intel.com
Subject: [PATCH v4 012/103] net/ice/base: allow for dumping all clusters
Date: Wed, 26 Jun 2024 12:41:00 +0100
Message-ID: <da0bcdc025f2adf6df3fb1c1311148229b1bec6c.1719401847.git.anatoly.burakov@intel.com>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <cover.1719401847.git.anatoly.burakov@intel.com>
References: <cover.1719313663.git.anatoly.burakov@intel.com>
 <cover.1719401847.git.anatoly.burakov@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

From: Stefan Wegrzyn <stefan.wegrzyn@intel.com>

Adjust ice_aq_get_internal_data() wrapping function so that it returns next
cluster ID when iterating over clusters, as well as add missing cluster
definition.

Signed-off-by: Stefan Wegrzyn <stefan.wegrzyn@intel.com>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
---
 drivers/net/ice/base/ice_adminq_cmd.h |  4 ++--
 drivers/net/ice/base/ice_common.c     | 11 +++++++----
 drivers/net/ice/base/ice_common.h     |  6 +++---
 drivers/net/ice/ice_diagnose.c        |  7 ++++---
 4 files changed, 16 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ice/base/ice_adminq_cmd.h b/drivers/net/ice/base/ice_adminq_cmd.h
index 9bd9e97de0..4c9325fb61 100644
--- a/drivers/net/ice/base/ice_adminq_cmd.h
+++ b/drivers/net/ice/base/ice_adminq_cmd.h
@@ -2896,7 +2896,7 @@ struct ice_aqc_event_lan_overflow {
 
 /* Debug Dump Internal Data (indirect 0xFF08) */
 struct ice_aqc_debug_dump_internals {
-	u8 cluster_id;
+	__le16 cluster_id; /* Expresses next cluster ID in response */
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_SW			0
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_ACL			1
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_TXSCHED		2
@@ -2910,7 +2910,7 @@ struct ice_aqc_debug_dump_internals {
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_L2P			8
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_QUEUE_MNG		9
 #define ICE_AQC_DBG_DUMP_CLUSTER_ID_FULL_CSR_SPACE	21
-	u8 reserved;
+#define ICE_AQC_DBG_DUMP_CLUSTER_ID_MNG_TRANSACTION	22
 	__le16 table_id; /* Used only for non-memory clusters */
 	__le32 idx; /* In table entries for tables, in bytes for memory */
 	__le32 addr_high;
diff --git a/drivers/net/ice/base/ice_common.c b/drivers/net/ice/base/ice_common.c
index 16107317d3..a768c42b2b 100644
--- a/drivers/net/ice/base/ice_common.c
+++ b/drivers/net/ice/base/ice_common.c
@@ -4846,6 +4846,7 @@ ice_set_ctx(struct ice_hw *hw, u8 *src_ctx, u8 *dest_ctx,
  * @buf: dump buffer
  * @buf_size: dump buffer size
  * @ret_buf_size: return buffer size (returned by FW)
+ * @ret_next_cluster: next cluster to read (returned by FW)
  * @ret_next_table: next block to read (returned by FW)
  * @ret_next_index: next index to read (returned by FW)
  * @cd: pointer to command details structure
@@ -4853,10 +4854,10 @@ ice_set_ctx(struct ice_hw *hw, u8 *src_ctx, u8 *dest_ctx,
  * Get internal FW/HW data (0xFF08) for debug purposes.
  */
 int
-ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
+ice_aq_get_internal_data(struct ice_hw *hw, u16 cluster_id, u16 table_id,
 			 u32 start, void *buf, u16 buf_size, u16 *ret_buf_size,
-			 u16 *ret_next_table, u32 *ret_next_index,
-			 struct ice_sq_cd *cd)
+			 u16 *ret_next_cluster, u16 *ret_next_table,
+			 u32 *ret_next_index, struct ice_sq_cd *cd)
 {
 	struct ice_aqc_debug_dump_internals *cmd;
 	struct ice_aq_desc desc;
@@ -4869,7 +4870,7 @@ ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
 
 	ice_fill_dflt_direct_cmd_desc(&desc, ice_aqc_opc_debug_dump_internals);
 
-	cmd->cluster_id = cluster_id;
+	cmd->cluster_id = CPU_TO_LE16(cluster_id);
 	cmd->table_id = CPU_TO_LE16(table_id);
 	cmd->idx = CPU_TO_LE32(start);
 
@@ -4878,6 +4879,8 @@ ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
 	if (!status) {
 		if (ret_buf_size)
 			*ret_buf_size = LE16_TO_CPU(desc.datalen);
+		if (ret_next_cluster)
+			*ret_next_cluster = LE16_TO_CPU(cmd->cluster_id);
 		if (ret_next_table)
 			*ret_next_table = LE16_TO_CPU(cmd->table_id);
 		if (ret_next_index)
diff --git a/drivers/net/ice/base/ice_common.h b/drivers/net/ice/base/ice_common.h
index ecfe55bd3a..9ffa054994 100644
--- a/drivers/net/ice/base/ice_common.h
+++ b/drivers/net/ice/base/ice_common.h
@@ -65,10 +65,10 @@ int ice_get_caps(struct ice_hw *hw);
 void ice_set_safe_mode_caps(struct ice_hw *hw);
 
 int
-ice_aq_get_internal_data(struct ice_hw *hw, u8 cluster_id, u16 table_id,
+ice_aq_get_internal_data(struct ice_hw *hw, u16 cluster_id, u16 table_id,
 			 u32 start, void *buf, u16 buf_size, u16 *ret_buf_size,
-			 u16 *ret_next_table, u32 *ret_next_index,
-			 struct ice_sq_cd *cd);
+			 u16 *ret_next_cluster, u16 *ret_next_table,
+			 u32 *ret_next_index, struct ice_sq_cd *cd);
 
 /* Define a macro that will align a pointer to point to the next memory address
  * that falls on the given power of 2 (i.e., 2, 4, 8, 16, 32, 64...). For
diff --git a/drivers/net/ice/ice_diagnose.c b/drivers/net/ice/ice_diagnose.c
index 44641e6c79..51e2f2fb9f 100644
--- a/drivers/net/ice/ice_diagnose.c
+++ b/drivers/net/ice/ice_diagnose.c
@@ -437,9 +437,10 @@ static int
 ice_dump_switch(struct rte_eth_dev *dev, uint8_t **buff2, uint32_t *size)
 {
 	struct ice_hw *hw;
+	struct ice_sq_cd *cd = NULL;
 	int i = 0;
 	uint16_t tbl_id = 0;
-	uint32_t tbl_idx = 0;
+	uint16_t tbl_idx = 0;
 	uint8_t *buffer = *buff2;
 
 	hw = ICE_DEV_PRIVATE_TO_HW(dev->data->dev_private);
@@ -469,7 +470,7 @@ ice_dump_switch(struct rte_eth_dev *dev, uint8_t **buff2, uint32_t *size)
 			ICE_AQC_DBG_DUMP_CLUSTER_ID_SW,
 			tbl_id, tbl_idx, buff,
 			ICE_PKG_BUF_SIZE,
-			&buff_size, &tbl_id, &tbl_idx, NULL);
+			&buff_size, &tbl_id, &tbl_idx, NULL, cd);
 
 		if (res) {
 			free(buff);
@@ -481,7 +482,7 @@ ice_dump_switch(struct rte_eth_dev *dev, uint8_t **buff2, uint32_t *size)
 
 		free(buff);
 
-		if (tbl_idx == 0xffffffff) {
+		if (tbl_idx == 0xffff) {
 			tbl_idx = 0;
 			memset(buffer, '\n', sizeof(char));
 			buffer++;
-- 
2.43.0