From 72207e1b15d4b9d28a3cbf1ed8f6dcb43bcf2617 Mon Sep 17 00:00:00 2001 From: Hariprasad Kelam Date: Tue, 21 Jul 2026 12:33:03 +0530 Subject: [PATCH] octeontx2-af: npc: Warn on NPC_IPSEC_SPI key overlap When scanning the MKEX profile to determine supported NPC features, warn if the SPI extraction field overlaps with other key fields. AH and ESP may legitimately use the same key offset for SPI, so continue to advertise NPC_IPSEC_SPI via npc_is_field_present() instead of treating the overlap as a hard failure. Signed-off-by: Hariprasad Kelam Signed-off-by: Ratheesh Kannoth Link: https://patch.msgid.link/20260721070303.986740-1-rkannoth@marvell.com Signed-off-by: Paolo Abeni --- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c index 91b5947dae06..d422bdd5e8f8 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c @@ -729,7 +729,12 @@ static void npc_set_features(struct rvu *rvu, int blkaddr, u8 intf) if (!npc_check_field(rvu, blkaddr, NPC_LB, intf)) *features &= ~BIT_ULL(NPC_OUTER_VID); - /* Allow extracting SPI field from AH and ESP headers at same offset */ + /* Warn on unrelated MKEX fields colliding with SPI key bits. AH/ESP + * sharing the same SPI key offset is valid; use npc_is_field_present(), + * not npc_check_field(), to advertise the feature. + */ + if (npc_check_overlap(rvu, blkaddr, NPC_IPSEC_SPI, 0, intf)) + dev_warn(rvu->dev, "Overlap detected the field NPC_IPSEC_SPI\n"); if (npc_is_field_present(rvu, NPC_IPSEC_SPI, intf) && (*features & (BIT_ULL(NPC_IPPROTO_ESP) | BIT_ULL(NPC_IPPROTO_AH)))) *features |= BIT_ULL(NPC_IPSEC_SPI);