From patchwork Sat Jan 14 13:42:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 13101979 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 929EEC3DA78 for ; Sat, 14 Jan 2023 13:44:09 +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=hrbx/GUF41kW7mqWn4P/ouk3/bvmoWTZOYKF9vlWkdg=; b=vWfiJeehu/FJ8n KlvKGgVJz6yqiDIwhDtVFTeWiVEU6GeLBG5AgDizgegcFmwsIvjVP+9dyWyHj8+oAEAkXfpSqkJJx R+QHk5CnCzcxJXaxkdWw7JQjzgwhiDKVf85SYiAKmMFKj/+BGGRbIomSkLfGRtTd66wplWAq9GK9j cTtJ7mE2LvfHoQW0PDs9rT0wSn7kK7FvmnrSP+MPOrqXuqdImkrdcE7ayH6WzxHquFS1NOxYIS6BX x7zTkI3qglyl7dVykyHzu/LP7wTMxdlfmPV3Ji8sZEieN+roxaqGfnTLoKfwVPraHKp177r+61lJ6 fgbA8whvOuUhMGK9B1xA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGgoG-005vCD-Sz; Sat, 14 Jan 2023 13:43:01 +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 1pGgoC-005v9r-Ge for linux-arm-kernel@lists.infradead.org; Sat, 14 Jan 2023 13:42:58 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1673703777; x=1705239777; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=EgsloK4GNcROOIjStl6+TFXiEnL7mEEToz3XHFGbjvg=; b=qSNXDWh396JkkKpqUgwnbljlpSgSSvwYXeaTfz85VV+cP03EckMJLWSE bdQvn/8GzGUIGB5OnMZmZOifYTJzlTgJlRHam5gUWFtcmWdUdwkN8Us01 UbC5xLAxPnny+BmpONq1Y8WxJgS1jCfu7FMDuj93GYd2b3bftk8yK2ad/ stiaUIV6Obz1YOlSLqGUHIiTmc7Gu9jOWu+ZqfeFOV/DthrL6znNzVmce PCRwI7PakvT2NXX6mn0nh79bMWYmGgitZKlUm8VQz7ChjjszyqdmldckH SwFxU8QxwKDuUNUFzb4TsLNf/0Zl8P4wU9d9EW56IVROBjGSd3Da6lCUt Q==; X-IronPort-AV: E=Sophos;i="5.97,216,1669100400"; d="scan'208";a="192264067" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa4.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 14 Jan 2023 06:42:51 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) 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; Sat, 14 Jan 2023 06:42:49 -0700 Received: from den-dk-m31857.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Sat, 14 Jan 2023 06:42:46 -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 v4 0/8] Add support for two classes of VCAP rules Date: Sat, 14 Jan 2023 14:42:34 +0100 Message-ID: <20230114134242.3737446-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-20230114_054256_707232_4D0B8ACF X-CRM114-Status: GOOD ( 13.27 ) 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. Version History: ================ v4 Removed a leftover 'Fixes' tag from v2. No functional changes. v3 Removed the change that allowed rules to always be added in the LAN996x even though the lookups are not enabled (Horatiu Vultur). This was sent separately to net instead. Removed the 'Fixes' tags due to the patch sent to net by 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(-)