[05/11] net/nfp: add major version to nsp commands

Message ID 20231102022321.2254224-6-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Add the support of multiple PF |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He Nov. 2, 2023, 2:23 a.m. UTC
  From: Peng Zhang <peng.zhang@corigine.com>

The commands sent to the NSP take the NSP major version into account. Up
until now only NSP major version 0 have been supported and the value
have been hard-coded to 0.

In preparation to add support for both NSP version 0.x and 1.x, extend
the command to take the running NSP version into account.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/nfpcore/nfp_nsp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Patch

diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.c b/drivers/net/nfp/nfpcore/nfp_nsp.c
index 9f88b822f3..589d878e0d 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp.c
@@ -22,7 +22,8 @@ 
 
 #define NSP_COMMAND             0x08
 #define   NSP_COMMAND_OPTION    GENMASK_ULL(63, 32)
-#define   NSP_COMMAND_CODE      GENMASK_ULL(31, 16)
+#define   NSP_COMMAND_VER_MAJOR GENMASK_ULL(31, 28)
+#define   NSP_COMMAND_CODE      GENMASK_ULL(27, 16)
 #define   NSP_COMMAND_DMA_BUF   RTE_BIT64(1)
 #define   NSP_COMMAND_START     RTE_BIT64(0)
 
@@ -370,6 +371,7 @@  nfp_nsp_command_real(struct nfp_nsp *state,
 
 	err = nfp_cpp_writeq(cpp, nsp_cpp, nsp_command,
 			FIELD_PREP(NSP_COMMAND_OPTION, arg->option) |
+			FIELD_PREP(NSP_COMMAND_VER_MAJOR, state->ver.major) |
 			FIELD_PREP(NSP_COMMAND_CODE, arg->code) |
 			FIELD_PREP(NSP_COMMAND_DMA_BUF, arg->dma) |
 			FIELD_PREP(NSP_COMMAND_START, 1));