Message ID | 20221221132517.2699698-1-steen.hegelund@microchip.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp3522606wrn; Wed, 21 Dec 2022 05:29:53 -0800 (PST) X-Google-Smtp-Source: AMrXdXuqLnLL2dq91S6iPIP3rfP8k7B2Wl838Clq7dxX12NbDzZBVTZGFtPzK9PSUdCs/zOYPQ4D X-Received: by 2002:a05:6a20:1586:b0:a3:8eb5:6869 with SMTP id h6-20020a056a20158600b000a38eb56869mr3339999pzj.14.1671629393039; Wed, 21 Dec 2022 05:29:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671629393; cv=none; d=google.com; s=arc-20160816; b=kFhkGU+a/csRTFo4kGc+kYSQvX69vU85TXAlxauUmuw+LvYJGKg6wI8b656ZBPPx6W 5ap9+jj9BUHNnczsth7R8XSmfaLJmc8bXmThUbnShWfwAM8dM6q5rMigRFiaeqmPJwwn omTuvjmXYPsUvr8kFJ0NxrbchaiDIwtZO0YA2CQaUcSARzUyuYIqXTq8mFSq8AP7vT1L 1pU+9qPpXlDJ+Cmad/Dv0u8Jyov1+g6q2y3cqFPDNgr+pxYxDQ3cHoONoOWc7IHjB4I9 HTHo+02aNWdXPAjqJDyEjhzszqwePexdE2QC4DgTXmNU1KhflPsFwd7jxqa5Qv6lwYl1 tGjQ== 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=Wa0s1e+xz0udTkw16SKY7KEnToWY+EmDFt/PebxZM3A=; b=OZzj2iZaPqjfJBUv0N/E5GedEjHinNEzvoInWFXx/DJ1J2D9tutLxuISJ7GVSK8XKh cY1973pdDON7Qso7nWajXCfnxt4ZIrKWtk4ftrZk2vM+n4f7V4NRunNRCF/sOEqpR9/2 2sCWwyqaKBDCPXlODQ4j5kX1brcDiSoQizOVApwKLd8YrLQbjzpQrCSbhJlPmmqUffuT I2GsX3JGSc2n0fM5UcNXnlUUyn7vfY2DtVZa8wo5pR64rOSjfTJs5QM/HQtdYnbnHBC2 trm3TdnomT8ziI1ByvH5alaY7Cd2b6PGcHXkec9Ric0tqqDP0fhRCVoq97mKjReTUYNk OcOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=fJgpDD89; 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 v185-20020a6389c2000000b0047c9e9084c4si16161385pgd.565.2022.12.21.05.29.40; Wed, 21 Dec 2022 05:29:53 -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=fJgpDD89; 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 S233862AbiLUNZg (ORCPT <rfc822;pacteraone@gmail.com> + 99 others); Wed, 21 Dec 2022 08:25:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229612AbiLUNZd (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 21 Dec 2022 08:25:33 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 15E22220C7; Wed, 21 Dec 2022 05:25:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1671629130; x=1703165130; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=9OBG3ndMcB4Yh+Zf7d0uJm/I1/nGZ85J8AhipMgp+MM=; b=fJgpDD89SvcHlQj0wog3khUtREMw8mIdXvV4gXcWXveMlRxFtsGF+pkm yFeKSfng/saKlCUGVF0j4MjPz5wWPos3+pYZlmEukcwtams/whsCAUIYl iNnvxV9ANY4TbUphg9c3S0bgoq2rhjPSzQjIVNXan+hRPPcce+0vw9IZf EE4gCj10F2PZWmmNBWWNPtHyejDQCu9P+ixcXaDTyeEQ77KLNj/owfnsW +hDRX4vy8Jx6VBvZDpukPiIIN7VHttwuIYxy1x+52DM/UyWkEG/4haN1+ a6pLjDtxWU7nSYFcWQ3zf9N7tgg9uCdp2Qt156VUsnmBTEc5ls0RzQAop w==; X-IronPort-AV: E=Sophos;i="5.96,262,1665471600"; d="scan'208";a="192695936" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 21 Dec 2022 06:25:29 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) 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; Wed, 21 Dec 2022 06:25:27 -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; Wed, 21 Dec 2022 06:25:24 -0700 From: Steen Hegelund <steen.hegelund@microchip.com> To: "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com> CC: Steen Hegelund <steen.hegelund@microchip.com>, <UNGLinuxDriver@microchip.com>, Randy Dunlap <rdunlap@infradead.org>, "Casper Andersson" <casper.casan@gmail.com>, Russell King <rmk+kernel@armlinux.org.uk>, Wan Jiabing <wanjiabing@vivo.com>, "Nathan Huckleberry" <nhuck@google.com>, <linux-kernel@vger.kernel.org>, <netdev@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, "Steen Hegelund" <Steen.Hegelund@microchip.com>, Daniel Machon <daniel.machon@microchip.com>, Horatiu Vultur <horatiu.vultur@microchip.com>, Lars Povlsen <lars.povlsen@microchip.com>, Dan Carpenter <error27@gmail.com> Subject: [PATCH net 0/8] Add support for two classes of VCAP rules Date: Wed, 21 Dec 2022 14:25:09 +0100 Message-ID: <20221221132517.2699698-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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752830462497928232?= X-GMAIL-MSGID: =?utf-8?q?1752830462497928232?= |
Series |
Add support for two classes of VCAP rules
|
|
Message
Steen Hegelund
Dec. 21, 2022, 1:25 p.m. UTC
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. 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 | 24 +- .../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 | 752 +++++++++++++----- .../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, 685 insertions(+), 349 deletions(-)
Comments
Hello, On Wed, 2022-12-21 at 14:25 +0100, Steen Hegelund wrote: > 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. Despite the 'net' target, this looks really like net-next material as most patches look like large refactor. I see there are a bunch of fixes in patches 3-8, but quite frankly it's not obvious at all what the refactors/new features described into the commit messages themself really fix. I suggest to move this series to net-next (and thus repost after Jan 2), unless you come-up with some good reasons to keep it in net. Thanks, Paolo
Hi Paolo, On Thu, 2022-12-22 at 15:22 +0100, Paolo Abeni wrote: > EXTERNAL EMAIL: Do not click links or open attachments unless you know the > content is safe > > Hello, > On Wed, 2022-12-21 at 14:25 +0100, Steen Hegelund wrote: > > 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. > > Despite the 'net' target, this looks really like net-next material as > most patches look like large refactor. I see there are a bunch of fixes > in patches 3-8, but quite frankly it's not obvious at all what the > refactors/new features described into the commit messages themself > really fix. Yes the patches 3-8 is the response to Michael Walles observations on LAN966x and Jakubs Kicinski comment (see link), but the description in the commits may not be that clear, in the sense that they do not state one-to-one what the mitigation is. See https://lore.kernel.org/netdev/20221209150332.79a921fd@kernel.org/ So essentially this makes it possible to have rules that are always in the VCAP HW (to make the PTP feature work), even before the TC chains have been established (which was the problem that Michael encountered). I still think this a net submission, since it fixes the problem that was observed in the previous netnext window. But I will rephrase the reasoning in a V2 to hopefully make that more understandable. If you still think it is better to post this in the upcoming net-next window, I am also OK with that. > > I suggest to move this series to net-next (and thus repost after Jan > 2), unless you come-up with some good reasons to keep it in net. > > Thanks, > > Paolo > BR Steen
On Thu, 2022-12-22 at 16:02 +0100, Steen Hegelund wrote: > On Thu, 2022-12-22 at 15:22 +0100, Paolo Abeni wrote: > > Despite the 'net' target, this looks really like net-next material as > > most patches look like large refactor. I see there are a bunch of fixes > > in patches 3-8, but quite frankly it's not obvious at all what the > > refactors/new features described into the commit messages themself > > really fix. > > Yes the patches 3-8 is the response to Michael Walles observations on LAN966x > and Jakubs Kicinski comment (see link), but the description in the commits may > not be that clear, in the sense that they do not state one-to-one what the > mitigation is. > > See https://lore.kernel.org/netdev/20221209150332.79a921fd@kernel.org/ > > So essentially this makes it possible to have rules that are always in the VCAP > HW (to make the PTP feature work), even before the TC chains have been > established (which was the problem that Michael encountered). > > I still think this a net submission, since it fixes the problem that was > observed in the previous netnext window. > > But I will rephrase the reasoning in a V2 to hopefully make that more > understandable. > > If you still think it is better to post this in the upcoming net-next window, I > am also OK with that. IMHO this series is quite too invasive for net, especially considering it will possibly land into the Linus tree with a timeframe promising a large latency in response to any problem. If there is any kind of available workaround to address the issue (comprising disabling h/w offload) I *think* net-next would be a better option. Cheers, Paolo