Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2009639rwd; Thu, 15 Jun 2023 20:14:47 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5aQfA4sQxCKNeAQ/diBSeNJ5b0nmMpyHexBbolaEfDr0WnOjAkG1Xt8K/2YlZAZzxPPTjN X-Received: by 2002:a05:6a20:244a:b0:10e:440:6d36 with SMTP id t10-20020a056a20244a00b0010e04406d36mr1549674pzc.1.1686885286512; Thu, 15 Jun 2023 20:14:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686885286; cv=none; d=google.com; s=arc-20160816; b=t1nJTM58jsOxNor7hLE+nULzp/jmu2KTMCoZdVQAy1ELgF9UBQfdwxvS557qHwFjXU OIg8BpSq1clZVa0nw9R0gEySw8kdWo/D3HdHkDmKezbLDAjiCL0u6bV0SXISMwziLpjZ u0ncKFLUAQJjGB3gFD7u/dPCLiU7t77LqOF6iKc2bX+Wbqs8WUqfSbX+T7Vo4Nus8RjZ XHpQVP/blkjXp25qdsGhl9qpjin1cERVVLshitZF90LI7zAWFuUUcZljzjHGLJEZc9SF jT+BJc/RsIVH/peF0IOVeef5Mq8hav1yGiS8H2soY2J/qmys6i1DaX2penSs0Hykb/6Z RXJA== 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=t/TXTWeJTVoXuAKTeh8f1IhTxUfSJa+l8YgArHUf0S4=; b=P8aibkU6pyixSooubkdxEsazid4XEUQwJTKodFMZs3wxHkBpqbI5EhW9meScgZPEh7 aDlRZOzBw1Ob3WqeOd3RQqZcg+qSPGD3T8qlfEkgMdS2afeenJ74LVN/0lnpV9yvxaaY A7ZjLQu8lJJTVJdxnDIWJ2hj1Wf1z0DGQqqTOgaxF5O0cf4rqgpckMy9HFMyNMMUzblI J61aKU/IU1hgL5Z3CqkHmIGtOCPPHJjHDK5ZWKqjCQymD2kLRCe3qZPhhYoIeaiLGp5a /2v0xiLg331dfKGlTzSXNW22s5OL1RsKZrx3VQxAtNeM89dtgixxFzZRQ76weMhU3/lX +BHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=ThPTTwZn; 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 p37-20020a635b25000000b00550e8b3614asi1981459pgb.901.2023.06.15.20.14.35; Thu, 15 Jun 2023 20:14:46 -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=ThPTTwZn; 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 S241252AbjFPCxu (ORCPT + 99 others); Thu, 15 Jun 2023 22:53:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241167AbjFPCxn (ORCPT ); Thu, 15 Jun 2023 22:53:43 -0400 Received: from mail-wm1-x331.google.com (mail-wm1-x331.google.com [IPv6:2a00:1450:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C99802D54; Thu, 15 Jun 2023 19:53:41 -0700 (PDT) Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-3f8d2bfec9bso1628625e9.0; Thu, 15 Jun 2023 19:53:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686884020; x=1689476020; 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=t/TXTWeJTVoXuAKTeh8f1IhTxUfSJa+l8YgArHUf0S4=; b=ThPTTwZndntg5GQFV1BoU+8HZFGwk9ozDDKBt84BM3Zf9xiXy0jyMkhwsyRQpz0DhE tpiD4K+P93HcI9o/lqPEtJvg5dLWSXSvon3k2Gv9Fa0LKG2MzO7vTiAyJ4O++Mfz2fQK i+wnGIVtewWpUOoI/5W6ukcsc19fvEX9lsnUx249uxV8rFTGKoY7ApxORhwgwUvvxVfg CPkov//tFDmBmGjXs/hw3h3akvFI/dqxHTDNZArBQtw32DWJxwiq2nyqjTwSNoj7KV+G R71ON85rCzlKLz7zp+pyD/Hi8D2FUNiH8ajKGOkQA6g5MeEcWqPGp8qpKWYC/LgoL/d/ QIWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686884020; x=1689476020; 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=t/TXTWeJTVoXuAKTeh8f1IhTxUfSJa+l8YgArHUf0S4=; b=I0y0toAV2CmEKerLUGXA2ALYzn6Bex8HyuCl0dIWNQff5HPvZigJpZ9QItKdwzhsHT sGniJkU55+wkvHdn59Bs9jQUbBF+wjLvGBym6kUebBMvBDaEemmy2E41APbTUZVNSgcR 3CIlxX4twwP0EcnoMeR1idJqI+S2NjolzsO8nUM3U9eH4jVdRIllGxjKspjxZzrzWsab xVZ0n6g14Dj8lE9E+eMe/WLAup+knl9LNllrZQahxocFV5YE5QtjGdE96Yshn70iHMYr 74kQJxT8HJTvwIKP4ogyP4j3scBAqUEZHQVjye+HUFWmzysQAihye2Tp95VYPrgVd+47 TRpw== X-Gm-Message-State: AC+VfDx04KnnPlZXvfY9dVwmQhlC3XI/T0TbvykcrucOZFI+Oe7K7jSZ RUQeHK3GLhDJSLoF9psJQh4= X-Received: by 2002:a05:600c:214d:b0:3f7:2a38:34b9 with SMTP id v13-20020a05600c214d00b003f72a3834b9mr591288wml.23.1686884019658; Thu, 15 Jun 2023 19:53:39 -0700 (PDT) Received: from arinc9-Xeront.. (athedsl-404045.home.otenet.gr. [79.131.130.75]) by smtp.gmail.com with ESMTPSA id v15-20020a1cf70f000000b003f8d770e935sm890328wmh.0.2023.06.15.19.53.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jun 2023 19:53:39 -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 v5 4/6] net: dsa: mt7530: fix handling of LLDP frames Date: Fri, 16 Jun 2023 05:53:25 +0300 Message-Id: <20230616025327.12652-5-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230616025327.12652-1-arinc.unal@arinc9.com> References: <20230616025327.12652-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 LLDP frames are link-local frames, therefore they must be trapped to the CPU port. Currently, the MT753X switches treat LLDP frames as regular multicast frames, therefore flooding them to user ports. To fix this, set LLDP frames to be trapped to the CPU port(s). Fixes: b8f126a8d543 ("net-next: dsa: add dsa support for Mediatek MT7530 switch") Signed-off-by: Arınç ÜNAL --- drivers/net/dsa/mt7530.c | 8 ++++++++ drivers/net/dsa/mt7530.h | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 7b72cf3a0e30..c85876fd9107 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2266,6 +2266,10 @@ mt7530_setup(struct dsa_switch *ds) mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK, MT753X_BPDU_CPU_ONLY); + /* Trap LLDP frames with :0E MAC DA to the CPU port */ + mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_PORT_FW_MASK, + MT753X_R0E_PORT_FW(MT753X_BPDU_CPU_ONLY)); + /* Enable and reset MIB counters */ mt7530_mib_reset(ds); @@ -2369,6 +2373,10 @@ mt7531_setup_common(struct dsa_switch *ds) mt7530_rmw(priv, MT753X_BPC, MT753X_BPDU_PORT_FW_MASK, MT753X_BPDU_CPU_ONLY); + /* Trap LLDP frames with :0E MAC DA to the CPU port(s) */ + mt7530_rmw(priv, MT753X_RGAC2, MT753X_R0E_PORT_FW_MASK, + MT753X_R0E_PORT_FW(MT753X_BPDU_CPU_ONLY)); + /* Enable and reset MIB counters */ mt7530_mib_reset(ds); diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index e590cf43f3ae..08045b035e6a 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -67,6 +67,11 @@ enum mt753x_id { #define MT753X_BPC 0x24 #define MT753X_BPDU_PORT_FW_MASK GENMASK(2, 0) +/* Register for :03 and :0E MAC DA frame control */ +#define MT753X_RGAC2 0x2c +#define MT753X_R0E_PORT_FW_MASK GENMASK(18, 16) +#define MT753X_R0E_PORT_FW(x) FIELD_PREP(MT753X_R0E_PORT_FW_MASK, x) + enum mt753x_bpdu_port_fw { MT753X_BPDU_FOLLOW_MFC, MT753X_BPDU_CPU_EXCLUDE = 4, -- 2.39.2