From patchwork Tue Feb 14 10:40:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 13139848 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF8D3C61DA4 for ; Tue, 14 Feb 2023 10:42:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:CC :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=kCLX6WugFG1KhqAZXqbfWIK5/kofVlOuryEdl6a03cs=; b=Ezf576gYucoy9n /Q2lHsX0HwdK4jGinLdnhKX4/dYiYQ3h2jC01JWZTtWHx9mVZNZuUb6JTGRWdBvE4gAVAfcfVs72W NxY+yo/DmYcNaLpEbGdwZ38mqBCxhhvddd0VZAtqaQEue6UbpOmtWToi3teFZ/46nV3m/QoiB0Osx TYbd1q78xjdEzMsZuWAjC2jTWU2OYoNhqA23ZH9TtAg+c3oZs1Qza0/WBho5aPe2J464Vyx14exqm LbeQHhvCwIEeQc8+j6WUKMiZbKAvMK8L3OTW853bGCNLEfdK+Bw9LZI7PHLnmzqE7AeZaq5WKwPMd i8jzTfCbSFPiTL4pnIug==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRskG-0014Al-Od; Tue, 14 Feb 2023 10:41:08 +0000 Received: from esa.microchip.iphmx.com ([68.232.153.233]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pRsk9-00147T-PW for linux-arm-kernel@lists.infradead.org; Tue, 14 Feb 2023 10:41:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1676371261; x=1707907261; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=aizzmjR+5szlZLAy1gCPHwfGmYNvddQbYfCKcNQoP+c=; b=GI4SNv9G8eDhCek5a0Z70lzgfRs6HYZVLbHAJ6JgZuiJFVINsZJY+lZD 5SCjkpiv9uB+cTrRGiQocHf6XxDs4NPUeUVmgW11BjKlb+jGdmQJdYUwy 1I1s6Oes9K6HLKw4Gq8gtAqa8nvZ+/KUVOWitAV+XLm+CGmv/wjcr9U0y 41+oxmZq1HvZSDCbT1RjmzpHN8EULzKbCEDXAUmuA/UwhFY4gji/6+fmw iwi5g5Onl/nd1MCk1FaLkH7497RadCI+5q7SS+r9mkUBR3v1ZfumbVpmm TrK5P1WtfZjqz/c59HmwF0D2Sn0SXmdXDKCdMYfJfBRWWsso3T5GpyznW Q==; X-IronPort-AV: E=Sophos;i="5.97,296,1669100400"; d="scan'208";a="200588835" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 14 Feb 2023 03:40:55 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 14 Feb 2023 03:40:55 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Tue, 14 Feb 2023 03:40:52 -0700 From: Steen Hegelund To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: Steen Hegelund , , Randy Dunlap , "Casper Andersson" , Russell King , Wan Jiabing , "Nathan Huckleberry" , , , , "Steen Hegelund" , Daniel Machon , Horatiu Vultur , Lars Povlsen , Dan Carpenter , Michael Walle Subject: [PATCH net-next v2 00/10] Adding Sparx5 ES0 VCAP support Date: Tue, 14 Feb 2023 11:40:39 +0100 Message-ID: <20230214104049.1553059-1-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230214_024101_900915_A80C8BEC X-CRM114-Status: GOOD ( 11.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This provides the Egress Stage 0 (ES0) VCAP (Versatile Content-Aware Processor) support for the Sparx5 platform. The ES0 VCAP is an Egress Access Control VCAP that uses frame keyfields and previously classified keyfields to add, rewrite or remove VLAN tags on the egress frames, and is therefore often referred to as the rewriter. The ES0 VCAP also supports trapping frames to the host. The ES0 VCAP has 1 lookup accessible with this chain id: - chain 10000000: ES0 Lookup 0 The ES0 VCAP does not do traffic classification to select a keyset, but it does have two keysets that can be used on all traffic. For now only the ISDX keyset is used. The ES0 VCAP can match on an ISDX key (Ingress Service Index) as one of the frame metadata keyfields, similar to the ES2 VCAP. The ES0 VCAP uses external counters in the XQS (statistics) group. Version History: ================ v2 Added corrections suggested by Dan Carpenter: - Added a "Fixes" tag on patch 2 - Using roundup/down macros provided by math.h - Check return value in sparx5_tc_action_vlan_modify() v1 Initial version Steen Hegelund (10): net: microchip: sparx5: Discard frames with SMAC multicast addresses net: microchip: sparx5: Clear rule counter even if lookup is disabled net: microchip: sparx5: Egress VLAN TPID configuration follows IFH net: microchip: sparx5: Use chain ids without offsets when enabling rules net: microchip: sparx5: Improve the error handling for linked rules net: microchip: sparx5: Add ES0 VCAP model and updated KUNIT VCAP model net: microchip: sparx5: Updated register interface with VCAP ES0 access net: microchip: sparx5: Add ES0 VCAP keyset configuration for Sparx5 net: microchip: sparx5: Add TC support for the ES0 VCAP net: microchip: sparx5: Add TC vlan action support for the ES0 VCAP .../ethernet/microchip/sparx5/sparx5_main.c | 1 + .../microchip/sparx5/sparx5_main_regs.h | 1829 ++++++++++++----- .../ethernet/microchip/sparx5/sparx5_port.c | 5 + .../net/ethernet/microchip/sparx5/sparx5_tc.h | 74 + .../microchip/sparx5/sparx5_tc_flower.c | 370 +++- .../microchip/sparx5/sparx5_vcap_ag_api.c | 385 +++- .../microchip/sparx5/sparx5_vcap_debugfs.c | 41 + .../microchip/sparx5/sparx5_vcap_impl.c | 274 +++ .../microchip/sparx5/sparx5_vcap_impl.h | 25 + .../ethernet/microchip/sparx5/sparx5_vlan.c | 4 +- .../net/ethernet/microchip/vcap/vcap_ag_api.h | 174 +- .../net/ethernet/microchip/vcap/vcap_api.c | 18 +- .../microchip/vcap/vcap_api_debugfs_kunit.c | 4 +- .../ethernet/microchip/vcap/vcap_api_kunit.c | 4 +- .../microchip/vcap/vcap_model_kunit.c | 270 ++- .../microchip/vcap/vcap_model_kunit.h | 10 +- drivers/net/ethernet/microchip/vcap/vcap_tc.c | 3 + drivers/net/ethernet/microchip/vcap/vcap_tc.h | 1 + 18 files changed, 2749 insertions(+), 743 deletions(-)