From patchwork Thu Jan 5 08:13:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 13090309 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 B72CFC4708E for ; Thu, 5 Jan 2023 19:13:59 +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=2X3pl60UW1P+mKURZ5pMy3cRk1xCfpY0bZVMNydxwEQ=; b=CZSyn+bW3VSTox dO/tCCkv+aEIg5Fhr3kEBm+rWCMjDN1KzUmrFEDrDvJ9Ab8WafzhInZKJ0cgM/zzIRo1C4F1jQRPQ w0OKytHVUJc+d0Zu+nyuuHgobyyNQnPKF73mFGuWfK05rwbeAReGFvR5iKecImIsnbJJ8TPO+hhkP MXyMO7kU8819cnSmgdtInq0wrbgyYDTiprmp8Xj9DXX5vUKkrqajgmIy90Yxk4MCUO8JiMPGZewO1 hdiRMWHytfmcKSWjnu+OSf/jVwk019rJ5VI3Qw/2q93C76pMWbTjnA2OFmECLPXI06u6XWZMYnGbL sY2Ul53EsJxI22WG3paQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDVfc-00E0US-Mb; Thu, 05 Jan 2023 19:12:56 +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 1pDLNr-008Pnb-M5 for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 08:14:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1672906435; x=1704442435; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9OBG3ndMcB4Yh+Zf7d0uJm/I1/nGZ85J8AhipMgp+MM=; b=hHBiLWH65xx7SJmr83hvdsNEDZ3eRN9CEni6XIubIoqgfF4U32qnrl+0 I6IvY1SIPsqgLdNIniir5uxuTkdeBUctWJOWpGoKRjEYcEp7sUz0HkEBe yA1ZWkFjIrfPRlDL5cTxICkkfuTKRgxf55UJac2cTAzUdba7odjtUx6rc 5OT/qt77lVY7KAMf+M6XrAn56qzKy4uikHJMxprz95Ojm4ngseJXHf8HG diWYZDLGO/fKNLoe4BqUWtpk1Iobfz490//iXHC9uckabPSh7yoIT3wJN UohnRQ59P0ov3vut5Su2KL9s8BezO6NNYYx48uPPNXHm7rPIncg21ZUnH A==; X-IronPort-AV: E=Sophos;i="5.96,302,1665471600"; d="scan'208";a="194363228" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 05 Jan 2023 01:13:43 -0700 Received: from chn-vm-ex01.mchp-main.com (10.10.85.143) 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; Thu, 5 Jan 2023 01:13:42 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 5 Jan 2023 01:13:38 -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 Subject: [PATCH net-next 0/8] Add support for two classes of VCAP rules Date: Thu, 5 Jan 2023 09:13:27 +0100 Message-ID: <20230105081335.1261636-1-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230105_001356_558566_5C40758B X-CRM114-Status: GOOD ( 11.66 ) 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 adds support for two classes of VCAP rules: - Permanent rules (added e.g. for PTP support) - TC user rules (added by the TC userspace tool) For this to work the VCAP Loopups must be enabled from boot, so that the "internal" clients like PTP can add rules that are always active. When the TC tool add a flower filter the VCAP rule corresponding to this filter will be disabled (kept in memory) until a TC matchall filter creates a link from chain 0 to the chain (lookup) where the flower filter was added. When the flower filter is enabled it will be written to the appropriate VCAP lookup and become active in HW. Likewise the flower filter will be disabled if there is no link from chain 0 to the chain of the filter (lookup), and when that happens the corresponding VCAP rule will be read from the VCAP instance and stored in memory until it is deleted or enabled again. Steen Hegelund (8): net: microchip: vcap api: Erase VCAP cache before encoding rule net: microchip: sparx5: Reset VCAP counter for new rules net: microchip: vcap api: Always enable VCAP lookups net: microchip: vcap api: Convert multi-word keys/actions when encoding net: microchip: vcap api: Use src and dst chain id to chain VCAP lookups net: microchip: vcap api: Check chains when adding a tc flower filter net: microchip: vcap api: Add a storage state to a VCAP rule net: microchip: vcap api: Enable/Disable rules via chains in VCAP HW .../ethernet/microchip/lan966x/lan966x_goto.c | 10 +- .../ethernet/microchip/lan966x/lan966x_main.h | 3 +- .../microchip/lan966x/lan966x_tc_flower.c | 30 +- .../microchip/lan966x/lan966x_tc_matchall.c | 16 +- .../microchip/lan966x/lan966x_vcap_impl.c | 24 +- .../microchip/sparx5/sparx5_tc_flower.c | 28 +- .../microchip/sparx5/sparx5_tc_matchall.c | 16 +- .../microchip/sparx5/sparx5_vcap_debugfs.c | 2 +- .../microchip/sparx5/sparx5_vcap_impl.c | 29 +- .../net/ethernet/microchip/vcap/vcap_api.c | 752 +++++++++++++----- .../net/ethernet/microchip/vcap/vcap_api.h | 5 - .../ethernet/microchip/vcap/vcap_api_client.h | 8 +- .../microchip/vcap/vcap_api_debugfs.c | 57 +- .../microchip/vcap/vcap_api_debugfs_kunit.c | 10 +- .../ethernet/microchip/vcap/vcap_api_kunit.c | 32 +- .../microchip/vcap/vcap_api_private.h | 12 +- 16 files changed, 685 insertions(+), 349 deletions(-)