From patchwork Thu Nov 17 21:31:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 13047335 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 DE2B6C433FE for ; Thu, 17 Nov 2022 21:32:54 +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=JCPJcaULoPSTda6h+n0EqW5U484hrRAvNVmkDd7I2FQ=; b=Heo2GK+VNE5LyP xFOQjNkeekgSBfWOg+Ujb54O3+CizD6o+gkinXHTSwYlr13y4wnhCrEKerNfhHLduWkPBVNzgz+42 LDBDwaRuOYUR9v0qSEX3oJYaV4r0cYfUo1NyVbhHZ05gS2bQ3UTXeoAQfLPDvEudNmkoDYCJAWKr9 saNmHpMGM4Gxe9zn+0KJqMD3KQhuQxYn/5nWB4rfsxKYw2SgP7ESHTJNZ5fa8+gpuYIJQ7NOreBlx cpHoqswL68o4FOktYyvqPQTAK9D+BTibnwz8dascRneQQeS3X2Ak7AFhb+6bYGqytXs9nTLip/vpv kxogqtBAt8TZqHH2hDdQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovmTv-00024u-6D; Thu, 17 Nov 2022 21:31:35 +0000 Received: from esa.microchip.iphmx.com ([68.232.154.123]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ovmTr-00022w-3k for linux-arm-kernel@lists.infradead.org; Thu, 17 Nov 2022 21:31:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1668720691; x=1700256691; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=zn2ANb9KGFGPelKTi4LkAAqG+JeEdH9yPs/Mesdexvs=; b=g7jaLDSxEeHcV6P5IUuwc87PfKvmvFWX0W7v+km1oscxHCq3j4cqBcN8 XFQgDbSrXdkD6+lgJnxlHIitXqQlGBw+qTiDuo/jmS6oU3hI2NDm6C1I7 HHIh9yKrROt8mUXFvKWNHKy8HAPY9FkN/wUvUStFQoQJ8ZNBW0erLKCy9 csWFIF2//vcM/z2A3hRSpPDmgAi+yqFES0qIWWj6uFMtAR1U7QwH7yKO9 ogAdW1rADaqn3Ul77jZMgjJIXVVrpMwBzJX3ybUIx6Mi//vxEb0VQBrvi DV0kE/NpB5TCwq1F276pp+wzR32Xx3ODPHAlEeNZ6+3VfAzV/2tjtSgkr w==; X-IronPort-AV: E=Sophos;i="5.96,172,1665471600"; d="scan'208";a="123980016" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 17 Nov 2022 14:31:22 -0700 Received: from chn-vm-ex02.mchp-main.com (10.10.87.72) by chn-vm-ex02.mchp-main.com (10.10.87.72) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Thu, 17 Nov 2022 14:31:21 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server id 15.1.2507.12 via Frontend Transport; Thu, 17 Nov 2022 14:31:18 -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 Subject: [PATCH net-next v2 0/8] Add support for VCAP debugFS in Sparx5 Date: Thu, 17 Nov 2022 22:31:06 +0100 Message-ID: <20221117213114.699375-1-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221117_133131_238671_E4B6DF67 X-CRM114-Status: GOOD ( 16.81 ) 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 support for getting VCAP instance, VCAP rule and VCAP port keyset configuration information via the debug file system. It builds on top of the initial IS2 VCAP support found in these series: https://lore.kernel.org/all/20221020130904.1215072-1-steen.hegelund@microchip.com/ https://lore.kernel.org/all/20221109114116.3612477-1-steen.hegelund@microchip.com/ https://lore.kernel.org/all/20221111130519.1459549-1-steen.hegelund@microchip.com/ Functionality: ============== The VCAP API exposes a /sys/kernel/debug/sparx5/vcaps folder containing the following entries: - raw__ This is a raw dump of the VCAP instance with a line for each available VCAP rule. This information is limited to the VCAP rule address, the rule size and the rule keyset name as this requires very little information from the VCAP cache. This can be used to detect if a valid rule is stored at the correct address. - _ This dumps the VCAP instance configuration: address ranges, chain id ranges, word size of keys and actions etc, and for each VCAP rule the details of keys (values and masks) and actions are shown. This is useful when discovering if the expected rule is present and in which order it will be matched. - This shows the keyset configuration per lookup and traffic type and the set of sticky bits (common for all interfaces). This is cleared when shown, so it is possible to sample over a period of time. It also shows if this port/lookup is enabled for matching in the VCAP. This can be used to find out which keyset the traffic being sent to a port, will be matched against, and if such traffic has been seen by one of the ports. Delivery: ========= This is current plan for delivering the full VCAP feature set of Sparx5: - TC protocol all support for IS2 VCAP - Sparx5 IS0 VCAP support - TC policer and drop action support (depends on the Sparx5 QoS support upstreamed separately) - Sparx5 ES0 VCAP support - TC flower template support - TC matchall filter support for mirroring and policing ports - TC flower filter mirror action support - Sparx5 ES2 VCAP support Version History: ================ v2 Removed a 'support' folder (used for integration testing) that had been added in patch 6/8 by a mistake. Wrapped long lines. v1 Initial version Steen Hegelund (8): net: microchip: sparx5: Ensure L3 protocol has a default value net: microchip: sparx5: Ensure VCAP last_used_addr is set back to default net: microchip: sparx5: Add VCAP debugFS support net: microchip: sparx5: Add raw VCAP debugFS support for the VCAP API net: microchip: sparx5: Add VCAP rule debugFS support for the VCAP API net: microchip: sparx5: Add VCAP debugFS key/action support for the VCAP API net: microchip: sparx5: Add VCAP locking to protect rules net: microchip: sparx5: Add VCAP debugfs KUNIT test .../net/ethernet/microchip/sparx5/Makefile | 1 + .../ethernet/microchip/sparx5/sparx5_main.c | 3 + .../ethernet/microchip/sparx5/sparx5_main.h | 3 + .../microchip/sparx5/sparx5_tc_flower.c | 6 +- .../microchip/sparx5/sparx5_vcap_debugfs.c | 200 +++++ .../microchip/sparx5/sparx5_vcap_debugfs.h | 33 + .../microchip/sparx5/sparx5_vcap_impl.c | 67 +- .../microchip/sparx5/sparx5_vcap_impl.h | 48 ++ drivers/net/ethernet/microchip/vcap/Kconfig | 1 + drivers/net/ethernet/microchip/vcap/Makefile | 1 + .../net/ethernet/microchip/vcap/vcap_api.c | 106 ++- .../net/ethernet/microchip/vcap/vcap_api.h | 14 +- .../microchip/vcap/vcap_api_debugfs.c | 782 ++++++++++++++++++ .../microchip/vcap/vcap_api_debugfs.h | 41 + .../microchip/vcap/vcap_api_debugfs_kunit.c | 545 ++++++++++++ .../ethernet/microchip/vcap/vcap_api_kunit.c | 12 +- .../microchip/vcap/vcap_api_private.h | 103 +++ 17 files changed, 1838 insertions(+), 128 deletions(-) create mode 100644 drivers/net/ethernet/microchip/sparx5/sparx5_vcap_debugfs.c create mode 100644 drivers/net/ethernet/microchip/sparx5/sparx5_vcap_debugfs.h create mode 100644 drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.c create mode 100644 drivers/net/ethernet/microchip/vcap/vcap_api_debugfs.h create mode 100644 drivers/net/ethernet/microchip/vcap/vcap_api_debugfs_kunit.c create mode 100644 drivers/net/ethernet/microchip/vcap/vcap_api_private.h