common/cnxk: fix setting channel mask for SDP interfaces

Message ID 20231107064010.1396308-1-psatheesh@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series common/cnxk: fix setting channel mask for SDP interfaces |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/github-robot: build success github build: passed
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-compile-amd64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-arm64-testing success Testing PASS

Commit Message

Satheesh Paul Antonysamy Nov. 7, 2023, 6:40 a.m. UTC
  From: Satheesh Paul <psatheesh@marvell.com>

Channel mask field is incorrectly returned as 16 bits.
Fixing it by truncating to 12 bits.

Fixes: 2703f1fa3200 ("common/cnxk: fix setting channel mask for SDP interfaces")
Cc: stable@dpdk.org

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
---
 drivers/common/cnxk/roc_npc.c   | 5 +++--
 drivers/common/cnxk/roc_npc.h   | 2 ++
 drivers/common/cnxk/version.map | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)
  

Comments

Jerin Jacob Kollanukkaran Nov. 7, 2023, 11:48 a.m. UTC | #1
> -----Original Message-----
> From: psatheesh@marvell.com <psatheesh@marvell.com>
> Sent: Tuesday, November 7, 2023 12:10 PM
> To: Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Kiran Kumar
> Kokkilagadda <kirankumark@marvell.com>; Sunil Kumar Kori
> <skori@marvell.com>; Satha Koteswara Rao Kottidi
> <skoteshwar@marvell.com>; Satheesh Paul Antonysamy
> <psatheesh@marvell.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [EXT] [dpdk-dev] [PATCH] common/cnxk: fix setting channel mask for
> SDP interfaces
> 
> External Email
> 
> ----------------------------------------------------------------------
> From: Satheesh Paul <psatheesh@marvell.com>
> 
> Channel mask field is incorrectly returned as 16 bits.
> Fixing it by truncating to 12 bits.
> 
> Fixes: 2703f1fa3200 ("common/cnxk: fix setting channel mask for SDP
> interfaces")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Satheesh Paul <psatheesh@marvell.com>

Updated the git commit as follows and applied to dpdk-next-net-mrvl/for-next-net. Thanks

    common/cnxk: fix SDP channel mask
		
    Channel mask field is incorrectly for SDP interface and it  
    is returning as 16 bits. Fixing it by truncating to 12 bits.
 
    Fixes: 2703f1fa3200 ("common/cnxk: fix setting channel mask for SDP interfaces")
    Cc: stable@dpdk.org

    Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
  

Patch

diff --git a/drivers/common/cnxk/roc_npc.c b/drivers/common/cnxk/roc_npc.c
index 4173dd2933..0fd1081d43 100644
--- a/drivers/common/cnxk/roc_npc.c
+++ b/drivers/common/cnxk/roc_npc.c
@@ -1439,7 +1439,7 @@  npc_inline_dev_ipsec_action_free(struct npc *npc, struct roc_npc_flow *flow)
 	return 1;
 }
 
-static void
+void
 roc_npc_sdp_channel_get(struct roc_npc *roc_npc, uint16_t *chan_base, uint16_t *chan_mask)
 {
 	struct roc_nix *roc_nix = roc_npc->roc_nix;
@@ -1454,8 +1454,9 @@  roc_npc_sdp_channel_get(struct roc_npc *roc_npc, uint16_t *chan_base, uint16_t *
 		num_bits = (sizeof(uint32_t) * 8) - plt_clz32(range) - 1;
 		/* Set mask for (15 - numbits) MSB bits */
 		*chan_mask = (uint16_t)~GENMASK(num_bits, 0);
+		*chan_mask &= 0xFFF;
 	} else {
-		*chan_mask = (uint16_t)GENMASK(15, 0);
+		*chan_mask = (uint16_t)GENMASK(11, 0);
 	}
 
 	mask = (uint16_t)GENMASK(num_bits, 0);
diff --git a/drivers/common/cnxk/roc_npc.h b/drivers/common/cnxk/roc_npc.h
index ad88cf34a4..e9870a162a 100644
--- a/drivers/common/cnxk/roc_npc.h
+++ b/drivers/common/cnxk/roc_npc.h
@@ -451,4 +451,6 @@  int __roc_api roc_npc_validate_portid_action(struct roc_npc *roc_npc_src,
 int __roc_api roc_npc_mcam_init(struct roc_npc *roc_npc, struct roc_npc_flow *flow, int mcam_id);
 int __roc_api roc_npc_mcam_move(struct roc_npc *roc_npc, uint16_t old_ent, uint16_t new_ent);
 void *__roc_api roc_npc_aged_flow_ctx_get(struct roc_npc *roc_npc, uint32_t mcam_id);
+void __roc_api roc_npc_sdp_channel_get(struct roc_npc *roc_npc, uint16_t *chan_base,
+				       uint16_t *chan_mask);
 #endif /* _ROC_NPC_H_ */
diff --git a/drivers/common/cnxk/version.map b/drivers/common/cnxk/version.map
index fffd2064be..aa884a8fe2 100644
--- a/drivers/common/cnxk/version.map
+++ b/drivers/common/cnxk/version.map
@@ -459,6 +459,7 @@  INTERNAL {
 	roc_npc_mcam_read_counter;
 	roc_npc_inl_mcam_read_counter;
 	roc_npc_profile_name_get;
+	roc_npc_sdp_channel_get;
 	roc_npc_validate_portid_action;
 	roc_ot_ipsec_inb_sa_init;
 	roc_ot_ipsec_outb_sa_init;