Message ID | 20230211184101.651462-1-richard@routerhints.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1614013wrn; Sat, 11 Feb 2023 10:50:38 -0800 (PST) X-Google-Smtp-Source: AK7set/O+qUW+B6I/jsrn75uTf01yRlaxbo48wsM8V92x3IET9LFAnJpL+pXk9AhZUtMvRf1qEPi X-Received: by 2002:a17:906:fa18:b0:878:54e3:e3e1 with SMTP id lo24-20020a170906fa1800b0087854e3e3e1mr19566900ejb.73.1676141438153; Sat, 11 Feb 2023 10:50:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1676141438; cv=pass; d=google.com; s=arc-20160816; b=l9tkoVRUM7Vq1aTaVeAWPO9oGDrbcw8YBfy2uCalVVuSoIeqHxweM5c1uKQkdfVgWA H77nb6GY1vSeHuV2uJ/OUIqdLYpClQZIWxh7OEO54AOAljGw1rqiQgRenHtGv7jMjl/s KEzRtcdzRSkekNQDEd331zwDq8+jM1sQjFKPedzI9TWM2vbna37/ZoMlaF0vCGWcHrFJ CusQ62rsXkMU+EGd39aH8uFib+BbdTENXCwDa1396NiBQsgBQBLwMq44Y2lpUxhGl/MW i0yY4fDQEt1HHYKz+/Tg4ZF7UBVcPeq+QyC7lTc8edyDaKJ2nALmZt0ohZxBL/PACuxb Xp/Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from; bh=ojblXnJZtQ5Nuzx6m+joOQlP2UKppSKbvBR1vJPNz8s=; b=aTaI/fJWLYqkXWFbgNnL7OCAWLoh2+NBU9V2M3f9L8uAfvgCyO/pQa2GxEgLWKtilB rs/WduMbYoP08Nm0KhO7wn0OMzcLuHVHxy0vkQM0EnP3L/MyHIPklLvyZeX10jo3j+vS n7rNJ9LBUmxmiFHYbmfXT3XDgEWa6dz+Ue+0kv/Cz2rYdmBy7cYkT9Lo3LtR2qwtzDaL R+Z0khn/Kj+j07IuqqNlA5yS32xefwjbBa1IaUkVEdVD+GbfHrdT81JHbOmsa6UMwKRg 1QpvX1N/NfPUdHmESI5ooto91rpDLQSXmSkVUCdZ6qvF1d+0PGne+qH0PYMzZDO6Mirg TRAQ== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=routerhints.com dkim=pass dkdomain=routerhints.com dmarc=pass fromdomain=routerhints.com); 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u18-20020a170906109200b0087761dd9827si10250652eju.15.2023.02.11.10.50.15; Sat, 11 Feb 2023 10:50:38 -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; arc=pass (i=1 spf=pass spfdomain=routerhints.com dkim=pass dkdomain=routerhints.com dmarc=pass fromdomain=routerhints.com); 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229601AbjBKSnz (ORCPT <rfc822;olliecheer@gmail.com> + 99 others); Sat, 11 Feb 2023 13:43:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229457AbjBKSny (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 11 Feb 2023 13:43:54 -0500 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2055.outbound.protection.outlook.com [40.107.14.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7A4C9E3B9; Sat, 11 Feb 2023 10:43:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kj38hfv+wbX/FLZhtUDVuAXUbUmdSHftim0WDNIQnf1H/Ub7jTSvCKIoCT1UQ8q8yKtLy/IrXjNmXfipQt1AhphpHjTWT+9roi08QUXLBGGrT2UdNNg7xoy/A7p6ecEstqyTFhjB/mwWR5yBETVGuJMtCR4y4m9YKzynwxxqCGjQn4A01LsYm8P7ly5PnkUpKIUOaMe6LvbXMbjYvCdxWV9E9ssALO72DWrMm7ttgClKsvnNu5MqnKHYsSCn1ccNNX4plHSKQoExV0I5eZzlSchfoByhslZDWstIDi4BVzAsRE0GnaO9IcuCKiaF/aKHz6fnXTptPzxQEr45O4517A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ojblXnJZtQ5Nuzx6m+joOQlP2UKppSKbvBR1vJPNz8s=; b=i1bkE1d6bqQklSPyJ6C3v23AXFtw/nhCYAPnAzbUEvLrO5kTWczX3UVd5XO6EXvmWIebwJUdREAUpAtRQ0W9WPdOl23fFEC49O7KNaibmzuovYkvUObkYVMQb1qFJ4651Ctbd20pskCbHySMXnaxa7JWqwfxFYgebY2i3hnTcbPmUgRAGAQXxFx7gHhBUVwnMG4P9LeFaFsZMdUbuIZgfm95n+6Un0S7ocL2ydTh8x9BRzhWJmQ+dsacSDCCrGte0Wb5wywRJBx5Wh8/EdpY1VHmxS5jpZiiC7wON7W2KzLUEbkq925SuQK53tHgSQk+b2CHDyha4kZsiqY8iOCxxg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=routerhints.com; dmarc=pass action=none header.from=routerhints.com; dkim=pass header.d=routerhints.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=routerhints.com; Received: from VE1PR04MB7454.eurprd04.prod.outlook.com (2603:10a6:800:1a8::7) by AM9PR04MB8413.eurprd04.prod.outlook.com (2603:10a6:20b:3b5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.22; Sat, 11 Feb 2023 18:43:50 +0000 Received: from VE1PR04MB7454.eurprd04.prod.outlook.com ([fe80::e4a3:a727:5246:a5cd]) by VE1PR04MB7454.eurprd04.prod.outlook.com ([fe80::e4a3:a727:5246:a5cd%7]) with mapi id 15.20.6086.022; Sat, 11 Feb 2023 18:43:50 +0000 From: Richard van Schagen <richard@routerhints.com> To: Sean Wang <sean.wang@mediatek.com>, Landen Chao <Landen.Chao@mediatek.com>, DENG Qingfang <dqfext@gmail.com>, Andrew Lunn <andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>, Vladimir Oltean <olteanv@gmail.com>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@google.com>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Matthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, Arinc Unal <arinc.unal@arinc9.com>, Frank Wunderlich <frank-w@public-files.de> Cc: Richard van Schagen <richard@routerhints.com>, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net-next v2] net: dsa: mt7530: add support for changing DSA master Date: Sat, 11 Feb 2023 19:41:01 +0100 Message-Id: <20230211184101.651462-1-richard@routerhints.com> X-Mailer: git-send-email 2.30.2 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: AM0PR02CA0224.eurprd02.prod.outlook.com (2603:10a6:20b:28f::31) To VE1PR04MB7454.eurprd04.prod.outlook.com (2603:10a6:800:1a8::7) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR04MB7454:EE_|AM9PR04MB8413:EE_ X-MS-Office365-Filtering-Correlation-Id: da0f8893-9450-48e7-174f-08db0c5fea61 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: PRcxnX1m7rRzmO6EMr3LzKLCEkdyYOU4TBttahFlBKIgBUNxM/lbM3JmG1EV4rNh5WW8zb/m2qVSZ2nFRwBEt5kJQwoNEjLenwkLLRoC6IsBb34Q+yUHORdNkE+r9Dvzg9B4L5G4iaxlMoHjfb/fhaXmVaf8St8j7iP6f/Vd3rG3el4t1jfelV0zXBA8+e6V/Oh7pcXLx2LUvCK+/pLVEgbxHEBBw3PNdeJbwg+hynAxcdQb1QeRvRLze2obYktBX8GNzEafnxA9iJzFCWBgktxbKMkuJQDHWG/a/ze+ZVz3kML4JIfLm1MVd9MSz0KIp2me+CHCU6M7GpBflksqCGp2QK1v0nEO1J+8xPlkCwRNUQLVnVs55Vj+TtQw5/nHcxJLJSbBrIpYpgMFlQR7FhkkosZyfk4VWnjLWCPxtEByd7TuzEaSPw5hb6Kcbw/S682HIRuFAJ+5Tw9Swe6uK99/e5IuSITHuF0p9tZdk3BO6gKv+zi9VilEtCzLlDa4Lw9m/ZeUq5iKve2wuK8jira0/rS4ysPQCphKMdHiQF2tMsOWLsk6QAcg2KniCTY0OilIUqyG3gdM098BBQwC56N8K+H6U+HsyzM+1IMRNBZTzducYsUgZl3n4EvTQ1hc1ZofBO60d8cRXUwqJ3mUzBCWBvDWt+YQJXqP/Oz19q7VvJKyBPgJLHLz2Mf32v4d X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB7454.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(376002)(366004)(39830400003)(396003)(136003)(346002)(451199018)(186003)(6512007)(52116002)(5660300002)(6486002)(2616005)(478600001)(66476007)(66946007)(66556008)(66574015)(83380400001)(6506007)(6666004)(1076003)(8676002)(4326008)(7416002)(2906002)(41300700001)(8936002)(38100700002)(921005)(86362001)(36756003)(110136005)(316002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?KmOnKyIJPZut5AZ69An946ROzBiG?= =?utf-8?q?nbHo09XBIjKge4zAyWddH2//dTS90kN/HEBGoSvtBnREOKWIVVDmKs4H/gCDIstBc?= =?utf-8?q?og/dhzCPwqxHGdftyKNIYwJRAX19j0UWdv178PBAhywOupGd4C5FiHxAsmz9TmZgg?= =?utf-8?q?dpAaF2HE51H4SYtRplG9dmcQ/cBwyxVw3KEOwURtlP/C+W2UAvHbYXkrTU7hiwzjb?= =?utf-8?q?f/0peEIOIBAxefgmFNcXnqXIvDsWbbhAx6DsP81pLQx7Z+FY5YGtPFgylEaYTxQIv?= =?utf-8?q?DQgxHm0/PhMZAhU2Tvh52nAN73y3quV3FrjvmVCkwx6/WZCFAxXU54Wf7wjKevj4M?= =?utf-8?q?pCidkYa766eoMHkNpFHrIa1HAbKddYL2WlX9Su2y8hvBGutZxIwK6lmJ+X80zhQDX?= =?utf-8?q?guw3AePSyNH16lxedezxnLqxsArHOanYApyA4tSBE5tDWGZu9XMC+Z8YfHt7lZCB6?= =?utf-8?q?3YeEqWo85+nb1rV5jJ3emQbXO3VZ7kmpw1AjXxEnFquBtiOeeFRDjQtp69tqhJmdR?= =?utf-8?q?u/KZysYiWADjOzv/uY1nRsky07RMrJ8ZvZzWW5ZYAZfecfhiQuoK4abZDY0QM/J9B?= =?utf-8?q?MMukIaAlHPeVjXAEFlBl6Wz8ILHvVX35QLlhqAoAfL1Wp8cAM7r6Y9VW5fDpYP88h?= =?utf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OvtUm+UoYLpa0gJfMxAsW5JJdwUVCghfL8nTaDKtdLkDZV/FX3uUjkEfLIA?= =?utf-8?q?MoWti15sirXRvC2qWQf/9HTUd1ncmK4oA=3D=3D?= X-OriginatorOrg: routerhints.com X-MS-Exchange-CrossTenant-Network-Message-Id: da0f8893-9450-48e7-174f-08db0c5fea61 X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB7454.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Feb 2023 18:43:49.9214 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 28838f2d-4c9a-459e-ada0-2a4216caa4fd X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 6ZdTjZ8Nw9iqiyP+TmjjUiUtH6lumvKjzjHK3Xq/NKF338CJSH/hQzNgdE4117VhYMx5pgLVe9z/22QTnjJ3Eg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8413 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE, 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?1757561684519739467?= X-GMAIL-MSGID: =?utf-8?q?1757561684519739467?= |
Series |
[net-next,v2] net: dsa: mt7530: add support for changing DSA master
|
|
Commit Message
Richard van Schagen
Feb. 11, 2023, 6:41 p.m. UTC
Add support for changing the master of a port on the MT7530 DSA subdriver. Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com> Signed-off-by: Richard van Schagen <richard@routerhints.com> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com> --- drivers/net/dsa/mt7530.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
Comments
On Sat, Feb 11, 2023 at 07:41:01PM +0100, Richard van Schagen wrote: > Add support for changing the master of a port on the MT7530 DSA subdriver. > > > Tested-by: Arınç ÜNAL <arinc.unal@arinc9.com> > Signed-off-by: Richard van Schagen <richard@routerhints.com> > Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com> > --- Currently with this driver, the only way for a frame to reach the CPU is via flooding. The DSA framework can do better: it can configure the driver to only accept certain whitelisted MAC addresses, which reduces unwanted traffic to the CPU. But it needs driver level support for some prerequisites, namely FDB isolation, se see dsa_switch_supports_uc_filtering() and dsa_switch_supports_mc_filtering(). If somebody decides to add support for RX filtering later to the mt7530 driver, he might not have access to a setup with multiple CPU ports. So this might become a blocking issue for him. Would it make more sense to unlock RX filtering for the mt7530 driver now, and to make the FDB entries added on the CPU ports work when multiple CPU ports exist, too? Now seems like the most logical moment to do that, not later.
diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index b5ad4b4fc00c..2374166c4858 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -1072,6 +1072,35 @@ mt7530_port_disable(struct dsa_switch *ds, int port) mutex_unlock(&priv->reg_mutex); } +static int +mt7530_port_change_master(struct dsa_switch *ds, int port, + struct net_device *master, + struct netlink_ext_ack *extack) +{ + struct mt7530_priv *priv = ds->priv; + struct dsa_port *dp = dsa_to_port(ds, port); + struct dsa_port *cpu_dp = master->dsa_ptr; + + if (netif_is_lag_master(master)) { + NL_SET_ERR_MSG_MOD(extack, + "LAG DSA master not supported"); + return -EOPNOTSUPP; + } + + mutex_lock(&priv->reg_mutex); + + /* Move old to new cpu on User port */ + priv->ports[port].pm &= ~PCR_MATRIX(BIT(dp->cpu_dp->index)); + priv->ports[port].pm |= PCR_MATRIX(BIT(cpu_dp->index)); + + mt7530_rmw(priv, MT7530_PCR_P(port), PCR_MATRIX_MASK, + priv->ports[port].pm); + + mutex_unlock(&priv->reg_mutex); + + return 0; +} + static int mt7530_port_change_mtu(struct dsa_switch *ds, int port, int new_mtu) { @@ -3157,6 +3186,7 @@ static const struct dsa_switch_ops mt7530_switch_ops = { .set_ageing_time = mt7530_set_ageing_time, .port_enable = mt7530_port_enable, .port_disable = mt7530_port_disable, + .port_change_master = mt7530_port_change_master, .port_change_mtu = mt7530_port_change_mtu, .port_max_mtu = mt7530_port_max_mtu, .port_stp_state_set = mt7530_stp_state_set,