From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3736C377EBA; Mon, 20 Apr 2026 02:35:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.156.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776652543; cv=none; b=gklgW7zwlRdnPEUxSwXhtl+naI1jfgcvB+wn9fdsCBExquFdefG5ZZ8/4lhAtUUh2dPvl/NARdnmzaCQGp/Gmy+bArdGkBwgba9DiPmfd7siZLfLwILqOE1duJbUulXJbEOkX4+b0LRys+zK2Ub7WuKdJk3RArpQ1/bmcqmQJg0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776652543; c=relaxed/simple; bh=NFsobxYT1xORnMAa3ZvhAqTmIV4G/gbJKA2hr2yJh3I=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KZt3iJfyaM+mnj98ajHp7s3CNZwkmO6zPXexRrtuRx4cUgc9AIv366ZINGL8Rmz4lPIxyGXw9Xnl0m5hcUF31Y51mwj9QotD5J7CaV5he2nLTNG/fiTZRP6O11V5au5MTEC8yeN2QthEmTiDxnp6a9rsUuI/s0SPa0LoEfb2zIw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=EhMsKC6t; arc=none smtp.client-ip=67.231.156.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="EhMsKC6t" Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 63JNBYmq814459; Sun, 19 Apr 2026 19:35:34 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=8 /GqIyqOA16yy+la+aqMrP/qeDZR17SITdIdAT5YyAg=; b=EhMsKC6tklnn2romH X8nLZkxmmKaSx1TiPZp8DHL7a2dUfBHDS2YFNMaFZfi+Wscq100OS15bG8c30qiY KP5W+T4C68mAxCDS/vTOvLmRZH4RPBt4mPeM/DdAfYinvQY1hTBxacbrZIfkkj1I gUDWUNdN3joaq/3KCIBLA4qKcjpAQYZTPb9pQxyctj2fheX3z6p6mM85VZZ1qtpH WlPlByhBY9F6BIbUGk4DcXydNeD906uu7S6pTBfphsdCJYD/VUWNt7//UHpZPDbJ zUhLzEz/yHCN2ZezIkchg0BgHosJdBNCe1bHsVOjLLGesZE7sx9Byu68e3Byv7MH q7QuQ== Received: from dc5-exch05.marvell.com ([199.233.59.128]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 4dm9fgjj6c-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 19 Apr 2026 19:35:34 -0700 (PDT) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC5-EXCH05.marvell.com (10.69.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.25; Sun, 19 Apr 2026 19:35:33 -0700 Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.25; Sun, 19 Apr 2026 19:35:32 -0700 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.25 via Frontend Transport; Sun, 19 Apr 2026 19:35:32 -0700 Received: from rkannoth-OptiPlex-7090.. (unknown [10.28.36.165]) by maili.marvell.com (Postfix) with ESMTP id 2FCF73F7041; Sun, 19 Apr 2026 19:35:28 -0700 (PDT) From: Ratheesh Kannoth To: , CC: , , , , , , , Ratheesh Kannoth , "Suman Ghosh" Subject: [PATCH v2 net 08/11] octeontx2-af: npc: cn20k: Fix MCAM actions read Date: Mon, 20 Apr 2026 08:04:39 +0530 Message-ID: <20260420023442.3295891-9-rkannoth@marvell.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260420023442.3295891-1-rkannoth@marvell.com> References: <20260420023442.3295891-1-rkannoth@marvell.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: sNWsMVBHO36bdNg92asFt5Hs_jmw4hdI X-Authority-Analysis: v=2.4 cv=TYSmcxQh c=1 sm=1 tr=0 ts=69e590f6 cx=c_pps a=rEv8fa4AjpPjGxpoe8rlIQ==:117 a=rEv8fa4AjpPjGxpoe8rlIQ==:17 a=A5OVakUREuEA:10 a=VkNPw1HP01LnGYTKEx00:22 a=l0iWHRpgs5sLHlkKQ1IR:22 a=QXcCYyLzdtTjyudCfB6f:22 a=M5GUcnROAAAA:8 a=IbDIvz35LZQodz_KiiMA:9 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwNDIwMDAyMyBTYWx0ZWRfX+zPw6J/+Kb5t lFy8jBr6hRyMOArLE7zbQXISV7uNRB37X/VH91iLDPa6hjWWJoFmBLjxBYazU3qV71pKVPqFMD+ hrg0fAoF4/S2/cgbA29R38F2Ol2rYTjtm+gf/W6AoZDoiNCtw+52Nyf6CqK8KsfBv6jqd14L1G2 2hsDh5mfDhkQr1to/ontJ2m5xksE4bErEkZ+O/wgUZyzBtV/kooMlC3KollZDNXZZ7NSk6j+D06 iYItLPGmBWWPmXXZQOa4Mk4Uu3bgwYLAVw1LgSLRAoYF9Q1T/kWBO93dHaLOkdsMJHSuLfBox3B N+Fultq/GowgFnOlkBXpDhdXfsadwNsg5ijrAN/OKw2gcE8v4Wa7NrSps0mZYCvXTCc98rTtLQT RjbvoIRswinqACV7ja5A7L1MDoj8H+JdFbnv+47fh655OTubY3X3NgEHUskRQG2ptvZsLnKbKbW utFAwaO9XvyMXiY1bXQ== X-Proofpoint-ORIG-GUID: sNWsMVBHO36bdNg92asFt5Hs_jmw4hdI X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1143,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-04-19_07,2026-04-17_04,2025-10-01_01 npc_cn20k_read_mcam_entry() always reloaded action and vtag_action from bank 0 after programming the CAM words. Use the bank returned by npc_get_bank() for the ACTION reads as well, and read those registers once up front so both X2 and X4 paths share the same metadata. Return directly from the X2 keyword path now that the action fields are already populated. Cc: Suman Ghosh Fixes: 6d1e70282f76 ("octeontx2-af: npc: cn20k: Use common APIs") Signed-off-by: Ratheesh Kannoth --- .../ethernet/marvell/octeontx2/af/cn20k/npc.c | 22 ++++++++----------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c index 4b37d471f118..752dbcede90f 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c @@ -1218,6 +1218,14 @@ int npc_cn20k_read_mcam_entry(struct rvu *rvu, int blkaddr, u16 index, bank = npc_get_bank(mcam, index); index &= (mcam->banksize - 1); + cfg = rvu_read64(rvu, blkaddr, + NPC_AF_CN20K_MCAMEX_BANKX_ACTIONX_EXT(index, bank, 0)); + entry->action = cfg; + + cfg = rvu_read64(rvu, blkaddr, + NPC_AF_CN20K_MCAMEX_BANKX_ACTIONX_EXT(index, bank, 1)); + entry->vtag_action = cfg; + cfg = rvu_read64(rvu, blkaddr, NPC_AF_CN20K_MCAMEX_BANKX_CAMX_INTF_EXT(index, bank, 1)) & 3; @@ -1267,7 +1275,7 @@ int npc_cn20k_read_mcam_entry(struct rvu *rvu, int blkaddr, u16 index, bank, 0)); npc_cn20k_fill_entryword(entry, kw + 3, cam0, cam1); - goto read_action; + return 0; } for (bank = 0; bank < mcam->banks_per_entry; bank++, kw = kw + 4) { @@ -1312,18 +1320,6 @@ int npc_cn20k_read_mcam_entry(struct rvu *rvu, int blkaddr, u16 index, npc_cn20k_fill_entryword(entry, kw + 3, cam0, cam1); } -read_action: - /* 'action' is set to same value for both bank '0' and '1'. - * Hence, reading bank '0' should be enough. - */ - cfg = rvu_read64(rvu, blkaddr, - NPC_AF_CN20K_MCAMEX_BANKX_ACTIONX_EXT(index, 0, 0)); - entry->action = cfg; - - cfg = rvu_read64(rvu, blkaddr, - NPC_AF_CN20K_MCAMEX_BANKX_ACTIONX_EXT(index, 0, 1)); - entry->vtag_action = cfg; - return 0; } -- 2.43.0