From patchwork Tue Jan 24 10:45:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steen Hegelund X-Patchwork-Id: 4453 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2079055wrn; Tue, 24 Jan 2023 02:49:32 -0800 (PST) X-Google-Smtp-Source: AMrXdXsdgMEy6u7mwmWjG2oCUHP6XXet1GwdPSPbQPSWIUlme9an7wkQJKbIPhEqjJXG+jUHtlUp X-Received: by 2002:a17:902:ebcc:b0:194:d1ee:954 with SMTP id p12-20020a170902ebcc00b00194d1ee0954mr19798145plg.7.1674557372525; Tue, 24 Jan 2023 02:49:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674557372; cv=none; d=google.com; s=arc-20160816; b=PaN0U9hYpQ1ZPsatgCfek29AL92vZcBCUtlEYtt8vW5QeY81KGGYVpfbMUx1QXBFrE aSylxczPnMHEqgR6B+y3/XMFJp1lADAVTaXo4b2tPX8DEqaafZkmPPnrr9sZYCkbSUA2 03BZNfKZSlkRJd4YSPPuqN6EE/0k/UcPvErDzGgInpXbVia6yCNakjBOz8TXUI3ygigY 6XUeDbT8G5CGrUB8HtV8y7SVpKSDzaBxfQW3Sr29+BOuaX7jfN4In7TJFjClcvyXJlSy 1dFoLkfB4A/LnOd2UL4YHF9ynm3y3Uuqerg+fpjZ5i2FJgwwBYbk896aCJzADfxGCltx IS7g== 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=LVSbrwhQLDUJ8wattpqo6YjAtPObR3SvjV9df5bVp6w=; b=OafJCHg+PCmcR8G2um6ceAV5pOFr0WEEIyLc8rMAjzs+ryw8bnfdbBp8QPuZIzRc/r JsjVGxjsuZ8wNC1ffHBa6QU+JzdJfZ2b9Q01pgRa0Kd5qaJaqKJyKtRJV6j6n1XMsgd/ 7tKthEyrJgZIZB16P6Qa4ysOTnPkWIpcDmeJWv6z3+6OC50DRk4FJcM/e1k962ZELgs2 qcZ1Tp8yYM0NT9eNSpjAWjsd3Jwf5I3osV3pF0XVTurb/NjeVc9fsGEIsoooW0OJ3HOO QOWWtu74vMFbgs/yhGozNAg7+3lvoCgW2K8zbpFJZzAcPOE7DS3D2/PX60CdBZcIjYW4 m1gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=BodJBWjF; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n3-20020a170902dc8300b001949b91518esi2274388pld.17.2023.01.24.02.49.20; Tue, 24 Jan 2023 02:49:32 -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=BodJBWjF; 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 S233581AbjAXKpd (ORCPT + 99 others); Tue, 24 Jan 2023 05:45:33 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231871AbjAXKpb (ORCPT ); Tue, 24 Jan 2023 05:45:31 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 062CF12F04; Tue, 24 Jan 2023 02:45:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1674557125; x=1706093125; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=RwiF2ESGcXxGOh6GWmHVLESVsmvz3aB1KmPhfiNoAWg=; b=BodJBWjF3j4mmgyfVQnwr8Kd4gIK7rdzlEk3FalZm+9fX7l8ipLsf+oy hHtEuZjrUCQAS+xzUAcRWrYMnqeA60LHHjdEfSj0o9yzdPv/oOFm7iIIB ubskp+rXNEoQO/amU7e41jFKrPLiK1bKXACRLF5NwwrPBwb0CvPbWASwm V12EcINeuEm/Itf45qvni14G2yVBvDkFQ8DDgVIgLfvPKFFqG4G5bVmrz d8N7DrQPJ9N0i2KzCfWlhfHXUALqSX5lekIMuAX8n1Jfegh1VzbkDMlrj sC6ieLPBdwFX2g5ZoQ9waxzKZuN9SieiJ/kC4BAuSJEfeMJnx+Iso9Whs g==; X-IronPort-AV: E=Sophos;i="5.97,242,1669100400"; d="scan'208";a="197853103" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa3.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 24 Jan 2023 03:45:19 -0700 Received: from chn-vm-ex04.mchp-main.com (10.10.85.152) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Tue, 24 Jan 2023 03:45:17 -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, 24 Jan 2023 03:45:13 -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 v2 0/8] Adding Sparx5 IS0 VCAP support Date: Tue, 24 Jan 2023 11:45:03 +0100 Message-ID: <20230124104511.293938-1-steen.hegelund@microchip.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1755900671842026492?= X-GMAIL-MSGID: =?utf-8?q?1755900671842026492?= This provides the Ingress Stage 0 (IS0) VCAP (Versatile Content-Aware Processor) support for the Sparx5 platform. The IS0 VCAP (also known in the datasheet as CLM) is a classifier VCAP that mainly extracts frame information to metadata that follows the frame in the Sparx5 processing flow all the way to the egress port. The IS0 VCAP has 4 lookups and they are accessible with a TC chain id: - chain 1000000: IS0 Lookup 0 - chain 1100000: IS0 Lookup 1 - chain 1200000: IS0 Lookup 2 - chain 1300000: IS0 Lookup 3 - chain 1400000: IS0 Lookup 4 - chain 1500000: IS0 Lookup 5 Each of these lookups have their own port keyset configuration that decides which keys will be used for matching on which traffic type. The IS0 VCAP has these traffic classifications: - IPv4 frames - IPv6 frames - Unicast MPLS frames (ethertype = 0x8847) - Multicast MPLS frames (ethertype = 0x8847) - Other frame types than MPLS, IPv4 and IPv6 The IS0 VCAP has an action that allows setting the value of a PAG (Policy Association Group) key field in the frame metadata, and this can be used for matching in an IS2 VCAP rule. This allow rules in the IS0 VCAP to be linked to rules in the IS2 VCAP. The linking is exposed by using the TC "goto chain" action with an offset from the IS2 chain ids. As an example a "goto chain 8000001" will use a PAG value of 1 to chain to a rule in IS2 Lookup 0. Version History: ================ v2 Added corrections suggested by Dan Carpenter. v1 Initial version Steen Hegelund (8): net: microchip: sparx5: Add IS0 VCAP model and updated KUNIT VCAP model net: microchip: sparx5: Add IS0 VCAP keyset configuration for Sparx5 net: microchip: sparx5: Add actionset type id information to rule net: microchip: sparx5: Add TC support for IS0 VCAP net: microchip: sparx5: Add TC filter chaining support for IS0 and IS2 VCAPs net: microchip: sparx5: Add automatic selection of VCAP rule actionset net: microchip: sparx5: Add support for IS0 VCAP ethernet protocol types net: microchip: sparx5: Add support for IS0 VCAP CVLAN TC keys .../microchip/sparx5/sparx5_main_regs.h | 64 +- .../microchip/sparx5/sparx5_tc_flower.c | 227 +- .../microchip/sparx5/sparx5_vcap_ag_api.c | 1110 ++++++++- .../microchip/sparx5/sparx5_vcap_debugfs.c | 131 +- .../microchip/sparx5/sparx5_vcap_impl.c | 401 +++- .../microchip/sparx5/sparx5_vcap_impl.h | 61 + .../net/ethernet/microchip/vcap/vcap_ag_api.h | 336 +-- .../net/ethernet/microchip/vcap/vcap_api.c | 184 +- .../net/ethernet/microchip/vcap/vcap_api.h | 7 + .../ethernet/microchip/vcap/vcap_api_client.h | 2 + .../ethernet/microchip/vcap/vcap_api_kunit.c | 2 +- .../microchip/vcap/vcap_model_kunit.c | 1994 ++--------------- 12 files changed, 2360 insertions(+), 2159 deletions(-)