From patchwork Mon Sep 13 14:42:53 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12489737 X-Patchwork-Delegate: kuba@kernel.org 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 5C16DC433F5 for ; Mon, 13 Sep 2021 15:34:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3B2366103B for ; Mon, 13 Sep 2021 15:34:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231749AbhIMPff (ORCPT ); Mon, 13 Sep 2021 11:35:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230080AbhIMPfZ (ORCPT ); Mon, 13 Sep 2021 11:35:25 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24984C12C745 for ; Mon, 13 Sep 2021 07:45:34 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id s3so17751419ljp.11 for ; Mon, 13 Sep 2021 07:45:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Segi0yvuz1/GUUIwrgvIqZ9jyUD+kdlugOeE72ywQP4=; b=ZPqE+VesFGU6Kly9pwUykJzXtz7ZqXStgDc/yREvjXjs98yrdH5KPrkzZqaVbs1BP6 dQgBPFO3zQ+u3jS8pn2AeK+r8dOcXhf/Ag0m3/4cmf02LPiEyxu6RREufd4qONmbMSjH d8qAiCpzH4X/mxUA3yN9SySgs0boVMh+0VGX2scocDT3s/0g+C8P9I2ZdHSIchQVtTUB Wnpn9zOpJGOUR4JbH6cKpjULif7B0LYPggL9KVjRld1hhi/MVQy1BrLbULeJEuwd7mvD Vsebtd5oz6mbtpcQPondaKWbcXYM4YRoO7/7dhxJ5Guol2CNKmnY7UWNUxEhZ1igLUpy 54yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Segi0yvuz1/GUUIwrgvIqZ9jyUD+kdlugOeE72ywQP4=; b=apfYAEWmpn9kOfuy/x//WS189VXY5RUN3u/nGAHpKheW3SsjYm6fgXlqmJTCO0oqSx g04Na1wHm3zbn3bP86yPulhG/LSCcsacckmoe970ughsPoXucvokJY8EGeu0SyUUO/w7 g25ksdhjJU4Q9/x849gVsx+itdNiW9OXB+/o5c4+KctNdzIX88I3ln19R0kuU0QjnJm1 DDCdyqOjj1SfVhVtev5S4a48JkUYh/EgoUgVZne5vIla3Rh6IohsUK8kMTcwIckcAUxr y9KoFJUGLovV0SKpGlgAZgJLpw3sfRgMbRc8CoU7p5l3qcKZFC/S9elTR3cuY6mwDcOa EE3w== X-Gm-Message-State: AOAM532l1qzYDW+TRa/wKPwSm2kYGK7bk1V4hbBo8hfUkR1rUnmMxFu/ Jc/6XIt1RNYhoZ+gNfmPuD1lgg== X-Google-Smtp-Source: ABdhPJysNisMQ3W8I8r74uypActZ9QB/HaIf2KutkzaewyQsm3k7XErd+Iaf/SrFF4naI+hf+IFC5w== X-Received: by 2002:a2e:7d13:: with SMTP id y19mr10818111ljc.344.1631544332462; Mon, 13 Sep 2021 07:45:32 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id i12sm849825lfb.301.2021.09.13.07.45.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 07:45:31 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, DENG Qingfang , Mauri Sandberg , =?utf-8?q?Alvin_=C5=A0ipraga?= , Linus Walleij Subject: [PATCH net-next 1/8] net: dsa: rtl8366rb: Support bridge offloading Date: Mon, 13 Sep 2021 16:42:53 +0200 Message-Id: <20210913144300.1265143-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913144300.1265143-1-linus.walleij@linaro.org> References: <20210913144300.1265143-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: DENG Qingfang Use port isolation registers to configure bridge offloading. Tested on the D-Link DIR-685, switching between ports and sniffing ports to make sure no packets leak. Cc: Vladimir Oltean Cc: Mauri Sandberg Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Signed-off-by: DENG Qingfang Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - Fix a bug where I managed to mask off the CPU port from the ports we could access leading to numb bridge. - Reword some comments. ChangeLog v2->v3: - Parens around the (pmask) in the port isolation macro. - Do not exit join/leave functions on regmap failures, print an error and continue. - Clarify comments around the port in join/leave functions. ChangeLog v1->v2: - introduce RTL8366RB_PORT_ISO_PORTS() to shift the port mask into place so we are not confused by the enable bit. - Use this with dsa_user_ports() to isolate the CPU port from itself. --- drivers/net/dsa/rtl8366rb.c | 86 +++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index a89093bc6c6a..b930050cfd1b 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -300,6 +300,13 @@ #define RTL8366RB_INTERRUPT_STATUS_REG 0x0442 #define RTL8366RB_NUM_INTERRUPT 14 /* 0..13 */ +/* Port isolation registers */ +#define RTL8366RB_PORT_ISO_BASE 0x0F08 +#define RTL8366RB_PORT_ISO(pnum) (RTL8366RB_PORT_ISO_BASE + (pnum)) +#define RTL8366RB_PORT_ISO_EN BIT(0) +#define RTL8366RB_PORT_ISO_PORTS_MASK GENMASK(7, 1) +#define RTL8366RB_PORT_ISO_PORTS(pmask) ((pmask) << 1) + /* bits 0..5 enable force when cleared */ #define RTL8366RB_MAC_FORCE_CTRL_REG 0x0F11 @@ -835,6 +842,21 @@ static int rtl8366rb_setup(struct dsa_switch *ds) if (ret) return ret; + /* Isolate all user ports so they can only send packets to itself and the CPU port */ + for (i = 0; i < RTL8366RB_PORT_NUM_CPU; i++) { + ret = regmap_write(smi->map, RTL8366RB_PORT_ISO(i), + RTL8366RB_PORT_ISO_PORTS(BIT(RTL8366RB_PORT_NUM_CPU)) | + RTL8366RB_PORT_ISO_EN); + if (ret) + return ret; + } + /* CPU port can send packets to all ports */ + ret = regmap_write(smi->map, RTL8366RB_PORT_ISO(RTL8366RB_PORT_NUM_CPU), + RTL8366RB_PORT_ISO_PORTS(dsa_user_ports(ds)) | + RTL8366RB_PORT_ISO_EN); + if (ret) + return ret; + /* Set up the "green ethernet" feature */ ret = rtl8366rb_jam_table(rtl8366rb_green_jam, ARRAY_SIZE(rtl8366rb_green_jam), smi, false); @@ -1127,6 +1149,68 @@ rtl8366rb_port_disable(struct dsa_switch *ds, int port) rb8366rb_set_port_led(smi, port, false); } +static int +rtl8366rb_port_bridge_join(struct dsa_switch *ds, int port, + struct net_device *bridge) +{ + struct realtek_smi *smi = ds->priv; + unsigned int port_bitmap = 0; + int ret, i; + + /* Loop over all other ports than the current one */ + for (i = 0; i < RTL8366RB_PORT_NUM_CPU; i++) { + /* Current port handled last */ + if (i == port) + continue; + /* Not on this bridge */ + if (dsa_to_port(ds, i)->bridge_dev != bridge) + continue; + /* Join this port to each other port on the bridge */ + ret = regmap_update_bits(smi->map, RTL8366RB_PORT_ISO(i), + RTL8366RB_PORT_ISO_PORTS(BIT(port)), + RTL8366RB_PORT_ISO_PORTS(BIT(port))); + if (ret) + dev_err(smi->dev, "failed to join port %d\n", port); + + port_bitmap |= BIT(i); + } + + /* Set the bits for the ports we can access */ + return regmap_update_bits(smi->map, RTL8366RB_PORT_ISO(port), + RTL8366RB_PORT_ISO_PORTS(port_bitmap), + RTL8366RB_PORT_ISO_PORTS(port_bitmap)); +} + +static void +rtl8366rb_port_bridge_leave(struct dsa_switch *ds, int port, + struct net_device *bridge) +{ + struct realtek_smi *smi = ds->priv; + unsigned int port_bitmap = 0; + int ret, i; + + /* Loop over all other ports than this one */ + for (i = 0; i < RTL8366RB_PORT_NUM_CPU; i++) { + /* Current port handled last */ + if (i == port) + continue; + /* Not on this bridge */ + if (dsa_to_port(ds, i)->bridge_dev != bridge) + continue; + /* Remove this port from any other port on the bridge */ + ret = regmap_update_bits(smi->map, RTL8366RB_PORT_ISO(i), + RTL8366RB_PORT_ISO_PORTS(BIT(port)), 0); + if (ret) + dev_err(smi->dev, "failed to leave port %d\n", port); + + port_bitmap |= BIT(i); + } + + /* Clear the bits for the ports we can not access, leave ourselves */ + regmap_update_bits(smi->map, RTL8366RB_PORT_ISO(port), + RTL8366RB_PORT_ISO_PORTS(port_bitmap), 0); +} + static int rtl8366rb_change_mtu(struct dsa_switch *ds, int port, int new_mtu) { struct realtek_smi *smi = ds->priv; @@ -1510,6 +1594,8 @@ static const struct dsa_switch_ops rtl8366rb_switch_ops = { .get_strings = rtl8366_get_strings, .get_ethtool_stats = rtl8366_get_ethtool_stats, .get_sset_count = rtl8366_get_sset_count, + .port_bridge_join = rtl8366rb_port_bridge_join, + .port_bridge_leave = rtl8366rb_port_bridge_leave, .port_vlan_filtering = rtl8366_vlan_filtering, .port_vlan_add = rtl8366_vlan_add, .port_vlan_del = rtl8366_vlan_del, From patchwork Mon Sep 13 14:42:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12489739 X-Patchwork-Delegate: kuba@kernel.org 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 6C860C433FE for ; Mon, 13 Sep 2021 15:34:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 50D5361051 for ; Mon, 13 Sep 2021 15:34:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240932AbhIMPfh (ORCPT ); Mon, 13 Sep 2021 11:35:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59042 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233162AbhIMPf0 (ORCPT ); Mon, 13 Sep 2021 11:35:26 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6672EC12C74C for ; Mon, 13 Sep 2021 07:45:36 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id s12so17845609ljg.0 for ; Mon, 13 Sep 2021 07:45:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YNvGPe0Dq+6R5la8j1qftPJtr3gJu4sNPynYBEMsuh0=; b=EmYBJUcXWwb3PoCDeCt8UrFdPtMwJ9RW5MD/Kdz37bvUEcrNFPvZ9KFgNvSSDufN9l PCBc9iN09/6aGspKx1kbSlW6EKkUbbL3wlGL7x+A552PWbBTK8iM3CYXckh/8lBWA9GM 8efrVIKiWKNM5HsHi/9U/8OKJ2Uhxw1hBeSL30SuDD2tgaNMBFiBxLcJS9mw8Kd5aCP0 aI+xItrm148Aq8LWcs5R4Y6p2gLNYDIW6Novj7/AP5PpPijpT73t1TK/gJK6ROuHA0Nu YQ8fWTKoXPpLxgwNF1LS2Lf5S0YYn47SnJwFiXT11GQak43hc8TKkAHD4NMlMNDRiuVo VNnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=YNvGPe0Dq+6R5la8j1qftPJtr3gJu4sNPynYBEMsuh0=; b=6G6yCIdPJrAy/OSJQV0EK96rIJo6d8jGI67+Ic2uwW4mX/GAHnFTT7nsCepjm3dPkq wTbooz9gZBaGeTSOGCyzqKSeeskDpstEj1HTnZ/0/mUaw3GimZ+CnoxTI8K4+BihjcPv 9fvU8yLMMWssKC9hVf9dAF0z3GldSHDF77/GfnERgBMorpfA0N0a0RhKsr271BEqRr0z QOBG6yjeIvpOtjYSW3FuoOjLHkJ27u+dYMhVpUIBxLRr2+JilicjoKUIiE/ESBisA4P5 yMC4C0qKDQ7+8SEJKYu+VF7YXT4C0NqTvPhegrivdruhS3Zq3Z8loXfMv0eU+e7i9pAP 8Cvg== X-Gm-Message-State: AOAM5335fcuMJr+PqTwOseg1VRPaWbcwFGD+6DSEhOwORdu95d3YCZ2A GQP+8TWMInq9qQ3udOB8+zAvVw== X-Google-Smtp-Source: ABdhPJwEirZegF9npqyfvP5koDG91VRxvoCxhXz5ux+V6mBb4yMSqPt1XmL9V1By61LJCCximZMHAQ== X-Received: by 2002:a2e:9549:: with SMTP id t9mr10789580ljh.404.1631544334724; Mon, 13 Sep 2021 07:45:34 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id i12sm849825lfb.301.2021.09.13.07.45.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 07:45:34 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , Mauri Sandberg , DENG Qingfang , =?utf-8?q?Alvin_=C5=A0ipraga?= Subject: [PATCH net-next 2/8] net: dsa: rtl8366: Drop custom VLAN set-up Date: Mon, 13 Sep 2021 16:42:54 +0200 Message-Id: <20210913144300.1265143-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913144300.1265143-1-linus.walleij@linaro.org> References: <20210913144300.1265143-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org This hacky default VLAN setup was done in order to direct packets to the right ports and provide port isolation, both which we now support properly using custom tags and proper bridge port isolation. We can drop the custom VLAN code and leave all VLAN handling alone, as users expect things to be. We can also drop ds->configure_vlan_while_not_filtering = false; and let the core deal with any VLANs it wants. Cc: Mauri Sandberg Cc: DENG Qingfang Reviewed-by: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Signed-off-by: Linus Walleij --- ChangeLog v3->v4: - No changes ChangeLog v2->v3: - Collect a bunch of reviewed-by tags ChangeLog v1->v2: - No changes. --- drivers/net/dsa/realtek-smi-core.h | 1 - drivers/net/dsa/rtl8366.c | 48 ------------------------------ drivers/net/dsa/rtl8366rb.c | 4 +-- 3 files changed, 1 insertion(+), 52 deletions(-) diff --git a/drivers/net/dsa/realtek-smi-core.h b/drivers/net/dsa/realtek-smi-core.h index fcf465f7f922..c8fbd7b9fd0b 100644 --- a/drivers/net/dsa/realtek-smi-core.h +++ b/drivers/net/dsa/realtek-smi-core.h @@ -129,7 +129,6 @@ int rtl8366_set_pvid(struct realtek_smi *smi, unsigned int port, int rtl8366_enable_vlan4k(struct realtek_smi *smi, bool enable); int rtl8366_enable_vlan(struct realtek_smi *smi, bool enable); int rtl8366_reset_vlan(struct realtek_smi *smi); -int rtl8366_init_vlan(struct realtek_smi *smi); int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, struct netlink_ext_ack *extack); int rtl8366_vlan_add(struct dsa_switch *ds, int port, diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index 75897a369096..59c5bc4f7b71 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -292,54 +292,6 @@ int rtl8366_reset_vlan(struct realtek_smi *smi) } EXPORT_SYMBOL_GPL(rtl8366_reset_vlan); -int rtl8366_init_vlan(struct realtek_smi *smi) -{ - int port; - int ret; - - ret = rtl8366_reset_vlan(smi); - if (ret) - return ret; - - /* Loop over the available ports, for each port, associate - * it with the VLAN (port+1) - */ - for (port = 0; port < smi->num_ports; port++) { - u32 mask; - - if (port == smi->cpu_port) - /* For the CPU port, make all ports members of this - * VLAN. - */ - mask = GENMASK((int)smi->num_ports - 1, 0); - else - /* For all other ports, enable itself plus the - * CPU port. - */ - mask = BIT(port) | BIT(smi->cpu_port); - - /* For each port, set the port as member of VLAN (port+1) - * and untagged, except for the CPU port: the CPU port (5) is - * member of VLAN 6 and so are ALL the other ports as well. - * Use filter 0 (no filter). - */ - dev_info(smi->dev, "VLAN%d port mask for port %d, %08x\n", - (port + 1), port, mask); - ret = rtl8366_set_vlan(smi, (port + 1), mask, mask, 0); - if (ret) - return ret; - - dev_info(smi->dev, "VLAN%d port %d, PVID set to %d\n", - (port + 1), port, (port + 1)); - ret = rtl8366_set_pvid(smi, port, (port + 1)); - if (ret) - return ret; - } - - return rtl8366_enable_vlan(smi, true); -} -EXPORT_SYMBOL_GPL(rtl8366_init_vlan); - int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, struct netlink_ext_ack *extack) { diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index b930050cfd1b..a5b7d7ff8884 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -985,7 +985,7 @@ static int rtl8366rb_setup(struct dsa_switch *ds) return ret; } - ret = rtl8366_init_vlan(smi); + ret = rtl8366_reset_vlan(smi); if (ret) return ret; @@ -999,8 +999,6 @@ static int rtl8366rb_setup(struct dsa_switch *ds) return -ENODEV; } - ds->configure_vlan_while_not_filtering = false; - return 0; } From patchwork Mon Sep 13 14:42:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12489741 X-Patchwork-Delegate: kuba@kernel.org 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 87269C433F5 for ; Mon, 13 Sep 2021 15:34:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6738060249 for ; Mon, 13 Sep 2021 15:34:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242049AbhIMPfk (ORCPT ); Mon, 13 Sep 2021 11:35:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235053AbhIMPf1 (ORCPT ); Mon, 13 Sep 2021 11:35:27 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8795C12C750 for ; Mon, 13 Sep 2021 07:45:37 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id q21so17790047ljj.6 for ; Mon, 13 Sep 2021 07:45:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SCiUagspf3BSHg075BuKPVGIKuOKVCl19l+q5xDaUhI=; b=Yfmwa744j9NOqudlSNaUEbZ+2fNINnDndc4f/C+7ndyDdf5a7jb6fp1jahmd8S4Krz CwGGsevt5uzsxG4RqfNddlGdGpHFCuOEKfw2avsqpbXeQxN1FQa7qb8OIWRH1Dw4kZZ4 TQPks7zP8uwBliHDOPjM5v1PHt4CuLE8Na4oyPEDRLNS0FvwsZRZg7DNuXJuWHqueP8O snusl5+uhOD0idQajGtfrynpM8v1YAUh8XU8eUjWv80Oou0UoHKTr3J/06IALmB429In Ng8cyDNpti+fc/SXZOb0pJ2vKI7jcWDiN0xoossChuMosdCpJxbGtfAWTY7CXg/+NNhe M9sg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=SCiUagspf3BSHg075BuKPVGIKuOKVCl19l+q5xDaUhI=; b=wbJk9wZOa7mX66ieAEWXmgRgn4dpla/MWQqpwOUutwww9Yxhhx+Po3qwbduHBS96hy YNPDhcNJ5CL2qgbrZe13taCcZlOPHINsBWk9EZAR5BKutEfMi01nQqL88TDaRLIIgrsS BFZL/jDOGkuv3ShzX7Btv1vU/Z6m7ZA/pSCy2SySfz2bUEQhP0Snp5deJcMEnvlLAUpF zTocyw6nJogWfVefPkvlt9SQSvMxZ+5lbioNjGKvZIxgaaU1YWw9zdg3+PqptVYgYQZX VDxXnK2qsZxHZkr2DWyYtGNvQEGdG9CcpscbQHMiOM3o56dRHU2vMWRqLLF2SenXLQ2S Q9jQ== X-Gm-Message-State: AOAM530Xy+YJhfrAwNRgcUZ9e6zKiV7ZF6z34Y//sylI4LrHWxWtT9OM ZFM4Ghr5iEEy5/iMQHQ9cUj2uA== X-Google-Smtp-Source: ABdhPJzZ3RNfL+nFlQusRRJxry50phigQpZ8mFYmeYTXk9gBNQAagrpxzincuL858yiApr0iAYcvKA== X-Received: by 2002:a2e:bc1a:: with SMTP id b26mr11010558ljf.218.1631544336152; Mon, 13 Sep 2021 07:45:36 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id i12sm849825lfb.301.2021.09.13.07.45.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 07:45:35 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , Mauri Sandberg , =?utf-8?q?Alvin_=C5=A0ipraga?= , DENG Qingfang Subject: [PATCH net-next 3/8] net: dsa: rtl8366rb: Rewrite weird VLAN filering enablement Date: Mon, 13 Sep 2021 16:42:55 +0200 Message-Id: <20210913144300.1265143-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913144300.1265143-1-linus.walleij@linaro.org> References: <20210913144300.1265143-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org While we were defining one VLAN per port for isolating the ports the port_vlan_filtering() callback was implemented to enable a VLAN on the port + 1. This function makes no sense, not only is it incomplete as it only enables the VLAN, it doesn't do what the callback is supposed to do, which is to selectively enable and disable filtering on a certain port. Implement the correct callback: we have two registers dealing with filtering on the RTL9366RB, so we implement an ASIC-specific callback, describe these and activate both. Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: Florian Fainelli Cc: DENG Qingfang Signed-off-by: Linus Walleij --- ChangeLog v1->v4: - New patch after discovering that this weirdness of mine is causing problems. --- drivers/net/dsa/realtek-smi-core.h | 2 -- drivers/net/dsa/rtl8366.c | 35 ----------------------------- drivers/net/dsa/rtl8366rb.c | 36 +++++++++++++++++++++++++----- 3 files changed, 30 insertions(+), 43 deletions(-) diff --git a/drivers/net/dsa/realtek-smi-core.h b/drivers/net/dsa/realtek-smi-core.h index c8fbd7b9fd0b..214f710d7dd5 100644 --- a/drivers/net/dsa/realtek-smi-core.h +++ b/drivers/net/dsa/realtek-smi-core.h @@ -129,8 +129,6 @@ int rtl8366_set_pvid(struct realtek_smi *smi, unsigned int port, int rtl8366_enable_vlan4k(struct realtek_smi *smi, bool enable); int rtl8366_enable_vlan(struct realtek_smi *smi, bool enable); int rtl8366_reset_vlan(struct realtek_smi *smi); -int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, - struct netlink_ext_ack *extack); int rtl8366_vlan_add(struct dsa_switch *ds, int port, const struct switchdev_obj_port_vlan *vlan, struct netlink_ext_ack *extack); diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index 59c5bc4f7b71..0672dd56c698 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -292,41 +292,6 @@ int rtl8366_reset_vlan(struct realtek_smi *smi) } EXPORT_SYMBOL_GPL(rtl8366_reset_vlan); -int rtl8366_vlan_filtering(struct dsa_switch *ds, int port, bool vlan_filtering, - struct netlink_ext_ack *extack) -{ - struct realtek_smi *smi = ds->priv; - struct rtl8366_vlan_4k vlan4k; - int ret; - - /* Use VLAN nr port + 1 since VLAN0 is not valid */ - if (!smi->ops->is_vlan_valid(smi, port + 1)) - return -EINVAL; - - dev_info(smi->dev, "%s filtering on port %d\n", - vlan_filtering ? "enable" : "disable", - port); - - /* TODO: - * The hardware support filter ID (FID) 0..7, I have no clue how to - * support this in the driver when the callback only says on/off. - */ - ret = smi->ops->get_vlan_4k(smi, port + 1, &vlan4k); - if (ret) - return ret; - - /* Just set the filter to FID 1 for now then */ - ret = rtl8366_set_vlan(smi, port + 1, - vlan4k.member, - vlan4k.untag, - 1); - if (ret) - return ret; - - return 0; -} -EXPORT_SYMBOL_GPL(rtl8366_vlan_filtering); - int rtl8366_vlan_add(struct dsa_switch *ds, int port, const struct switchdev_obj_port_vlan *vlan, struct netlink_ext_ack *extack) diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index a5b7d7ff8884..6c35e1ed49aa 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -143,6 +143,8 @@ #define RTL8366RB_PHY_NO_OFFSET 9 #define RTL8366RB_PHY_NO_MASK (0x1f << 9) +/* VLAN Ingress Control Register */ +#define RTL8366RB_VLAN_INGRESS_CTRL1_REG 0x037E #define RTL8366RB_VLAN_INGRESS_CTRL2_REG 0x037f /* LED control registers */ @@ -933,11 +935,13 @@ static int rtl8366rb_setup(struct dsa_switch *ds) if (ret) return ret; - /* Discard VLAN tagged packets if the port is not a member of - * the VLAN with which the packets is associated. - */ + /* Accept all packets by default, we enable filtering on-demand */ + ret = regmap_write(smi->map, RTL8366RB_VLAN_INGRESS_CTRL1_REG, + 0); + if (ret) + return ret; ret = regmap_write(smi->map, RTL8366RB_VLAN_INGRESS_CTRL2_REG, - RTL8366RB_PORT_ALL); + 0); if (ret) return ret; @@ -1209,6 +1213,26 @@ rtl8366rb_port_bridge_leave(struct dsa_switch *ds, int port, RTL8366RB_PORT_ISO_PORTS(port_bitmap), 0); } +static int rtl8366rb_vlan_filtering(struct dsa_switch *ds, int port, + bool vlan_filtering, + struct netlink_ext_ack *extack) +{ + struct realtek_smi *smi = ds->priv; + int ret; + + dev_dbg(smi->dev, "port %d: %s VLAN filtering\n", port, + vlan_filtering ? "enable" : "disable"); + + /* Any incoming frames without VID (untagged) will be dropped */ + ret = regmap_update_bits(smi->map, RTL8366RB_VLAN_INGRESS_CTRL1_REG, + BIT(port), vlan_filtering ? BIT(port) : 0); + if (ret) + return ret; + /* If the port is not in the member set, the frame will be dropped */ + return regmap_update_bits(smi->map, RTL8366RB_VLAN_INGRESS_CTRL2_REG, + BIT(port), vlan_filtering ? BIT(port) : 0); +} + static int rtl8366rb_change_mtu(struct dsa_switch *ds, int port, int new_mtu) { struct realtek_smi *smi = ds->priv; @@ -1437,7 +1461,7 @@ static bool rtl8366rb_is_vlan_valid(struct realtek_smi *smi, unsigned int vlan) if (smi->vlan4k_enabled) max = RTL8366RB_NUM_VIDS - 1; - if (vlan == 0 || vlan > max) + if (vlan > max) return false; return true; @@ -1594,7 +1618,7 @@ static const struct dsa_switch_ops rtl8366rb_switch_ops = { .get_sset_count = rtl8366_get_sset_count, .port_bridge_join = rtl8366rb_port_bridge_join, .port_bridge_leave = rtl8366rb_port_bridge_leave, - .port_vlan_filtering = rtl8366_vlan_filtering, + .port_vlan_filtering = rtl8366rb_vlan_filtering, .port_vlan_add = rtl8366_vlan_add, .port_vlan_del = rtl8366_vlan_del, .port_enable = rtl8366rb_port_enable, From patchwork Mon Sep 13 14:42:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12489743 X-Patchwork-Delegate: kuba@kernel.org 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 7A87BC433EF for ; Mon, 13 Sep 2021 15:34:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5917760249 for ; Mon, 13 Sep 2021 15:34:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242298AbhIMPfn (ORCPT ); Mon, 13 Sep 2021 11:35:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237922AbhIMPf2 (ORCPT ); Mon, 13 Sep 2021 11:35:28 -0400 Received: from mail-lf1-x12e.google.com (mail-lf1-x12e.google.com [IPv6:2a00:1450:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E82D6C028BEC for ; Mon, 13 Sep 2021 07:45:40 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id s10so21623203lfr.11 for ; Mon, 13 Sep 2021 07:45:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=rl1GbWjgXVNoK+lm+llrr8EUhw0/WxVcLR5JyBH74Jo=; b=fvBbLhTmvrjsv6008yISDXLZ8bxvuq5Z1YRK4b1wu4yXmtYLvjZ9CGr56IRUKVrmIx mMtElrRHZm3wGcUpt2R4A3VF5h2XPGB1g5B6BmWI5cYnuITAfKcJWFjTcBFmAPFW7f2b CwOKS4ePguXVXeQQ5tynnbWphorBjrAEIjK2puk+y1LaN7adH1pyF+aWQ7jwRaQhddSG zEMt8E7W1CN7ffpdZ58+Oc3RisSTL2UlUsSvcg84m5pBeZn6wAOT/GooLEWC3RgG+l1G /ZwH6ufgsO7DsYGYvrKOfIGF7cuA8qSU7zk2BMCi2uDonxxeYJSp6XvK3/xjw39MMAay aa7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=rl1GbWjgXVNoK+lm+llrr8EUhw0/WxVcLR5JyBH74Jo=; b=kaGKjiRT7n4P0FbAf8NAKYUxbSY7r5q9Oy+fhdhPf9SJZqk7nwF73Li4ZQKyg+Eyf2 qob4pWiNXqFnjRnM3Cxt2r8gXoaPqx4PXAW/Xlc83lpMpRAAr3GymQqpfe6cq8CfW0J2 s7hZG+7prcObAbLuEcxEAyVkk+Uazxyx7R9oCfuV6brugBCCRvsSfFKGcxj3azknW9Y2 8JllMHeUugIWlkBKy0Z8Dw4GSkF7TYk1TL6zNp/Wh+K1QNg/RKmy9zfGbgi57ysgY4C9 4TY8oT9O0FytJ6LO4vf4qaiOstwr0vlxgZs2VjjJLr85hnvlY4wkixXh7UX4HnRaNlsv 7BKA== X-Gm-Message-State: AOAM5321HeIpE8MzslxAPMrP59c6Vt6fNL+1ZDHE/6cl3LlRwK7hXXTx Y/k7sNs/RJ7xcIlmCvYIIBG5LQ== X-Google-Smtp-Source: ABdhPJzLwuGLabZO/8BJ2sTxI0M0rFUN7MJoZOprsVOV89AFGDQBgaAhglv7057Zv8Ar6xzXMQH5xQ== X-Received: by 2002:ac2:599b:: with SMTP id w27mr9224290lfn.0.1631544337834; Mon, 13 Sep 2021 07:45:37 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id i12sm849825lfb.301.2021.09.13.07.45.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 07:45:37 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , Mauri Sandberg , =?utf-8?q?Alvin_=C5=A0ipraga?= , DENG Qingfang Subject: [PATCH net-next 4/8] net: dsa: rtl8366rb: Always treat VLAN 0 as untagged Date: Mon, 13 Sep 2021 16:42:56 +0200 Message-Id: <20210913144300.1265143-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913144300.1265143-1-linus.walleij@linaro.org> References: <20210913144300.1265143-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org VLAN 0 shall always be treated as untagged, as per example from other drivers (I guess from the spec). Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: Florian Fainelli Cc: DENG Qingfang Signed-off-by: Linus Walleij --- ChangeLog v1->v4: - New patch after noting that other drivers always sets VLAN 0 as untagged. --- drivers/net/dsa/rtl8366.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index 0672dd56c698..fae14c448fe4 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -308,6 +308,11 @@ int rtl8366_vlan_add(struct dsa_switch *ds, int port, return -EINVAL; } + /* Note that VLAN 0 shall always be treated as untagged */ + if (vlan->vid == 0) + untagged = true; + + /* Enable VLAN in the hardware * FIXME: what's with this 4k business? * Just rtl8366_enable_vlan() seems inconclusive. From patchwork Mon Sep 13 14:42:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12489745 X-Patchwork-Delegate: kuba@kernel.org 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 31905C433EF for ; Mon, 13 Sep 2021 15:34:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1B76A61051 for ; Mon, 13 Sep 2021 15:34:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230046AbhIMPfo (ORCPT ); Mon, 13 Sep 2021 11:35:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239310AbhIMPf2 (ORCPT ); Mon, 13 Sep 2021 11:35:28 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17D52C12C757 for ; Mon, 13 Sep 2021 07:45:41 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id g1so10172539lfj.12 for ; Mon, 13 Sep 2021 07:45:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xd3umkjYwct/iEHcKdn/6TrUhyPynjPbO3LzmHR3PlQ=; b=FGJxvDqcWqiPbYFwhIrJ0dK0VR2FrCiR+FMhJpzBxx3KpTQ92J+P+Btd9IX3iHDpKN XNd0A3/tcrxnrP6AZ6y0w33syHd1m9xwQFg/nx2tsJwlGc0pB3YPr2TnFiEVNeWpG6ML 6Ub+akRJbSUbNlpwl/U8ALkJvRNGLg8LDO1NTe3fI/Wn5LJXxKTsMph97Nptg8euRCXA Q2LrJ8vh9xuFkjAw7ss4ICmkkCSIiUWzv/1WcFGkZqv7XBRBovLZC1bmHML27nnTElh4 mSS6H51EWXevgXJaV4EQM+np1tMbfkav1yCEqIKwwfWfN6u/f9arviRwo4KiNmajtX0P 55eA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xd3umkjYwct/iEHcKdn/6TrUhyPynjPbO3LzmHR3PlQ=; b=0uaTSwLRX1cEuENM+BAERymul+qKmUHnwahcDS/zFZf+SqNDdV+t4rx7ZlIIvJ7t4C BwDw7w9E2MprRmvVI/JsXxKwafpdMOuXOxtr0S5Fmm85m8zYR/59SQ+VukrCNwufxG0n dG+q/sZ7pvAT/hWB8IiuQqdn1DPjvIXLvPRqRaVy8se36XXzFdWYBCB1Xos8Y7UqRAua DDTvlv442ZBpixiLA0woU/G3aQbKbmoPRdxIhOHVDqyGF9bF0hDk1eUNR/ZgX/vgcuuG 16xpZ3KIsVw1dh1m3ud3/ztfuEv8ziPDgAf2CDVo5RvCOTpqIEUz5tOdYwB/ovD23Lk4 MUHw== X-Gm-Message-State: AOAM533jsXNP3lkeQ8A4959+BlN+IxEeeTirRmIgIUaxBCwd8EESgZbM dYFqt/3kyEP7QrK5F82nrwD1Sg== X-Google-Smtp-Source: ABdhPJzyloPpM9xqBMsZqFJGEmHWoBIrTXOQKiARfnmwclHxNdE4tnzTVHEZylrQJnsctRpEGCcmzw== X-Received: by 2002:a19:c145:: with SMTP id r66mr9687199lff.563.1631544339476; Mon, 13 Sep 2021 07:45:39 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id i12sm849825lfb.301.2021.09.13.07.45.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 07:45:39 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , Mauri Sandberg , =?utf-8?q?Alvin_=C5=A0ipraga?= , DENG Qingfang Subject: [PATCH net-next 5/8] net: dsa: rtl8366: Disable "4K" VLANs Date: Mon, 13 Sep 2021 16:42:57 +0200 Message-Id: <20210913144300.1265143-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913144300.1265143-1-linus.walleij@linaro.org> References: <20210913144300.1265143-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org I have to disable this feature to have working VLANs on the RTL8366RB at least, probably on all of them. It appears that the very custom VLAN set-up was using this feature by setting up one VLAN per port for a reason: when using "4K" VLAN, every frame transmitted by the switch MUST have a VLAN tag. This is the reason that every port had its own VLAN, including the CPU port, and all of them had PVID turned on: this way every frame going in or out of the switch will indeed have a VLAN tag. However the way Linux userspace like to use VLANs such as by default assigning all ports on a bridge to the same VLAN this does not work at all because PVID is not set for these, and all packets get lost. Therefore we have to do with 16 VLAN for now, the "4K" 4096 VLAN feature is clearly only for switches in environments where everything is a VLAN. This was discovered when testing with OpenWrt that join the LAN ports lan0 ... lan3 into a bridge and then assign each of them into VLAN 1 with PVID set on each port: without this patch this will not work and the bridge goes numb. Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: Florian Fainelli Cc: DENG Qingfang Signed-off-by: Linus Walleij --- ChangeLog v1->v4: - New patch after discovering that the VLAN configuration in OpenWrt was not working. --- drivers/net/dsa/rtl8366.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index fae14c448fe4..9652323167c2 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -313,13 +313,15 @@ int rtl8366_vlan_add(struct dsa_switch *ds, int port, untagged = true; - /* Enable VLAN in the hardware - * FIXME: what's with this 4k business? - * Just rtl8366_enable_vlan() seems inconclusive. + /* Enable VLAN in the hardware, do NOT enable VLAN4K, because the + * 4K VLAN will activate a 4096 entries VID table, but has the side + * effect that every processed frame MUST have a VID, meaning non-VLAN + * traffic will now work at all. So we will let the 16 VLAN entries + * suffice. */ - ret = rtl8366_enable_vlan4k(smi, true); + ret = rtl8366_enable_vlan(smi, true); if (ret) { - NL_SET_ERR_MSG_MOD(extack, "Failed to enable VLAN 4K"); + NL_SET_ERR_MSG_MOD(extack, "Failed to enable VLAN"); return ret; } From patchwork Mon Sep 13 14:42:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12489749 X-Patchwork-Delegate: kuba@kernel.org 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 F2A04C433F5 for ; Mon, 13 Sep 2021 15:34:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D5C866103B for ; Mon, 13 Sep 2021 15:34:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231605AbhIMPf4 (ORCPT ); Mon, 13 Sep 2021 11:35:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240718AbhIMPfa (ORCPT ); Mon, 13 Sep 2021 11:35:30 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4BB50C12C75A for ; Mon, 13 Sep 2021 07:45:44 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id a4so21636812lfg.8 for ; Mon, 13 Sep 2021 07:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LYtrDDoObxsNg9Qa7tHy5LD0Y+VUcx6GaTlCkfBdhkQ=; b=YL6zKWNz3wU/ISXiZadwLvMF586w0XIR0RTFi2tr9IPTOGvvOrF2Gt+TWW3RuXQvRR eobC2QEIK+DsCqtLcXgf+a2B28zMC5vOP/E0P4f0kvWkvFNfqyDwssQ/USmSfBik5XAH IU8Cys0uNY/eY11UFlDlDCuVsge/sK5iS/QexhK7jJ9ukkFSUMHs/8LlZZBlyJjoFNkh OxCfb6OZQsNXN4U2wm0OeQUy0D/WZHbWIkH+xp1ghf0Im7dWbQlRODEtQroqsLV2tXzC 0DUqU5LVebvRzg04aJ6+6zrZfSYaptMMqrsUF1sJRUvUnjJXHbjCjzmgydVA7GOtKPuG 5n0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LYtrDDoObxsNg9Qa7tHy5LD0Y+VUcx6GaTlCkfBdhkQ=; b=Xadlf0LmuMpOFmUyjywc1Be6/aJcVk96Sd1nid0D07cCO/zK1X67HsuphLSF1qFGy+ /f2WdGskjfDaDNoVv3EHvZoSOPYKmvS+hc462mdQThCP4oN7cySBuovXUNGlHSzsPc/s s4WVh/mRKw84v5cbPDMfEOPoGQWsaMTFtYV4p2tmv444BqUjLV5Z/bifQnZ/KRmdz80F Wg2/iXPKG3XhOC1QOdyegTmz+a/vSW809PIJUIgP05Wz0ftUd0erJgq4f8vMP7Np/2KP du3qTXRLIsZM9MQZSmZDk5Cr8oSlUHyINKZ8YkWJrwvLESOZHy9EHXfcJjpDILX10yR8 h7Jg== X-Gm-Message-State: AOAM530TnkV0fIPoT0IXDbdKR38X54Eq6mz2HHDD5G5Zoqqk/0Ee3I+J VJkkd0i6B654Pa7T9CW1Vl1kCw== X-Google-Smtp-Source: ABdhPJyd6tFq/gLGkcz8y8IRgMiKQsbahE8zWxtzdUTAj8hbKj53WRBOPJHbk92z+wDCR0F5nBE43Q== X-Received: by 2002:a05:6512:903:: with SMTP id e3mr7707690lft.668.1631544341227; Mon, 13 Sep 2021 07:45:41 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id i12sm849825lfb.301.2021.09.13.07.45.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 07:45:40 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , Mauri Sandberg , =?utf-8?q?Alvin_=C5=A0ipraga?= , DENG Qingfang Subject: [PATCH net-next 6/8] net: dsa: rtl8366rb: Fix off-by-one bug Date: Mon, 13 Sep 2021 16:42:58 +0200 Message-Id: <20210913144300.1265143-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913144300.1265143-1-linus.walleij@linaro.org> References: <20210913144300.1265143-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org The max VLAN number with non-4K VLAN activated is 15, and the range is 0..15. Not 16. Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: Florian Fainelli Cc: DENG Qingfang Signed-off-by: Linus Walleij --- ChangeLog v1->v4: - New patch for a bug discovered when fixing the other issues. --- drivers/net/dsa/rtl8366rb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index 6c35e1ed49aa..dfc8ef470972 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -1456,7 +1456,7 @@ static int rtl8366rb_set_mc_index(struct realtek_smi *smi, int port, int index) static bool rtl8366rb_is_vlan_valid(struct realtek_smi *smi, unsigned int vlan) { - unsigned int max = RTL8366RB_NUM_VLANS; + unsigned int max = RTL8366RB_NUM_VLANS - 1; if (smi->vlan4k_enabled) max = RTL8366RB_NUM_VIDS - 1; From patchwork Mon Sep 13 14:42:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12489747 X-Patchwork-Delegate: kuba@kernel.org 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 C82A9C433F5 for ; Mon, 13 Sep 2021 15:34:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AE70361051 for ; Mon, 13 Sep 2021 15:34:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242915AbhIMPfq (ORCPT ); Mon, 13 Sep 2021 11:35:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240150AbhIMPf3 (ORCPT ); Mon, 13 Sep 2021 11:35:29 -0400 Received: from mail-lf1-x129.google.com (mail-lf1-x129.google.com [IPv6:2a00:1450:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3465DC12C759 for ; Mon, 13 Sep 2021 07:45:44 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id g1so10172854lfj.12 for ; Mon, 13 Sep 2021 07:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Q6DknvnoVKlTPBFZkTxYtBHHlx7PNAbFfx/QOOMrkiY=; b=tz76PsDPS/GBTheceLTNvLVr1mWNVaT16nZlLvPlXVgnkDFqIv0CRujkHgmMQPPxIO ADACAfjP4v4fYePWjCNR2759Sxum4IO7vudVpR8z7fiEj+iVHcYLyiAal0l42PfS4z2Q J9aJBii6/ixwr0B85V0wOaHTjvdILL01NucMUUtkEYHYlB6rp+Dw/fYr80LYmILqQDts C9SZIC06RFSX+2SaxOxte5ILdj9yqcHuZJELqyV5CxqdYcDXHwZ5MjD6XyB7wC0BTHqh afINBfIzNIBogLAXh4V0fPC/Ego2y+Fj/xjICOEDplt2sMHt+nxxehD0bbBS7W7Aawqx eg1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Q6DknvnoVKlTPBFZkTxYtBHHlx7PNAbFfx/QOOMrkiY=; b=PQcZ7mD2S3qvWAxteDWrLQDywGu3VewQGmB90gNFv0EdvwCoNV7skkyDF77oYh3Us+ RZ4wi4bGEj2Fx92kjKJGLcaBCv7eny52A90vDLwEXkjiZkSWOZ+PH649wqjS8OnjzWey bV3bXkh3r7brr+p+8Mom3pWP4xkJa43eTtz/DYYqU4tK/vf9fd+rktCFKHtkNEVrFScu FKWoBXSa6MQ99dBdjnlmePWmg6a1RTku2XZjYz6k6/LIzVTWbFjKHaxicG+sJ9WTtkIu vahZ/5wskoN5Zvv2i704sDsqv1e9/dXNUQGcjRB/Ucx500QUrQs3hYR/ZJ9Di+nbEveN Nbmw== X-Gm-Message-State: AOAM532+VOOC9IeO4C5bkx8JUnVKgzqSNTz1cezEO3SCvaIaV7m99A7o DFmhzmzphS8eMVEjuJaQEknqVQ== X-Google-Smtp-Source: ABdhPJx0mZrAeTM5vvsM0PTWilljt9AhbMGzJay8x22RXWh4x6YxUfcrqSv1M3YW28rv98h0IDElbA== X-Received: by 2002:a05:6512:982:: with SMTP id w2mr9642502lft.112.1631544342603; Mon, 13 Sep 2021 07:45:42 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id i12sm849825lfb.301.2021.09.13.07.45.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 07:45:42 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , Mauri Sandberg , =?utf-8?q?Alvin_=C5=A0ipraga?= , DENG Qingfang Subject: [PATCH net-next 7/8] net: dsa: rtl8366: Fix a bug in deleting VLANs Date: Mon, 13 Sep 2021 16:42:59 +0200 Message-Id: <20210913144300.1265143-8-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913144300.1265143-1-linus.walleij@linaro.org> References: <20210913144300.1265143-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org We were checking that the MC (member config) was != 0 for some reason, all we need to check is that the config has no ports, i.e. no members. Then it can be recycled. This must be some misunderstanding. Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: Florian Fainelli Cc: DENG Qingfang Signed-off-by: Linus Walleij Reviewed-by: Florian Fainelli --- ChangeLog v1->v4: - New patch for a bug found while fixing the other issues. --- drivers/net/dsa/rtl8366.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index 9652323167c2..fd725cfa18e7 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -381,7 +381,7 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port, * anymore then clear the whole member * config so it can be reused. */ - if (!vlanmc.member && vlanmc.untag) { + if (!vlanmc.member) { vlanmc.vid = 0; vlanmc.priority = 0; vlanmc.fid = 0; From patchwork Mon Sep 13 14:43:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 12489751 X-Patchwork-Delegate: kuba@kernel.org 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=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,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 968E2C433F5 for ; Mon, 13 Sep 2021 15:35:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7E9D86103B for ; Mon, 13 Sep 2021 15:35:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232830AbhIMPgL (ORCPT ); Mon, 13 Sep 2021 11:36:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241181AbhIMPfa (ORCPT ); Mon, 13 Sep 2021 11:35:30 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A874C12C75D for ; Mon, 13 Sep 2021 07:45:45 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id bq5so21629068lfb.9 for ; Mon, 13 Sep 2021 07:45:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=TW72UxNYbzv4qy0lUe963kdNXAzTIo48VP5lfoV3wMY=; b=D6tgEkIXRm/WemOYu7la3Im2tL8nIEMHEpcTJD/ZI4zbaFdyNpKjcqIjwLE+408xe9 DK8lwxI01vyfBTT3sYWa8tmfQk7Rd2tv1CyHu0CRTmJoBcQaSmZVc5rDPU3VW7qN1BYq 5Ls5O7P/XhcnV8wfEW10uH4S2OGzeriH/s54KHKsUo8ih/WpyNhRKnBK60h4q7mW9miw O0YVk8yMGc5iUFvpGtJBZoIx48yn7weCp1Gnva37+EuXcbHaHHo5DwSSuYFRl3EpJI7h HTLWFUKL8lLjH/SD9XPo0xP0OSyPXTHAdDt8vfI3YLJ4n7tNKEZ7XO5HQM9ewlhYtT11 eLrQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TW72UxNYbzv4qy0lUe963kdNXAzTIo48VP5lfoV3wMY=; b=wE2535mBnvLOE6jZN4ZOMPeSBZW/hY88++AUHPnlqGPg9/PMWwl0nh5rIsR8u1wpIl OS/40BibnmUQmB55/ZYYWrhPlb9slsIFPYwBet2VpfgJi/xOQhNQqJIIWNo/oIbQjWUS 7I1zbo8VTzu3WTodVxuoXODPPRus89/Is0BDxSOrPGGaOjkD/wQUdCwsE5fZvxXWGZHJ 0z+CjBbDvNYaJ8C/w0S6VNlE7+qS3Z/u8FQXxQK6q9sNWzoe56NuSXzLrQQ/wDF/ZhaI 4TiQ6mOei9WjF0vBz0+L1L3fu5W0VtUFrLOuqowVGQn17oN33NLD9TaIY/Yrbr1h6qWs PkeA== X-Gm-Message-State: AOAM531GV/sloJwLhQkttbEdhUkwNu5Yr7G2VUJaucTbc/ITeOpYamwE nRYe9xqV75axKR7hgJEK2ItPHQ== X-Google-Smtp-Source: ABdhPJzqNGuQYfABBVvRR9EEYJE2fPQPGeQCjE205ECthrkpPR6kJuYeT85nHG9SyT+7MCxZRc9v7A== X-Received: by 2002:a05:6512:2213:: with SMTP id h19mr9371515lfu.598.1631544343759; Mon, 13 Sep 2021 07:45:43 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id i12sm849825lfb.301.2021.09.13.07.45.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 07:45:43 -0700 (PDT) From: Linus Walleij To: Andrew Lunn , Vivien Didelot , Florian Fainelli , Vladimir Oltean , "David S . Miller" , Jakub Kicinski Cc: netdev@vger.kernel.org, Linus Walleij , Mauri Sandberg , =?utf-8?q?Alvin_=C5=A0ipraga?= , DENG Qingfang Subject: [PATCH net-next 8/8] net: dsa: rtl8366: Drop and depromote pointless prints Date: Mon, 13 Sep 2021 16:43:00 +0200 Message-Id: <20210913144300.1265143-9-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210913144300.1265143-1-linus.walleij@linaro.org> References: <20210913144300.1265143-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org We don't need a message for every VLAN association, dbg is fine. The message about adding the DSA or CPU port to a VLAN is directly misleading, this is perfectly fine. Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: Florian Fainelli Cc: DENG Qingfang Signed-off-by: Linus Walleij Reviewed-by: Florian Fainelli --- ChangeLog v1->v4: - New patch to deal with confusing messages and too talkative DSA bridge. --- drivers/net/dsa/rtl8366.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index fd725cfa18e7..cf2e9d91d62d 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -325,12 +325,9 @@ int rtl8366_vlan_add(struct dsa_switch *ds, int port, return ret; } - dev_info(smi->dev, "add VLAN %d on port %d, %s, %s\n", - vlan->vid, port, untagged ? "untagged" : "tagged", - pvid ? " PVID" : "no PVID"); - - if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port)) - dev_err(smi->dev, "port is DSA or CPU port\n"); + dev_dbg(smi->dev, "add VLAN %d on port %d, %s, %s\n", + vlan->vid, port, untagged ? "untagged" : "tagged", + pvid ? " PVID" : "no PVID"); member |= BIT(port); @@ -363,7 +360,7 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port, struct realtek_smi *smi = ds->priv; int ret, i; - dev_info(smi->dev, "del VLAN %04x on port %d\n", vlan->vid, port); + dev_dbg(smi->dev, "del VLAN %d on port %d\n", vlan->vid, port); for (i = 0; i < smi->num_vlan_mc; i++) { struct rtl8366_vlan_mc vlanmc;