From 074af28f22f7e3dff9637a6366ad0a1ad1dd2852 Mon Sep 17 00:00:00 2001
From: Junxian Huang <huangjunxian6@hisilicon.com>
Date: Wed, 30 Aug 2023 09:24:49 +0800
Subject: hikptool/RDMA: Fix the missing bank ID in roce_trp GEN_AC

Upstream: Yes

Currently hikptool only accepts bank ID 0 and 1 for roce_trp GEN_AC.
The firmware then multiplies the bank ID received from hikptool by 2
and converts it to 0 and 2. But actually there are 4 banks in GEN_AC
and each of them is independent.

To fix the problem, both hikptool and firmware should be modified.
This patch modifies the bank ID limit form 2 to 4 in hikptool.

Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
---
 net/roce/roce_trp/hikp_roce_trp.c | 2 +-
 net/roce/roce_trp/hikp_roce_trp.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/roce/roce_trp/hikp_roce_trp.c b/net/roce/roce_trp/hikp_roce_trp.c
index 8befb06..bf22484 100644
--- a/net/roce/roce_trp/hikp_roce_trp.c
+++ b/net/roce/roce_trp/hikp_roce_trp.c
@@ -32,7 +32,7 @@ static int hikp_roce_trp_help(struct major_cmd_ctrl *self, const char *argv)
 	       "this is necessary param COMMON/TRP_RX/GEN_AC/PAYL");
 	printf("    %s, %-25s %s\n", "-b", "--bank=<bank>",
 	       "[option]set which bank to read. (default 0) "
-	       "COMMON : 0~3\n PAYL: 0~1\n GEN_AC : 0~1\n ");
+	       "COMMON : 0~3\n PAYL: 0~1\n GEN_AC : 0~3\n ");
 	printf("\n");
 
 	return 0;
diff --git a/net/roce/roce_trp/hikp_roce_trp.h b/net/roce/roce_trp/hikp_roce_trp.h
index db58216..80d28af 100644
--- a/net/roce/roce_trp/hikp_roce_trp.h
+++ b/net/roce/roce_trp/hikp_roce_trp.h
@@ -25,7 +25,7 @@
 	}
 #define TRP_MAX_BANK_NUM 0x3
 #define PAYL_MAX_BANK_NUM 0x1
-#define GAC_MAX_BANK_NUM 0x1
+#define GAC_MAX_BANK_NUM 0x3
 #define PER_TRP_DATA_NUM 2
 
 struct roce_trp_req_param {
-- 
2.30.0

