Skip to contentSkip to conversation

common/cnxk: fix setting channel mask for SDP interfaces

PATCH In review [email protected] 2 participants 2 messages Nov 7, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/cnxk: fix setting channel mask for SDP interfaces

From: Satheesh Paul <[email protected]>

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")
---
 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(-)
drivers/common/cnxk/roc_npc.c +3 -2
index 4173dd2933..0fd1081d43 100644
@@ -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);
drivers/common/cnxk/roc_npc.h +2 -0
index ad88cf34a4..e9870a162a 100644
@@ -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_ */
drivers/common/cnxk/version.map +1 -0
index fffd2064be..aa884a8fe2 100644
@@ -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;
Signature · 1 line
2.39.2
#1 lore raw
Quoted 17 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Tuesday, November 7, 2023 12:10 PM
To: Nithin Kumar Dabilpuram <[email protected]>; Kiran Kumar Kokkilagadda <[email protected]>; Sunil Kumar Kori <[email protected]>; Satha Koteswara Rao Kottidi <[email protected]>; Satheesh Paul Antonysamy <[email protected]>
Cc: [email protected]; [email protected]
Subject: [EXT] [dpdk-dev] [PATCH] common/cnxk: fix setting channel mask for SDP interfaces

External Email

----------------------------------------------------------------------
From: Satheesh Paul <[email protected]>

Quoted 8 lines

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: [email protected]

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")