Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3665967rwd; Fri, 16 Jun 2023 23:29:39 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4z++qaYWb3phPMyADDhTibUy/CpFi81EPpdf3miQKL1kY6SZzKFQJpvsHX+Yys/rIHn8aH X-Received: by 2002:a81:9c49:0:b0:561:206a:ee52 with SMTP id n9-20020a819c49000000b00561206aee52mr4801741ywa.24.1686983379068; Fri, 16 Jun 2023 23:29:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686983379; cv=none; d=google.com; s=arc-20160816; b=LB4v6Ap9pAR6i6/cfBcATqCNg86z64q3C4xSCO69iQYEFHJLZd73hU3GZkpyBRI4iA t8O9QMscsloKF/uoUh2w4NGzvgeUXiKrlUx2nCVk3hKd+n8uQrWu+yrHPmfyAWCTkYpM KIdVZwMOInLW7M27P9/5hbQ2aU9evkeXyK0HEINiH4si7dYOeNG675Peqn3+qO6Yvd/a +37g7rJgrXIQuA38pJKxiUCkaHXnjvXxbTRuVmf48ODejnjDZm9ZubFSsso6FLq4bRkQ yOydSxj5TcyG6Lcp06Nji7XmLVn1HUyNtvx3SyEuxQztbX5njdSOshe+OMrOHIFCbFT9 vkcw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=k5fN3EkFghwlzEiC3xrHYKgc695PJWNEMXB0KcT9YJw=; b=g9WNNZRCehlbc6lXdzMh8aKwHZ4PCj0X2B+C0gdhbpHDnXBNrS3OzNsFGThDGi8XDY 9cS+q49af0Cmtn+0zkPyONOinKNFg8gghVKrL4CnY5tcxMYuN2ndbdHqZ0arNPjDFz+5 YGWXXKVDRdUGAeXFRaFPfT2QAWICAVJkpcf2bmfojpsymJK/qJvZP1pqWyXbyx16XR8k MeGlSzIj0Yng9GsGIy916bzo3pzLylK5dD906aRmZgGImFkoSdJzdDKsMFGgmc7UtJnT 6lpiwDtz7ZbxstrT/Q/KBkX8h/fj3vgo8YorRA1P2wZBT5Q50SxwNBmetaFa13Z2uxTD tv7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=WaIs+3+8; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f1-20020a170902ce8100b001b07c3c31f1si17035514plg.267.2023.06.16.23.29.25; Fri, 16 Jun 2023 23:29:39 -0700 (PDT) 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=@gmail.com header.s=20221208 header.b=WaIs+3+8; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233664AbjFQG1S (ORCPT + 99 others); Sat, 17 Jun 2023 02:27:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58460 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233450AbjFQG1K (ORCPT ); Sat, 17 Jun 2023 02:27:10 -0400 Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A026CE66; Fri, 16 Jun 2023 23:27:09 -0700 (PDT) Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-51a270e4d57so2114760a12.3; Fri, 16 Jun 2023 23:27:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686983228; x=1689575228; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k5fN3EkFghwlzEiC3xrHYKgc695PJWNEMXB0KcT9YJw=; b=WaIs+3+81vr1zsFAegdIECwEy3rUepcmk8CbeKzMxvTBRDxoEXE8tgh4D0UU2bsKSb 9tlajdHoAn7fmMWiENSw02lGwGyBaLfbq3HTfG+lejGruNai6BcvwFBGh19igaNY0rym AS4n3W1BfhP8nDiAldXC+yBw+5CbiXT0oyIRibqkyx1lz/Q3yxPvwNa56y8IVf005pV7 N98GO8vZ3CGw/5l0SUQuBa3XRkGad+qx9SDRuhl7NiF9+MB0WGDUH0BWOTU4D0ljURXt WG7gEawtpT7Ozdj7sv4ORXau/bdWtIWSiE4E4t1dmm1zCAL4Ju0Rlvv/x8SicMTJpMdu tiKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686983228; x=1689575228; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k5fN3EkFghwlzEiC3xrHYKgc695PJWNEMXB0KcT9YJw=; b=jkDUECa3vpxINKhabGCZf0oxm6YR/JEsklBzwa+NB0hxgOCKy22O8KwJiL2KO1XtsX r49X5FZEiEr85+7iQq9Nf3UpVP5CTeCVrIxmlFnjq3M81mUkkxdWRYl3PWNHdJUVD/i6 /zLUAhACVyb8ft6iFgh6D/sTrE2gIXU6IymkNzUy1Nm+IFGcGWTD8Ge0RAMC9t9htP60 o4HIYmGCEluwAokJVUvy0lupS7rub3qyWDhyc80KXAucxZlB9Cvoi06K9EjRKb8qKXWF ILw6cettWQ7FXjvDJhcVPVWGhQbItusbWZ9873ZFK6HYjA025zYbAVOopGCLHHHaFU5Z XSNQ== X-Gm-Message-State: AC+VfDwCfqHV+8IPH5rmotCuj5FsyxdxSbOrMI7Bh9HdXundTksfXCsr QQf5LzkR5Ozg81FoyUoY10boi6FC+HdWXmMY X-Received: by 2002:aa7:c3da:0:b0:518:7902:d244 with SMTP id l26-20020aa7c3da000000b005187902d244mr2728423edr.6.1686983228095; Fri, 16 Jun 2023 23:27:08 -0700 (PDT) Received: from arinc9-PC.. ([149.91.1.15]) by smtp.gmail.com with ESMTPSA id n6-20020a056402514600b0051a313a66e8sm1799638edd.45.2023.06.16.23.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Jun 2023 23:27:07 -0700 (PDT) From: arinc9.unal@gmail.com X-Google-Original-From: arinc.unal@arinc9.com To: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= , Daniel Golle , Landen Chao , DENG Qingfang , Sean Wang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King Cc: Landen Chao , Frank Wunderlich , Bartel Eerdekens , mithat.guner@xeront.com, erkin.bozoglu@xeront.com, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH net v6 3/6] net: dsa: mt7530: fix handling of BPDUs on MT7530 switch Date: Sat, 17 Jun 2023 09:26:46 +0300 Message-Id: <20230617062649.28444-4-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230617062649.28444-1-arinc.unal@arinc9.com> References: <20230617062649.28444-1-arinc.unal@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 From: Arınç ÜNAL BPDUs are link-local frames, therefore they must be trapped to the CPU port. Currently, the MT7530 switch treats BPDUs as regular multicast frames, therefore flooding them to user ports. To fix this, set BPDUs to be trapped to the CPU port. Group this on mt7530_setup() and mt7531_setup_common() into mt753x_trap_frames() and call that. Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch") Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 8c9acf109a4e..5e4f6965cebd 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -985,6 +985,14 @@ static void mt7530_setup_port5(struct dsa_switch *ds, phy_interface_t interface) mutex_unlock(&priv->reg_mutex); } +static void +mt753x_trap_frames(struct mt7530_priv *priv) +{ + /* Trap BPDUs to the CPU port(s) */ + mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK, + MT753X_BPDU_CPU_ONLY); +} + static int mt753x_cpu_port_enable(struct dsa_switch *ds, int port) { @@ -2262,6 +2270,8 @@ mt7530_setup(struct dsa_switch *ds) priv->p6_interface = PHY_INTERFACE_MODE_NA; + mt753x_trap_frames(priv); + /* Enable and reset MIB counters */ mt7530_mib_reset(ds); @@ -2361,9 +2371,7 @@ mt7531_setup_common(struct dsa_switch *ds) struct mt7530_priv *priv = ds->priv; int ret, i; - /* Trap BPDUs to the CPU port(s) */ - mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK, - MT753X_BPDU_CPU_ONLY); + mt753x_trap_frames(priv); /* Enable and reset MIB counters */ mt7530_mib_reset(ds); -- 2.39.2