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 85A14347DD; Mon, 2 Feb 2026 07:46:23 +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=1770018385; cv=none; b=cSqorqMd3S+J/40r3UiCUByC5iUxdEcMQFpMIqu7VB7DoP7qmI/DuFC9h+b36PqhGeyNk+mX1jI7dM4wRblDWIUzWAzoOb1H1hclnMZcitp2OvEnMK6+/NMnzCU/9vlLGqPQaxvQZ98HA6AmQf43Q81z6+dhc31HVLyvaF6uhJU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770018385; c=relaxed/simple; bh=K/7M8UdWJqNyG2yDmJiNybYen60h+ySWavhtV1+rXto=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=S+tfsj0glRtiLWocM7hKqJ1ZY2+tHwSejvZKCsECfcgYZNVO7T/8+L/g+3lXwgXjo0O4EOtVvANcqtBDJ63zBuqekwaDY32NRpqu4YieYBaIs5teI7TMRcVhSL3VHCKYDdXNLgd0krcJFBhNeV4hYdR3YUK4JlYe+XahONEyHPQ= 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=jPeJ3YMu; 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="jPeJ3YMu" Received: from pps.filterd (m0431383.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 611NhMFa3444759; Sun, 1 Feb 2026 23:46:14 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=pfpt0220; bh=utAgWJyKD0tEophrc0CrJ0n MDCzOPz95g95cA0gXjWk=; b=jPeJ3YMuS2CPZWSNBD9mlOBZ4QfVvS61FhbK5cg 9jIDBTBOdda3E9Dlq/ApCYtKLmZKidM0NVmynfrFHvtPsULxPMGk2WEkezkAiSw0 FkOE6/IsQjpjXy5QKy2IRwf1gSduJ704dU2cG3vcKm1QigyqQvSdsTcTG6UsELe0 7IAicrHotcJ4KwY/J8PS0EYBx7NX7b7auF2TE287tZOnMaIBXcPghTwETRUH7/Lq Vyw8Cf8VmrrB4B301oFqeF3NZ05i24pD+f23gGTY4EQUcLwkYwD2Ql3AxTEzXA4S kNRqh+GkURlrB9egqz183ikoISbt22CJOFQ3geQS5xqoiZg== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 4c28mvs7hy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sun, 01 Feb 2026 23:46:14 -0800 (PST) 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, 1 Feb 2026 23:46:39 -0800 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, 1 Feb 2026 23:46:39 -0800 Received: from rkannoth-OptiPlex-7090.. (unknown [10.28.36.165]) by maili.marvell.com (Postfix) with ESMTP id 8811F5B6946; Sun, 1 Feb 2026 23:46:10 -0800 (PST) From: Ratheesh Kannoth To: , CC: , , , , , , "Ratheesh Kannoth" Subject: [PATCH net-next v8 00/13] NPC HW block support for cn20k Date: Mon, 2 Feb 2026 13:15:54 +0530 Message-ID: <20260202074607.2535569-1-rkannoth@marvell.com> X-Mailer: git-send-email 2.43.0 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-Authority-Analysis: v=2.4 cv=MuhfKmae c=1 sm=1 tr=0 ts=69805646 cx=c_pps a=gIfcoYsirJbf48DBMSPrZA==:117 a=gIfcoYsirJbf48DBMSPrZA==:17 a=HzLeVaNsDn8A:10 a=VkNPw1HP01LnGYTKEx00:22 a=VwQbUJbxAAAA:8 a=M5GUcnROAAAA:8 a=nQb7NifI8gXvS-jv4YYA:9 a=OBjm3rFKGHvpk9ecZwUJ:22 X-Proofpoint-ORIG-GUID: eSnFGVevqUegsFHE4s1St0aeI3oaMF22 X-Proofpoint-GUID: eSnFGVevqUegsFHE4s1St0aeI3oaMF22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwMjAyMDA2NSBTYWx0ZWRfXz/uYtpvDl85B 4/xEqcp3QFEK4Sg19GlRpWGkU5n2Y60M+cT0anfXFgefBaOCfWlHdL65qZP6AND/r0+SvuB/+zB W1uBEWsq5QIuOqGCApMgsYUNA3RDa0gJ454cwCKRsdX3aZpOvb+8tfhuk3/mkDEtiFcSD4w9ssK NYOuVD5ctRBnewJUdbR+YjaY+IF4AUxVoTe/8yNaH8vhvSg2hrwWjh6LamUZj/2vDeGOWa63gh+ 4yOM6nJ9HOFng58+xVB2krlC4PS7PpgpTDYMPpFDeQCZpOATvlGeIIO0sGTrlzbu3NhvU4j0sJh A+bPJSCCzXVrB1DmxHLsfB9jm4r9qYjD7dl51cidnBbUKrdhpunOYy1pws+jFHj4QLxAIvf/XQB VwGCGfjiTUbhA95NiHICuK6p2upC7b4ZZrJCUTYzt+82KCGikC2J77xAP/krciI+7d/B0cT8Hda CzReJouD7zoz06a76GQ== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1121,Hydra:6.1.51,FMLib:17.12.100.49 definitions=2026-02-02_02,2026-01-30_04,2025-10-01_01 This patchset adds comprehensive support for the CN20K NPC architecture. CN20K introduces significant changes in MCAM layout, parser design, KPM/KPU mapping, index management, virtual index handling, and dynamic rule installation. The patches update the AF, PF/VF, and common layers to correctly support these new capabilities while preserving compatibility with previous silicon variants. MCAM on CN20K differs from older designs: the hardware now contains two vertical banks of depth 8192, and thirty-two horizontal subbanks of depth 256. Each subbank can be configured as x2 or x4, enabling 256-bit or 512-bit key storage. Several allocation models are added to support this layout, including contiguous and non-contiguous allocation with or without reference ranges and priorities. Parser and extraction logic are also enhanced. CN20K introduces a new profile model where up to twenty-four extractors may be configured for each parsing profile. A new KPM profile scheme is added, grouping sixteen KPUs into eight KPM profiles, each formed by two KPUs. Support is added for default index allocation for CN20K-specific MCAM entry structures, virtual index allocation, improved defragmentation, and TC rule installation by allowing the AF driver to determine required x2/x4 rule width during flow install. Ratheesh Kannoth (7): octeontx2-af: npc: cn20k: Index management Add CN20K MCAM allocation support. Implements contiguous and non-contiguous allocation models with ref, limit, contig, priority, and count support. octeontx2-af: npc: cn20k: Allocate default MCAM indexes Allocate default MCAM entries dynamically in descending index order during NIX LF attach, reducing MCAM wastage octeontx2-af: npc: cn20k: Prepare for new SoC Introduce MCAM metadata structure so low-level functions no longer receive SoC-specific structures directly. octeontx2-af: npc: cn20k: virtual index support Add virtual MCAM index allocation and improve CN20K MCAM defragmentation handling. Track virtual indexes and restore statistics correctly. octeontx2-af: npc: cn20k: Allocate MCAM entry for flow installation Extend install_flow mailbox so AF can determine rule width and complete allocation and installation in a single exchange. octeontx2-af: npc: cn20k: add debugfs support Debugfs entries to show mcam layout and default mcam entry allocations Legacy debugfs entries are modified to show hardware priority on cn20k SoC. octeontx-af: npc: Use common structures Low level functions should use maximum mcam size array and modify cam0 and cam1. This is a cleanup patch. Subbaraya Sundeep (1): octeontx2-pf: cn20k: Add TC rules support Add full TC dynamic rule support for CN20K. Handle x2/x4 rule widths, dynamic allocation, and shifting restrictions when mixed rule sizes exist. Suman Ghosh (5): octeontx2-af: npc: cn20k: KPM profile changes Add support for CN20K KPM profiles. Sixteen KPUs are grouped into eight KPM configurations to improve resource usage octeontx2-af: npc: cn20k: Add default profile Update mkex profile for CN20K and mark unused objects with may_be_unused to silence compiler warnings. ocetontx2-af: npc: cn20k: MKEX profile support Add support for the new CN20K parser profile. Introduces the extractor-based model with up to twenty-four extractors per profile. octeontx2-af: npc: cn20k: Use common APIs Update common MCAM APIs for CN20K. Add new register handling, new access algorithms, and CN20K-specific index management. octeontx2-af: npc: cn20k: Add new mailboxes for CN20K silicon Add CN20K-specific MCAM mailbox messages for updated mcam_entry layout and avoid breaking backward compatibility. .../ethernet/marvell/octeontx2/af/Makefile | 2 +- .../marvell/octeontx2/af/cn20k/debugfs.c | 273 + .../marvell/octeontx2/af/cn20k/debugfs.h | 3 + .../marvell/octeontx2/af/cn20k/mbox_init.c | 17 + .../ethernet/marvell/octeontx2/af/cn20k/npc.c | 4421 +++++++++++++++++ .../ethernet/marvell/octeontx2/af/cn20k/npc.h | 340 ++ .../ethernet/marvell/octeontx2/af/cn20k/reg.h | 65 + .../ethernet/marvell/octeontx2/af/common.h | 4 - .../net/ethernet/marvell/octeontx2/af/mbox.h | 172 +- .../net/ethernet/marvell/octeontx2/af/npc.h | 2 + .../marvell/octeontx2/af/npc_profile.h | 84 +- .../net/ethernet/marvell/octeontx2/af/rvu.c | 94 +- .../net/ethernet/marvell/octeontx2/af/rvu.h | 18 +- .../marvell/octeontx2/af/rvu_debugfs.c | 76 +- .../marvell/octeontx2/af/rvu_devlink.c | 90 +- .../ethernet/marvell/octeontx2/af/rvu_nix.c | 1 - .../ethernet/marvell/octeontx2/af/rvu_npc.c | 580 ++- .../ethernet/marvell/octeontx2/af/rvu_npc.h | 21 + .../marvell/octeontx2/af/rvu_npc_fs.c | 693 ++- .../marvell/octeontx2/af/rvu_npc_fs.h | 14 +- .../marvell/octeontx2/af/rvu_npc_hash.c | 128 +- .../marvell/octeontx2/af/rvu_npc_hash.h | 2 +- .../ethernet/marvell/octeontx2/nic/cn20k.c | 265 + .../ethernet/marvell/octeontx2/nic/cn20k.h | 13 + .../marvell/octeontx2/nic/otx2_common.h | 35 + .../marvell/octeontx2/nic/otx2_flows.c | 267 +- .../ethernet/marvell/octeontx2/nic/otx2_tc.c | 77 +- 27 files changed, 7286 insertions(+), 471 deletions(-) create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.c create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/cn20k/npc.h create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.h -- v1 -> v2: Addressed comments v2 -> v3: Resolved build errors, addressed comments v3 -> v4: Address comments from Jakub https://lore.kernel.org/netdev/20260109054828.1822307-12-rkannoth@marvell.com/T/#t v4 -> v5: Addressed comments from Jakub https://lore.kernel.org/netdev/20260113101658.4144610-6-rkannoth@marvell.com/ v5 -> v6: Addressed Jakub comments. https://lore.kernel.org/netdev/20260126123254.1000480-11-rkannoth@marvell.com/T/#t v6 -> v7: Addressed Jakub comments. https://lore.kernel.org/netdev/20260128071235.3577206-2-rkannoth@marvell.com/T/#t v7 -> v8: Addressed Jacub comments. https://lore.kernel.org/netdev/20260129083339.264386-12-rkannoth@marvell.com/T/#t 2.43.0