From patchwork Sat Jul 31 19:10:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qingfang Deng X-Patchwork-Id: 12412629 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41DB7C4338F for ; Sat, 31 Jul 2021 19:13:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0A81561050 for ; Sat, 31 Jul 2021 19:13:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0A81561050 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bvBw66wx8s1aStpb2S+l+eGonHJFAGTFlIhAVhipFDo=; b=ovw2B0ePC8lHeM ciNJjXmH8PWHJw5u1e67zC28kY2SObgPFUHWHGqybTw5zBo7I6+jFSAvHZBwm/SYEqOyfdm/n2i45 KT5tYu+25CToxTNju0GFk1EbH6OsM/bvOvATggcPZRQ48r9hIkd11FCxDvrTWm8hm4BhWBnOOd4Is EFecl2z1/NRmh3uqIsf+afxqfIQe/DzpGC5bCCTTnL4HZzNpK/g6xC5B4ZXRtWFxuoAXtMiNmZEgT lO4GnqXIvivA05ZL1lGpGs4ZDMkzFE+v6ZqDG8kwSNdtZW+NCKOGnF3fKd8xl9k8njcP3eCi8redR tYN+Bb2Id5ATwY7B1qJQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9uNn-00C8kf-US; Sat, 31 Jul 2021 19:10:52 +0000 Received: from mail-il1-x12c.google.com ([2607:f8b0:4864:20::12c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9uNd-00C8jf-8e; Sat, 31 Jul 2021 19:10:42 +0000 Received: by mail-il1-x12c.google.com with SMTP id q18so12781695ile.9; Sat, 31 Jul 2021 12:10:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=pf4e5z5kl4gOi9zuOWFB+34JLJ0QdGJxH+6mOqzI7vc=; b=PcNVaAbr7KAwYQe5hrR9XTZqJAi2liNH9G8jC06hqnvgGaGL43hxSDwkdsA++PfYFs OxLymYJgp12fVQSJF9i2aJVU9f4Emb+2Ypt9KWbvfmLwniEXYAprV6NxDmO6XhAzvuiy AC0nvZZq3WY+NJuGp3sPZUkgqItUOMeaTkKwAg6yf8fndduHSAct0h9qeoWAsvgm/Mys /xKyafcY7okuKHxq0fkerC73AdAGOc7aYOGz1ZoDRBUGveb02q+bcskvmtRWYsybHg3b JWZ3TlfZPgGHogWbatylwXgyBdiDbRhWyrxP6rGsQJeFTKGaqYDIPQHu+mhXmAyF/FXl Hj8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pf4e5z5kl4gOi9zuOWFB+34JLJ0QdGJxH+6mOqzI7vc=; b=ocTvtcltEnYNIrArgGb5et5TUPHG+S5BEKVmosL54bBmPtdwab/MZjt6kYafDuMIjn 9fHUBamT3eKN9kE1Ayv/N3HlQKGaPAhD2WON5WyRI6ufVbUsGH/JO66faYofMbO1PIUu Wq/FfR0f5XluOaOWLJCqjoVZASRQ5ABSG0NDmWRS5khR2TDG0kt17HEDQSX2YrDYlS/4 Qs9uJatjZCIiOLdW9/ceWqI8RZaPGXsBfRsANg3HSJQeOhzsNcAKK6I7TNWMiIAfYVUL C6M9f5Als3p6HXj0ea1BEB+OzXpcE0D7gro4SS1SPumEgv0xFaf6W0Mq0TFKIBD01SGZ 677A== X-Gm-Message-State: AOAM532dzmDE0ZQfB9ZjtPzhkQ20Su9ragcvmDRVyL2twwMQfdX49J1Z wIihTKiFzEESo7K15F9sLU8= X-Google-Smtp-Source: ABdhPJxRzTveHTn181cO1yF+Rq5/FwFKIgU//FZUL2XfeKtbjr65COP8BnBc5y0Atptr1FbGNrrjDg== X-Received: by 2002:a92:ab0a:: with SMTP id v10mr223601ilh.17.1627758640338; Sat, 31 Jul 2021 12:10:40 -0700 (PDT) Received: from haswell-ubuntu20.lan ([138.197.212.246]) by smtp.gmail.com with ESMTPSA id g1sm2837991ilq.13.2021.07.31.12.10.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jul 2021 12:10:39 -0700 (PDT) From: DENG Qingfang To: Sean Wang , Landen Chao , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Eric Woudstra , =?utf-8?q?Ren=C3=A9_van_Dorst?= , Frank Wunderlich Subject: [RFC net-next v2 1/4] net: dsa: mt7530: enable assisted learning on CPU port Date: Sun, 1 Aug 2021 03:10:19 +0800 Message-Id: <20210731191023.1329446-2-dqfext@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210731191023.1329446-1-dqfext@gmail.com> References: <20210731191023.1329446-1-dqfext@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210731_121041_357262_D02F0AA9 X-CRM114-Status: GOOD ( 14.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Consider the following bridge configuration, where bond0 is not offloaded: +-- br0 --+ / / | \ / / | \ / | | bond0 / | | / \ swp0 swp1 swp2 swp3 swp4 . . . . . . A B C Address learning is enabled on offloaded ports (swp0~2) and the CPU port, so when client A sends a packet to C, the following will happen: 1. The switch learns that client A can be reached at swp0. 2. The switch probably already knows that client C can be reached at the CPU port, so it forwards the packet to the CPU. 3. The bridge core knows client C can be reached at bond0, so it forwards the packet back to the switch. 4. The switch learns that client A can be reached at the CPU port. 5. The switch forwards the packet to either swp3 or swp4, according to the packet's tag. That makes client A's MAC address flap between swp0 and the CPU port. If client B sends a packet to A, it is possible that the packet is forwarded to the CPU. With offload_fwd_mark = 1, the bridge core won't forward it back to the switch, resulting in packet loss. As we have the assisted_learning_on_cpu_port in DSA core now, enable that and disable hardware learning on the CPU port. Signed-off-by: DENG Qingfang Reviewed-by: Vladimir Oltean --- drivers/net/dsa/mt7530.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 69f21b71614c..7e7e0a35e351 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -2054,6 +2054,7 @@ mt7530_setup(struct dsa_switch *ds) * as two netdev instances. */ dn = dsa_to_port(ds, MT7530_CPU_PORT)->master->dev.of_node->parent; + ds->assisted_learning_on_cpu_port = true; ds->mtu_enforcement_ingress = true; if (priv->id == ID_MT7530) { @@ -2124,15 +2125,15 @@ mt7530_setup(struct dsa_switch *ds) mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, PCR_MATRIX_CLR); + /* Disable learning by default on all ports */ + mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); + if (dsa_is_cpu_port(ds, i)) { ret = mt753x_cpu_port_enable(ds, i); if (ret) return ret; } else { mt7530_port_disable(ds, i); - - /* Disable learning by default on all user ports */ - mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); } /* Enable consistent egress tag */ mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, @@ -2289,6 +2290,9 @@ mt7531_setup(struct dsa_switch *ds) mt7530_rmw(priv, MT7530_PCR_P(i), PCR_MATRIX_MASK, PCR_MATRIX_CLR); + /* Disable learning by default on all ports */ + mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); + mt7530_set(priv, MT7531_DBG_CNT(i), MT7531_DIS_CLR); if (dsa_is_cpu_port(ds, i)) { @@ -2297,9 +2301,6 @@ mt7531_setup(struct dsa_switch *ds) return ret; } else { mt7530_port_disable(ds, i); - - /* Disable learning by default on all user ports */ - mt7530_set(priv, MT7530_PSC_P(i), SA_DIS); } /* Enable consistent egress tag */ @@ -2307,6 +2308,7 @@ mt7531_setup(struct dsa_switch *ds) PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); } + ds->assisted_learning_on_cpu_port = true; ds->mtu_enforcement_ingress = true; /* Flush the FDB table */ From patchwork Sat Jul 31 19:10:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qingfang Deng X-Patchwork-Id: 12412631 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AA5EEC4338F for ; Sat, 31 Jul 2021 19:13:09 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7014661042 for ; Sat, 31 Jul 2021 19:13:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7014661042 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=r+tMq19NgA3EbuLXrzDiVq3CXShlW+nPKjf48w3neUA=; b=j+AUtRvZIQJ8mj OW3QgcSyUYdtfkdOYGp1sM6UgSe8gu8vpwbkCiuhFwmLtjaQBRrJ2zLHz4FaGo5K2o424bRXOT29v UltcoVXZ4VxJoT29BQnCEeCPUgp8ZSLAdSzKuZJkClGk1tNsLYUvHaxbUcd+dvukMEbK9HZwExEA3 MTd2KXuU6wb5StT+SlQ1kBIrENK51Zeeorw7XI7kBC7/cY5GLGJod66H/1EK5P9F2tRPWFFsmlnJu TAzJ9oV/0zV36UAve6wNdUTdF+s+DlI3zMfbomQ35domqmCB3zKuu1ubtrLCT4AyFl4v+h+ShvzGl pEFvyGXHvL7zdRiOjV0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9uO0-00C8o3-9n; Sat, 31 Jul 2021 19:11:04 +0000 Received: from mail-io1-xd2c.google.com ([2607:f8b0:4864:20::d2c]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9uNk-00C8k7-D9; Sat, 31 Jul 2021 19:10:50 +0000 Received: by mail-io1-xd2c.google.com with SMTP id z7so14725142iog.13; Sat, 31 Jul 2021 12:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ui1ghQZU9vqYbDL9oxFMpsfCj76DKh6DmMSk3j4c9go=; b=IzK5BMUxlcOPzwpiXj6Vcp2PzUWremyKAw3fcP8wcsO3wf556DbEXTt0z47XaoObxq tfevze+8/7KTYt/KX4Bn9Nya9QlF8q3eFC6iJZbXyWCrgS3et79EiwKpnhuA1EHDSJtO A4vaZ/SEAEX96mMUGbXNLgjU9WztFw+RNGHkdi8Dlz1gUU3+2bYAH0eLaoC5t6Hnn6Kz bg1Szb5zPYW5ycrPJYPUDANFypACc0RSmZaZcRpPWA5ZfNjrSJtn83qAr3TQNjXBRJNZ uitpXGv2f2UiWyBZiMSibcprUjzPxXRY+W6HO2ViPQErHmFcMkADemaIf2GzRAMUhqiF FAow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ui1ghQZU9vqYbDL9oxFMpsfCj76DKh6DmMSk3j4c9go=; b=Fe3//6aDS6LTW1X3Z+bspBRPo+0u2MVy1GcjvmFeSRO8bxsQg58BGFWxpEKhOy4PRL HQLnyPCCAXtK0bYvnoNG/RquBLWEgzTaA5AL+XhyIusNbkTFi0HV8gi1dZFpA7y5ENSp LnLMbOQQJUfpDHSRSgmZ39+2N0+tGxa6vkxiy9xyyyZruae/3JeCCKN/OMRQsgq0k+dO TCkJwfxL5co24h6+FlQVXMR6xAmLLsf4YovNqTR9Kx8vWyGfUrgfIM/3JnaAXc9UJy3m g8L2lM+xadwvYUqX3EshYOE5eYLAR9v27Ohvu4RgQSWu5ve+EGVwcL5CFfYsqSEYrlHW jFAA== X-Gm-Message-State: AOAM5333aA3dyyW8sUYUONww3/a7Cs05H0Z8YBfCPiFuI2oYQDUEBAet iohtUdu00UFLYTME7TShr3Q= X-Google-Smtp-Source: ABdhPJwjTvi0wFNqAypM9MQoRJ/pxsI9mf735iL6TchCbUIlzhj3iYmeL03B0+/EkPZK/qxDnX6sXQ== X-Received: by 2002:a05:6602:59d:: with SMTP id v29mr3474332iox.132.1627758647553; Sat, 31 Jul 2021 12:10:47 -0700 (PDT) Received: from haswell-ubuntu20.lan ([138.197.212.246]) by smtp.gmail.com with ESMTPSA id g1sm2837991ilq.13.2021.07.31.12.10.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jul 2021 12:10:47 -0700 (PDT) From: DENG Qingfang To: Sean Wang , Landen Chao , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Eric Woudstra , =?utf-8?q?Ren=C3=A9_van_Dorst?= , Frank Wunderlich Subject: [RFC net-next v2 2/4] net: dsa: mt7530: use independent VLAN learning on VLAN-unaware bridges Date: Sun, 1 Aug 2021 03:10:20 +0800 Message-Id: <20210731191023.1329446-3-dqfext@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210731191023.1329446-1-dqfext@gmail.com> References: <20210731191023.1329446-1-dqfext@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210731_121048_505216_B7942CB9 X-CRM114-Status: GOOD ( 30.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Consider the following bridge configuration, where bond0 is not offloaded: +-- br0 --+ / / | \ / / | \ / | | bond0 / | | / \ swp0 swp1 swp2 swp3 swp4 . . . . . . A B C Ideally, when the switch receives a packet from swp3 or swp4, it should forward the packet to the CPU, according to the port matrix and unknown unicast flood settings. But packet loss will happen if the destination address is at one of the offloaded ports (swp0~2). For example, when client C sends a packet to A, the FDB lookup will indicate that it should be forwarded to swp0, but the port matrix of swp3 and swp4 is configured to only allow the CPU to be its destination, so it is dropped. However, this issue does not happen if the bridge is VLAN-aware. That is because VLAN-aware bridges use independent VLAN learning, i.e. use VID for FDB lookup, on offloaded ports. As swp3 and swp4 are not offloaded, shared VLAN learning with default filter ID of 0 is used instead. So the lookup for A with filter ID 0 never hits and the packet can be forwarded to the CPU. In the current code, only two combinations were used to toggle user ports' VLAN awareness: one is PCR.PORT_VLAN set to port matrix mode with PVC.VLAN_ATTR set to transparent port, the other is PCR.PORT_VLAN set to security mode with PVC.VLAN_ATTR set to user port. It turns out that only PVC.VLAN_ATTR contributes to VLAN awareness, and port matrix mode just skips the VLAN table lookup. The reference manual is somehow misleading when describing PORT_VLAN modes. It states that PORT_MEM (VLAN port member) is used for destination if the VLAN table lookup hits, but actually **PORT_MEM & PORT_MATRIX** (bitwise AND of VLAN port member and port matrix) is used instead, which means we can have two or more separate VLAN-aware bridges with the same PVID and traffic won't leak between them. Therefore, to solve this, enable independent VLAN learning with PVID 0 on VLAN-unaware bridges, by setting their PCR.PORT_VLAN to fallback mode, while leaving standalone ports in port matrix mode. The CPU port is always set to fallback mode to serve those bridges. During testing, it is found that FDB lookup with filter ID of 0 will also hit entries with VID 0 even with independent VLAN learning. To avoid that, install all VLANs with filter ID of 1. Signed-off-by: DENG Qingfang Reviewed-by: Vladimir Oltean --- drivers/net/dsa/mt7530.c | 70 ++++++++++++++++++++++++++++------------ drivers/net/dsa/mt7530.h | 4 ++- 2 files changed, 53 insertions(+), 21 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 7e7e0a35e351..3876e265f844 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -1021,6 +1021,10 @@ mt753x_cpu_port_enable(struct dsa_switch *ds, int port) mt7530_write(priv, MT7530_PCR_P(port), PCR_MATRIX(dsa_user_ports(priv->ds))); + /* Set to fallback mode for independent VLAN learning */ + mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, + MT7530_PORT_FALLBACK_MODE); + return 0; } @@ -1229,6 +1233,10 @@ mt7530_port_bridge_join(struct dsa_switch *ds, int port, PCR_MATRIX_MASK, PCR_MATRIX(port_bitmap)); priv->ports[port].pm |= PCR_MATRIX(port_bitmap); + /* Set to fallback mode for independent VLAN learning */ + mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, + MT7530_PORT_FALLBACK_MODE); + mutex_unlock(&priv->reg_mutex); return 0; @@ -1241,16 +1249,21 @@ mt7530_port_set_vlan_unaware(struct dsa_switch *ds, int port) bool all_user_ports_removed = true; int i; - /* When a port is removed from the bridge, the port would be set up - * back to the default as is at initial boot which is a VLAN-unaware - * port. + /* This is called after .port_bridge_leave when leaving a VLAN-aware + * bridge. Don't set standalone ports to fallback mode. */ - mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, - MT7530_PORT_MATRIX_MODE); + if (dsa_to_port(ds, port)->bridge_dev) + mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, + MT7530_PORT_FALLBACK_MODE); + mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK | PVC_EG_TAG_MASK, VLAN_ATTR(MT7530_VLAN_TRANSPARENT) | PVC_EG_TAG(MT7530_VLAN_EG_CONSISTENT)); + /* Set PVID to 0 */ + mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK, + G0_PORT_VID_DEF); + for (i = 0; i < MT7530_NUM_PORTS; i++) { if (dsa_is_user_port(ds, i) && dsa_port_is_vlan_filtering(dsa_to_port(ds, i))) { @@ -1276,15 +1289,14 @@ mt7530_port_set_vlan_aware(struct dsa_switch *ds, int port) struct mt7530_priv *priv = ds->priv; /* Trapped into security mode allows packet forwarding through VLAN - * table lookup. CPU port is set to fallback mode to let untagged - * frames pass through. + * table lookup. */ - if (dsa_is_cpu_port(ds, port)) - mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, - MT7530_PORT_FALLBACK_MODE); - else + if (dsa_is_user_port(ds, port)) { mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, MT7530_PORT_SECURITY_MODE); + mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK, + G0_PORT_VID(priv->ports[port].pvid)); + } /* Set the port as a user port which is to be able to recognize VID * from incoming packets before fetching entry within the VLAN table. @@ -1329,6 +1341,13 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port, PCR_MATRIX(BIT(MT7530_CPU_PORT))); priv->ports[port].pm = PCR_MATRIX(BIT(MT7530_CPU_PORT)); + /* When a port is removed from the bridge, the port would be set up + * back to the default as is at initial boot which is a VLAN-unaware + * port. + */ + mt7530_rmw(priv, MT7530_PCR_P(port), PCR_PORT_VLAN_MASK, + MT7530_PORT_MATRIX_MODE); + mutex_unlock(&priv->reg_mutex); } @@ -1511,7 +1530,7 @@ mt7530_hw_vlan_add(struct mt7530_priv *priv, /* Validate the entry with independent learning, create egress tag per * VLAN and joining the port as one of the port members. */ - val = IVL_MAC | VTAG_EN | PORT_MEM(new_members) | VLAN_VALID; + val = IVL_MAC | VTAG_EN | PORT_MEM(new_members) | FID(1) | VLAN_VALID; mt7530_write(priv, MT7530_VAWD1, val); /* Decide whether adding tag or not for those outgoing packets from the @@ -1601,9 +1620,13 @@ mt7530_port_vlan_add(struct dsa_switch *ds, int port, mt7530_hw_vlan_update(priv, vlan->vid, &new_entry, mt7530_hw_vlan_add); if (pvid) { - mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK, - G0_PORT_VID(vlan->vid)); priv->ports[port].pvid = vlan->vid; + + /* Only configure PVID if VLAN filtering is enabled */ + if (dsa_port_is_vlan_filtering(dsa_to_port(ds, port))) + mt7530_rmw(priv, MT7530_PPBV1_P(port), + G0_PORT_VID_MASK, + G0_PORT_VID(vlan->vid)); } mutex_unlock(&priv->reg_mutex); @@ -1617,11 +1640,9 @@ mt7530_port_vlan_del(struct dsa_switch *ds, int port, { struct mt7530_hw_vlan_entry target_entry; struct mt7530_priv *priv = ds->priv; - u16 pvid; mutex_lock(&priv->reg_mutex); - pvid = priv->ports[port].pvid; mt7530_hw_vlan_entry_init(&target_entry, port, 0); mt7530_hw_vlan_update(priv, vlan->vid, &target_entry, mt7530_hw_vlan_del); @@ -1629,11 +1650,12 @@ mt7530_port_vlan_del(struct dsa_switch *ds, int port, /* PVID is being restored to the default whenever the PVID port * is being removed from the VLAN. */ - if (pvid == vlan->vid) - pvid = G0_PORT_VID_DEF; + if (priv->ports[port].pvid == vlan->vid) { + priv->ports[port].pvid = G0_PORT_VID_DEF; + mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK, + G0_PORT_VID_DEF); + } - mt7530_rmw(priv, MT7530_PPBV1_P(port), G0_PORT_VID_MASK, pvid); - priv->ports[port].pvid = pvid; mutex_unlock(&priv->reg_mutex); @@ -2134,6 +2156,10 @@ mt7530_setup(struct dsa_switch *ds) return ret; } else { mt7530_port_disable(ds, i); + + /* Set default PVID to 0 on all user ports */ + mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, + G0_PORT_VID_DEF); } /* Enable consistent egress tag */ mt7530_rmw(priv, MT7530_PVC_P(i), PVC_EG_TAG_MASK, @@ -2301,6 +2327,10 @@ mt7531_setup(struct dsa_switch *ds) return ret; } else { mt7530_port_disable(ds, i); + + /* Set default PVID to 0 on all user ports */ + mt7530_rmw(priv, MT7530_PPBV1_P(i), G0_PORT_VID_MASK, + G0_PORT_VID_DEF); } /* Enable consistent egress tag */ diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index b19b389ff10a..a308886fdebc 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -148,6 +148,8 @@ enum mt7530_vlan_cmd { #define VTAG_EN BIT(28) /* VLAN Member Control */ #define PORT_MEM(x) (((x) & 0xff) << 16) +/* Filter ID */ +#define FID(x) (((x) & 0x7) << 1) /* VLAN Entry Valid */ #define VLAN_VALID BIT(0) #define PORT_MEM_SHFT 16 @@ -247,7 +249,7 @@ enum mt7530_vlan_port_attr { #define MT7530_PPBV1_P(x) (0x2014 + ((x) * 0x100)) #define G0_PORT_VID(x) (((x) & 0xfff) << 0) #define G0_PORT_VID_MASK G0_PORT_VID(0xfff) -#define G0_PORT_VID_DEF G0_PORT_VID(1) +#define G0_PORT_VID_DEF G0_PORT_VID(0) /* Register for port MAC control register */ #define MT7530_PMCR_P(x) (0x3000 + ((x) * 0x100)) From patchwork Sat Jul 31 19:10:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qingfang Deng X-Patchwork-Id: 12412633 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, UNWANTED_LANGUAGE_BODY,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDC78C4338F for ; Sat, 31 Jul 2021 19:13:16 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BCFA561042 for ; Sat, 31 Jul 2021 19:13:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BCFA561042 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=sb0UfQ8sdXtDyV6q7DHKdjd7SrnnbMZmq+hN2XpkxMo=; b=fki3H4qR7fPjhs yFxM4evclhGCL37u0nbu7mimzU703psFpNCh1B6uZLUbYQWrDo9dDAxXTpJiYyElUBrdwXVsbJLEu FwhHlT10bbr3R0fUmCBxY46NDX11G8ZaEBB6278eaprmTSfJIEEa4uo+rtyZNpzBWmluHXUlUsFFz 3OTsY4ul1MByC8PE/3c3R404Yjw/dcZ6dEgJX8BnomeKdA5T6v2lJoG+vteRMCDKmQbp0ualL19PG s/OTqh+wSu63vcd723FVfo0vjJnRL1NH22POvsE4PljRPuOdFSQvT8APZfYRClWLj1SJgGqu3YxB8 yS5FmFX7Ubt+bIPy3k0Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9uOE-00C8rT-2q; Sat, 31 Jul 2021 19:11:18 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9uNr-00C8mM-8J; Sat, 31 Jul 2021 19:10:56 +0000 Received: by mail-il1-x129.google.com with SMTP id q18so12782048ile.9; Sat, 31 Jul 2021 12:10:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=03PtB7i7Y8jswIK8wIaeVs+8jvWKvPEBQvVpB2jKQz4=; b=eTEpH2UyNVPu3VI2OqY8iY0ZxtYubDRoUitW6AkHIysbpPvLfaj2NCH5bn6v13YCIA G01uA6lEGN7Iva03On+AO4xvzD1dvHpV11S/d0atuRu9MWJzNKRaDsjtBKn3yR37ud10 XrGSYHFu1gRonP2YL4Ofym474bCj6HbcII2q6nK6Plxt8nFAGXY5w54HTWx0h4KEXu38 N3iUvT0zuHlx0jhaVffvMwPajE7DOx4jLOFxHmzkg6DkAW/mjgcMafvG32iWXEsHPoV1 w7wYPs4a0QILaVhMeE10Qf7zg/zWUegb00VqSCmDBnR7xI0lAjRAspEKdBzWpfI16XYm 7mPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=03PtB7i7Y8jswIK8wIaeVs+8jvWKvPEBQvVpB2jKQz4=; b=sMDBZvljTzHLeBbJwIaw0KuLH6nR8hnrdwtAWSk61RYf4v9T6CVHqzbw6Uauk15PWP eLmCI6Jcj++vPnUJxgw4p5zhICStPpzXmBA2y/hyEyZ1EqI3Crl8s82gzrhFX0lYOBzx NassrvlyXHgsdgmt5DvHzgOenUMzmUVqox6Q0HSCE9PcuVWSNBGhuB8rnZoboLUi3H7D YEnGWTe0LJhdtVkh9w23F+o4GZt+AgMr9vxWxXChCCEymBXL3aCxK9puv2BJMG65Ldlp NGO3lXjr6EJ2805C+0t6ehax5OeGwuI26/zNjE9+CSq+0x3Yi0VkPt7IAQgwAJbs00xN zscw== X-Gm-Message-State: AOAM533/onH/EPG7m2GM4btahHuDFpH/u1QAztXU2PegQY1IX5l7JNvU jwxIFz5SbFnxNiPMmH2W79M= X-Google-Smtp-Source: ABdhPJyREUPQ4aqHZeaToHQaro8v+j8fwNRUzkQyLj6Mu6CEAiwp5dP0SpxH2wGmNV91eOd9vez5Mw== X-Received: by 2002:a05:6e02:1c0b:: with SMTP id l11mr2411293ilh.126.1627758654458; Sat, 31 Jul 2021 12:10:54 -0700 (PDT) Received: from haswell-ubuntu20.lan ([138.197.212.246]) by smtp.gmail.com with ESMTPSA id g1sm2837991ilq.13.2021.07.31.12.10.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jul 2021 12:10:54 -0700 (PDT) From: DENG Qingfang To: Sean Wang , Landen Chao , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Eric Woudstra , =?utf-8?q?Ren=C3=A9_van_Dorst?= , Frank Wunderlich Subject: [RFC net-next v2 3/4] net: dsa: mt7530: set STP state also on filter ID 1 Date: Sun, 1 Aug 2021 03:10:21 +0800 Message-Id: <20210731191023.1329446-4-dqfext@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210731191023.1329446-1-dqfext@gmail.com> References: <20210731191023.1329446-1-dqfext@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210731_121055_350139_635895AC X-CRM114-Status: GOOD ( 12.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org As filter ID 1 is used, set STP state also on it. Signed-off-by: DENG Qingfang --- drivers/net/dsa/mt7530.c | 3 ++- drivers/net/dsa/mt7530.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 3876e265f844..38d6ce37d692 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -1147,7 +1147,8 @@ mt7530_stp_state_set(struct dsa_switch *ds, int port, u8 state) break; } - mt7530_rmw(priv, MT7530_SSP_P(port), FID_PST_MASK, stp_state); + mt7530_rmw(priv, MT7530_SSP_P(port), FID_PST_MASK, + FID_PST(stp_state)); } static int diff --git a/drivers/net/dsa/mt7530.h b/drivers/net/dsa/mt7530.h index a308886fdebc..294ff1cbd9e0 100644 --- a/drivers/net/dsa/mt7530.h +++ b/drivers/net/dsa/mt7530.h @@ -181,7 +181,7 @@ enum mt7530_vlan_egress_attr { /* Register for port STP state control */ #define MT7530_SSP_P(x) (0x2000 + ((x) * 0x100)) -#define FID_PST(x) ((x) & 0x3) +#define FID_PST(x) (((x) & 0x3) * 0x5) #define FID_PST_MASK FID_PST(0x3) enum mt7530_stp_state { From patchwork Sat Jul 31 19:10:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qingfang Deng X-Patchwork-Id: 12412635 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B6589C4338F for ; Sat, 31 Jul 2021 19:13:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 860B361042 for ; Sat, 31 Jul 2021 19:13:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 860B361042 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ubkJ/iPEdfrit3LMaewxc7pp9j/acZndRkaw61zbeo8=; b=TGxYHSELTzi6g5 6tfOB3eqdeZRUWyapsHpvW0XsKClS4oxAIN3BWSif1Sq4r5QEZ4njDc4m2vmE27eey9tE5Fypp8rv T65jZXlG69hUyDUp/nky0OvDUaJO/zqGRPxxZoO8Qvt2SYdN3qXC4DYkVdbAgHiwsotd/3Njls4tf 0luLEgBEY7VE7xsSrQktelt4wLaLFc8n0OjPyZ/z2jnU+8/gvv4SzvkDIS2DP56/vEPDj1/QLsvxd w091q2yjpRCTJ+Mn9nlWJLk8jRmlDorKdi0dV45j/TEk2bqj+rgMw8ZJerjLcFqivLrxlG83pYMk7 a9p71cxuEL4NApSd3p7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9uOS-00C8xg-OF; Sat, 31 Jul 2021 19:11:33 +0000 Received: from mail-io1-xd2a.google.com ([2607:f8b0:4864:20::d2a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1m9uNy-00C8nW-5M; Sat, 31 Jul 2021 19:11:03 +0000 Received: by mail-io1-xd2a.google.com with SMTP id 185so15574796iou.10; Sat, 31 Jul 2021 12:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1M+wifrjKnGWtdnx+ta5aPYGhd+6fvMpaZ2GY9QQ4f0=; b=CIquJTrWLvU/Nw+FkwqducdAzBwvUmqqCzPDAoCJn8AWOfubID25PxVVOnUStKCXLb LC2etc9lRUupCqJ/wSH2EYfcfS0XslUnD5iT8UICOOnvgTOMMP4owYnkkzNSJlCBJ25q 3ijdC9KbyRu2xqCLLHYxROTGNQ9dZBjrPUt/YvfvxhXsajFjjS3+VuJ8T6RDT9zL3+LJ POk2ldL2EyJ4Xdbg0ZsM37rZtrgkDMTWrzoqMNkCcJvp4Fh6LhsPddUKOcJAleps54/l 2UvnCyHhKC0WMj71pbt+DXyaw6h7rzY6Gm5bMELSSBqN4dwJmvpOhPh8AANGdKsn5FAx lxKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1M+wifrjKnGWtdnx+ta5aPYGhd+6fvMpaZ2GY9QQ4f0=; b=a4SFXW+crjWWcCwT8prBW0jypAI062w/ztUnDrUpGhuAv/EsSQuPHhYHNcRxK5fttW lC71uDFBBkY9pWnOhCEIBJ7YAraxiiFk74twmaEsdlqd8G1a9a/acHc8fITTh2PluPeY clGRbOEbmYIU6l730x6LBel2J3aEacjFD/rn9XrVrR8ZfqQ8kymZw4Di+MA1E5Kjy4cE sVNfzFN81MDts2KjSQLSQSU6HxNG3+8wVpBejqAl/Wlsn+GOrrH0gAAmt/084JRNygIc 9EwfsGM0hRY8nTTlDK8PryvLsESY0HcIt++h4BosHFr6qr/Y+250DezTDcf+b6yAWikC gBuw== X-Gm-Message-State: AOAM532MUZLSILHVmxyzgegyy2HIiwVcnbxsvAKEWMkyuTCBZcX/QYj/ RTxQ4b7W5jb7peZXCnm+KPk= X-Google-Smtp-Source: ABdhPJzlnoVF/Ae1KwED8ArpzoVj+uD7GdpzSL8TVE1Sg92joMvx0qB8jVTPkObUL8m2CMEmEFtmxg== X-Received: by 2002:a5d:89d6:: with SMTP id a22mr4548712iot.178.1627758661364; Sat, 31 Jul 2021 12:11:01 -0700 (PDT) Received: from haswell-ubuntu20.lan ([138.197.212.246]) by smtp.gmail.com with ESMTPSA id g1sm2837991ilq.13.2021.07.31.12.10.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Jul 2021 12:11:00 -0700 (PDT) From: DENG Qingfang To: Sean Wang , Landen Chao , Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Jakub Kicinski , Matthias Brugger , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Eric Woudstra , =?utf-8?q?Ren=C3=A9_van_Dorst?= , Frank Wunderlich Subject: [RFC net-next v2 4/4] Revert "mt7530 mt7530_fdb_write only set ivl bit vid larger than 1" Date: Sun, 1 Aug 2021 03:10:22 +0800 Message-Id: <20210731191023.1329446-5-dqfext@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210731191023.1329446-1-dqfext@gmail.com> References: <20210731191023.1329446-1-dqfext@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210731_121102_272091_F2714F2C X-CRM114-Status: GOOD ( 10.66 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This reverts commit 7e777021780e9c373fc0c04d40b8407ce8c3b5d5. As independent VLAN learning is also used on VID 0 and 1, remove the special case. Signed-off-by: DENG Qingfang --- drivers/net/dsa/mt7530.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c index 38d6ce37d692..d72e04011cc5 100644 --- a/drivers/net/dsa/mt7530.c +++ b/drivers/net/dsa/mt7530.c @@ -366,8 +366,7 @@ mt7530_fdb_write(struct mt7530_priv *priv, u16 vid, int i; reg[1] |= vid & CVID_MASK; - if (vid > 1) - reg[1] |= ATA2_IVL; + reg[1] |= ATA2_IVL; reg[2] |= (aging & AGE_TIMER_MASK) << AGE_TIMER; reg[2] |= (port_mask & PORT_MAP_MASK) << PORT_MAP; /* STATIC_ENT indicate that entry is static wouldn't