Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp522968rwb; Fri, 13 Jan 2023 00:23:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXuF/fpVeJEtxnsHhc0lXRCAal5tb3/6JnMWKLqxXuOSH1fjKstj8AOqRkK5CEardtOv1n6k X-Received: by 2002:a17:902:e345:b0:192:b3d5:44ff with SMTP id p5-20020a170902e34500b00192b3d544ffmr43086917plc.26.1673598223515; Fri, 13 Jan 2023 00:23:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673598223; cv=none; d=google.com; s=arc-20160816; b=T75Xg6s1KbCHwcskzjKoNAXHi98+9P9imMpoKLFEdUdu8ywnoad2A1tExKuaugwqK0 2zlVM4ofbyDUPVZrZUhRqrRea3k7clDidAv8utDBv+w/OAOIFNHFH8iYauW0s8oT1pXZ xUPhAF4r9t/+sZGBhDXhGjP9ZN4F26DXoeZphT60QAnQpBRk4MHP7FEONsZhFzVrtSdn hbDBAp7KDhN+v6UqU59e0XJf58VPN3JeHTHpbh87rt/ziNkQb4TVZBP7Y0Q7ZW4clsDj KEP0f2CjfzHDL2yMVLBRPxiRpvIkiecN7SMVoeNJB7e851k47Hy3bzv6uV9Idz6ijR2J LmFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=aeOZJs6D7k9rCMYpWvEq+OuJusrIm0pSfUIc0FLUPog=; b=w/2t5JA6aGTXEkdO6ww37KgoLybAAwEadVMwEdnmiHJPyX8/g0WOM/RBuCczH7ehKC K8+QuC0R7uTSyLFjHZRn15eoryHskfAKYw9nyy0lgGFC54Y1fOeovTWcm4tpaEVbXFE+ PLcgTqw1n96GcaIzREafGIi8zoIpFJwlunCKpJAdoEQ9LO6NFzZHf0S5hLZ3d9syp24G 9RaSYuyTDt4LIvpuqVQFSI9+o1S0C940UvtBhRTWC3qt+dGSVFHUSopzr2ZEI4tBjcpu NqCg+wL7qODCD3a8SCXXyNEVRK4/n5sglgrH4a6VlfvykN0OoFcmJBaTsKlSWK4RV2Ho gQgw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=C8uaCtsc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n20-20020a170902d0d400b0019462aa0905si3203115pln.474.2023.01.13.00.23.37; Fri, 13 Jan 2023 00:23:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=C8uaCtsc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234671AbjAMIQS (ORCPT + 50 others); Fri, 13 Jan 2023 03:16:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240904AbjAMIPn (ORCPT ); Fri, 13 Jan 2023 03:15:43 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B4ECE41000; Fri, 13 Jan 2023 00:14:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673597677; x=1705133677; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=Y7FOxYVwp7hywXJrSy2gC+GFo0iJ/WSBlTtbFipUyvY=; b=C8uaCtsc/X+fzsVrTOvd8pVHudkzLQ5er7hOm7zb0rbVm0oL/iBZx7HP g2sWtE7VAlYfLNIP1eW10i04TtZJLtBvDo4hoKMRICPculi0dTI80O/5c hY8VOo8lyAHgHAPyUVGTepiWXvfa0k0IBQ4IpSD+r9hwRZSWrXsa1CYnl pAF94ig9V8xDeChYaKAc/GHpCYfZInNDUww3exP7SHb8aSHWbajX5oE4I T8fQRDdbDYiunjcMyV0FdNJAKU70jhMF2urK4KqasHQ4JaWHMCsi4tzp4 hyMHjIoPtX1gs5GOnxgI44GTAc3rSVUSg91Rt7tfAOoPmLpMgrmf79oyL w==; X-IronPort-AV: E=Sophos;i="5.97,213,1669100400"; d="scan'208";a="195616545" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 13 Jan 2023 01:14:36 -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.16; Fri, 13 Jan 2023 01:14:33 -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; Fri, 13 Jan 2023 01:14:27 -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 v3 0/8] Add support for two classes of VCAP rules Date: Fri, 13 Jan 2023 09:14:16 +0100 Message-ID: <20230113081424.3505035-1-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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. Version History: ================ v3 Removed the change that allowed rules to always be added in the LAN996x even though the lookups are not enabled (Horatiu Vultur). Added a check for validity of the chain source when enabling a lookup. v2 Adding a missing goto exit in vcap_add_rule (Dan Carpenter). Added missing checks for error returns in vcap_enable_rule. v1 Initial version 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 | 21 +- .../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 | 767 +++++++++++++----- .../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, 699 insertions(+), 347 deletions(-) -- 2.39.0