From patchwork Tue Mar 7 13:40:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 13163577 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 7EA9EC678D4 for ; Tue, 7 Mar 2023 13:49:56 +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=FeeOP+bGAzw5ndm0Wvj10pLq4hy4M9dPR3i+RxLRSys=; b=UwHgejfz5TlWjJ 6L0C+kcDME1aOkazKePzXsXynrbHKvysPsPiQfWEc6EdoHx9+aNC32AL9R7dK8t5NDH1ZWhJx8uVY 87Zox4iG3CHoE3MweORqK0Sy4aYGVD+igmpiVkzCJMHtJdnAem6+pzogPFHIqcLAxtKQ1vDuwWWfP VTtYrnnXzwcOBySMVG9JrJbaXgvs/UH2jZ3VMjjgCLnkJ0Mn1cw1zqA69n1JlYKz6ixp0kINcAflu rwfYj4n0hm2fOV4Gw6/KeT6GHx7STykeXcL2Sqf07CPaB/TJwSvRAxsCsXgzyOVUka/R7CulzgX+U ntW1d5SpRvbE6lXjW6HA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZXg6-000Vof-Jv; Tue, 07 Mar 2023 13:48:30 +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 1pZXZ7-000SpU-0A for linux-arm-kernel@lists.infradead.org; Tue, 07 Mar 2023 13:41:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1678196477; x=1709732477; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=0zDakawvvGFutcHa9xipFSfIiYJWbcFRCndb+rI1VNE=; b=URx5nhQf5u0HFdqGCbvWPLzbA4nhaxG4CatgqvwdxzuH51+PJ2qVFeuM 3S7FksKBVfOXxmg3aZjK6KITI/yFGkDrmZQTFBVKJgeprlljIBcMd98WB DcD/77MuvhSA5GRqGNE48o789YAdmDzmh2tv41DvQDneGpSv61BdhcITQ wSAWYgm/cO9GljKji8ISku0g3ZuupH8N+OkOXIzH1vIeOdsnr59hGVlmX x5ZM9NN5NtDbDx1Bg7NwB0Be4aKrD59K5CLm8oRdzkhOZeIPKSgdr5mou 3Ode6itL3T3FiXuC1b1GF4CpT8fTWQbpN8i/zPlwGBzA5wRbyYnOI752B g==; X-IronPort-AV: E=Sophos;i="5.98,241,1673938800"; d="scan'208";a="200373210" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 07 Mar 2023 06:41:15 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 7 Mar 2023 06:41:14 -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, 7 Mar 2023 06:41:10 -0700 From: Steen Hegelund To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni CC: Steen Hegelund , , , , , "Steen Hegelund" , Daniel Machon , Horatiu Vultur , Lars Povlsen , Russell King , Randy Dunlap , "Casper Andersson" , Nathan Huckleberry , Dan Carpenter , Michael Walle , "Wan Jiabing" , Qiheng Lin , "Shang XiaoJing" , Simon Horman Subject: [PATCH net-next 0/5] Add support for TC flower templates in Sparx5 Date: Tue, 7 Mar 2023 14:40:58 +0100 Message-ID: <20230307134103.2042975-1-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230307_054117_166050_00E401AA X-CRM114-Status: GOOD ( 18.78 ) 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 the TC template mechanism in the Sparx5 flower filter implementation. Templates are as such handled by the TC framework, but when a template is created (using a chain id) there are by definition no filters on this chain (an error will be returned if there are any). If the templates chain id is one that is represented by a VCAP lookup, then when the template is created, we know that it is safe to use the keys provided in the template to change the keyset configuration for the (port, lookup) combination, if this is needed to improve the match on the template. The original port keyset configuration is captured in the template state information which is kept per port, so that when the template is deleted the port keyset configuration can be restored to its previous setting. The template also provides the protocol parameter which is the basic information that is used to find out which port keyset configuration needs to be changed. The VCAPs and lookups are slightly different when it comes to which keys, keysets and protocol are supported and used for selection, so in some cases a bit of tweaking is needed to find a useful match. This is done by e.g. removing a key that prevents the best matching keyset from being selected. The debugfs output that is provided for a port allows inspection of the currently used keyset in each of the VCAPs lookups. So when a template has been created the debugfs output allows you to verify if the keyset configuration has been changed successfully. Steen Hegelund (5): net: microchip: sparx5: Correct the spelling of the keysets in debugfs net: microchip: sparx5: Provide rule count, key removal and keyset select net: microchip: sparx5: Add TC template list to a port net: microchip: sparx5: Add port keyset changing functionality net: microchip: sparx5: Add TC template support .../ethernet/microchip/sparx5/sparx5_main.c | 1 + .../ethernet/microchip/sparx5/sparx5_main.h | 1 + .../microchip/sparx5/sparx5_tc_flower.c | 209 +++++++++++++- .../microchip/sparx5/sparx5_vcap_debugfs.c | 2 +- .../microchip/sparx5/sparx5_vcap_impl.c | 270 ++++++++++++++++++ .../microchip/sparx5/sparx5_vcap_impl.h | 6 + .../net/ethernet/microchip/vcap/vcap_api.c | 61 ++++ .../ethernet/microchip/vcap/vcap_api_client.h | 11 + 8 files changed, 553 insertions(+), 8 deletions(-)