From patchwork Fri Nov 11 13:05:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 13040292 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 5FB38C433FE for ; Fri, 11 Nov 2022 13:06: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=I6mmRONxIuVjkzNqDpMbZ5i6xTH+7FOMilaskBYthxU=; b=BK5LCamUmfi8+T a+D6Cfoev8gyWmJRNOBLCLM871U9ino4vP0aop2hRmQBlS3WgBnUlKyrcozecY5/FuAMWKcbXPOgm BTQ2LDm5F41U9+mWEAn/bUoq44ICsDkQiSLT0Biou/4iQYFBKKXr0GUqgCq3lJoDUJ/HyymZr6Tdj D31xsuQjXOlNQFXv7GYKHUY8zGmg9Df5YGUHIXzgYUxnUV2fL/Fo/lYffTcEvKPyWWjfJuB0N5AN2 Lsh1uKI/5Zey78ck3oCXJ2SN+OQvTc90BAzQDgjXUzQWzeauqqCUPfk1enUul/C3mnCJkoJqR7Wpk BA6QUudpEEkrgTHhU11Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1otTj1-00Fla9-FW; Fri, 11 Nov 2022 13:05:39 +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 1otTix-00FlVp-Jg for linux-arm-kernel@lists.infradead.org; Fri, 11 Nov 2022 13:05:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1668171935; x=1699707935; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=OkhSa88+pvWXzzNAdUKByN9C89JcvFoOdQy9ZtA7Az4=; b=hvgSakP/LtDY0dfkG8KTPBYWljurhxsy3qaFzWtvlt5i+ssQXjVac78o yF6XbJiK8MO4CQAi1OTEAjqJWyq/cA0kmcMXs+hLYTUS7p/q8AV79fIKA 9zspcA0feQFgQSbfV8uWDOHLDbljRsTdhPYPQc+wL4cEy4qNgwav+ZBxR gSUlnGQrt1CPAGaYlR5t43sN7+PxnzPBUGgiK4s54XxFxMobOXsSQ012I VoAJWv/V/Oy9x2Liu8/ioEMbH/wo2BWFAz2rrRrPbRr3ipXhCEIb4u2cL j1JHmGuW3rBecT6III0Q90Ab2+T116/2U5tyLfSqxavZXoEVBb8hW1/eU Q==; X-IronPort-AV: E=Sophos;i="5.96,156,1665471600"; d="scan'208";a="123000811" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 11 Nov 2022 06:05:28 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.12; Fri, 11 Nov 2022 06:05:28 -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.12 via Frontend Transport; Fri, 11 Nov 2022 06:05:24 -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 , Simon Horman , Louis Peens , "Wojciech Drewek" , Baowen Zheng , Maksym Glubokiy , Pablo Neira Ayuso Subject: [PATCH net-next 0/6] Add support for sorted VCAP rules in Sparx5 Date: Fri, 11 Nov 2022 14:05:13 +0100 Message-ID: <20221111130519.1459549-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-20221111_050535_755657_6D574E6C X-CRM114-Status: GOOD ( 15.30 ) 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 adding Sparx5 VCAP rules in sorted order, VCAP rule counters and TC filter matching on ARP frames. 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/ Functionality ============= When a new VCAP rule is added the driver will now ensure that the rule is inserted in sorted order, and when a rule is removed, the remaining rules will be moved to keep the sorted order and remove any gaps in the VCAP address space. A VCAP rule is ordered using these 3 values: - Rule size: the count of VCAP addresses used by the rule. The largest rule have highest priority - Rule User: The rules are ordered by the user enumeration - Priority: The priority provided in the flower filter. The lowest value has the highest priority. A VCAP instance may contain the counter as part of the VCAP cache area, and this counter may be one or more bits in width. This type of counter automatically increments its value when the rule is hit. Other VCAP instances have a dedicated counter area outside of the VCAP and in this case the rule must contain the counter id to be able to locate the counter value and cause the counter to be incremented. In this case there must also be a VCAP rule action that sets the counter id. The Sparx5 IS2 VCAP uses a dedicated counter area with 32bit counters. This series adds support for getting VCAP rule counters and provide these via the TC statistic interface. This only support packet counters, not byte counters. Finally the series adds support for the ARP frame dissector and configures the Sparx5 IS2 VCAP to generate the ARP keyset when ARP traffic is received. Delivery: ========= This is current plan for delivering the full VCAP feature set of Sparx5: - DebugFS support for inspecting rules - TC protocol all support - 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 Steen Hegelund (6): net: flow_offload: add support for ARP frame matching net: microchip: sparx5: Add support for TC flower ARP dissector net: microchip: sparx5: Add/delete rules in sorted order net: microchip: sparx5: Add support for IS2 VCAP rule counters net: microchip: sparx5: Add support for TC flower filter statistics net: microchip: sparx5: Add KUNIT test of counters and sorted rules .../microchip/sparx5/sparx5_tc_flower.c | 144 +++++ .../microchip/sparx5/sparx5_vcap_impl.c | 76 ++- .../net/ethernet/microchip/vcap/vcap_api.c | 233 +++++++- .../ethernet/microchip/vcap/vcap_api_client.h | 14 + .../ethernet/microchip/vcap/vcap_api_kunit.c | 526 ++++++++++++++++++ include/net/flow_offload.h | 6 + net/core/flow_offload.c | 7 + 7 files changed, 990 insertions(+), 16 deletions(-)