From patchwork Sat Sep 25 13:23:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514621 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2424638jao; Sat, 25 Sep 2021 06:25:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYDcCWLQ5qLYA0THGr4zR2qA2Rwv4WlMOP7e/l6AzMfhgF7SmUffTGdEKB/L9anWRgw7KL X-Received: by 2002:a50:cf86:: with SMTP id h6mr11089335edk.104.1632576335061; Sat, 25 Sep 2021 06:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632576335; cv=none; d=google.com; s=arc-20160816; b=ozdsd32CoKW1a0lmbVhNueki0MiqpsSnvJsi6uG2Ss1eINPcGqZCL+CkXvPLayF7qE Yq8uZw0locVdIFBNwdpYdncJtCmolukkcfpiRSvH0h/pendezaqLqsXxl5QfOw1obnDJ Pa6wlya12EQEOCmLlqfNwo6XDJGqhOhx97kzhLvL1J5PvfryGn5H5iDejC5rV6oXIDhy huohJaG/LPcp4AAPMXJrDYc2K14Fb/3YJFklFFPpZewGxyzuZFybyoHje/G37XJVDr9q hljEOrVdbC9dLgUMK34jmyVsG1QO21HvOYsxUAON1rLAsAtm0R4ZxPOMkezx3AfBZTwm pDYg== 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=E8jzLcCLEJuUSdhWC55ikwtSHr2l9G4RbGnVKz21id0=; b=uuaZsvAZrJjmtGWcwzesEx8mlKpjPGzTtiARqudeuzY7lBjN8EBdew9s3YxGDpm5RW tCcXpvIC43OxUdHnQRUIT3kQ8D5yhvWcJ80T8itpPTHc1BV7FF2LqN/NJE626SMDimiG bNsR9iUK76zruj1Y72wi2PuK/Kh4MNHZny3D0dMfUm3ZwiPHGNdmySzoTf6M6yJvurxk /vFdc5TJtsXsCFdO+jGYBVllXuedQpaIB5QlI684LfuzeuanX6Z8O6EOTf6wh31gXZpP wT3qCUN6dpti/CcPdl5q25G/RHa59CCyUPTmK81L65hziDuZZ8q5MWwZXembKAuAWtTR GjlA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UwvlzAKf; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si11435416edm.70.2021.09.25.06.25.34; Sat, 25 Sep 2021 06:25:35 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=UwvlzAKf; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245431AbhIYN1I (ORCPT + 8 others); Sat, 25 Sep 2021 09:27:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60528 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245011AbhIYN1F (ORCPT ); Sat, 25 Sep 2021 09:27:05 -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 53373C061570 for ; Sat, 25 Sep 2021 06:25:30 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id b15so52033747lfe.7 for ; Sat, 25 Sep 2021 06:25:30 -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=E8jzLcCLEJuUSdhWC55ikwtSHr2l9G4RbGnVKz21id0=; b=UwvlzAKfXQtPItJY9sg7II0UlPJ2qZblOZ4eJufoEyX4CsmLAIKXfqYDbO88dvpuLE ELArzZVg5QT5GExQgeiugEylkFcyujv0Nx0Mjx9cqUtv/zylB32ix110ptWPoSjNxNFD n+n1P+JDYXUnUCFmns7D1ZdVNvqZ2CfBNxKW1Qy51GWCnhjvZzLoaUbBVl1pTFmUK6bF VGvx+yzw1CBISl4JMe4DJWIJXI/dJrwM39qWVNqA6uMggv35VhM4SJVj/HpnUBzXs3tE nYFRvEYbSIQ4uskzEEqHJ9nEQTdshNaT4n5b9mHz2Pd+6+bKDoIiCTkAraj+rHnNMy77 VKKg== 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=E8jzLcCLEJuUSdhWC55ikwtSHr2l9G4RbGnVKz21id0=; b=LuTsyv7tzZRzfen8+4kkLys0eFQKosFoDAhQWvXv7V6o+7tc594swnDuwRl00BTEHR +ik4rFpFrwtGEjT7zwcPKdYZwg9kNqcf6UofYWIJ1tM4i/67zav+hPZt4BKDLh5+fSuv wyO8sFCjbziOVm6z76re+zRiLmu9pKW0rbTPVAimHdy70D1nuUL94ii0XADEAhRa/Eas bjr/kvcc2vfbzQrcPMbOUIy4kx1piCvdXx0Em/m0FZgdWUsX2ugrcczq6mNwy7Ep0ocT TbmEJ1fIwOb975TyKThsZSGuQhqSZ+amgeoC04jWiCtAKvlNWED07MadWhUPpPc7d8FR ECiw== X-Gm-Message-State: AOAM533gRYPAUgqnXrC5bezcgcRDJa5lmbf140XJpuqIrO5wbIdreV7D QQQIfIWjB85ychyi54XRSf5dDg== X-Received: by 2002:a05:6512:15a0:: with SMTP id bp32mr14639872lfb.509.1632576328679; Sat, 25 Sep 2021 06:25:28 -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 y25sm199590ljj.23.2021.09.25.06.25.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 06:25:28 -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/6 v6] net: dsa: rtl8366rb: Support bridge offloading Date: Sat, 25 Sep 2021 15:23:06 +0200 Message-Id: <20210925132311.2040272-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925132311.2040272-1-linus.walleij@linaro.org> References: <20210925132311.2040272-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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 v5->v6: - No changes just resending with the rest of the patches. ChangeLog v4->v5: - No changes just resending with the rest of the patches. 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(+) -- 2.31.1 Reviewed-by: Vladimir Oltean 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 Sat Sep 25 13:23:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514622 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2424643jao; Sat, 25 Sep 2021 06:25:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwok04c9hkoCtVaMJErS183JmVWMtba4f0f+vitFSGY4iA3B5psBBAVAoO79/c0Bto0TJai X-Received: by 2002:a17:906:558f:: with SMTP id y15mr17032945ejp.572.1632576335542; Sat, 25 Sep 2021 06:25:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632576335; cv=none; d=google.com; s=arc-20160816; b=hqL4moN1sfpZKnpGbglE5K3G2TdJS6NPlQZEhedqMKwXKxJFExMJZkN1vMirQJPjGm 6+8oEalLxs8wvHzdbx+kw34W4IPuCf8/mNuPoU3xWmSd+CBiCmZ/IHq58317jwlXM6xN qA2uudUkfBV1fca0cnjAY9wsmBwsJ9NHouFVmbw9rHyR/1UKsfIymJnllTlS89IiQT7J TS9DnTG+5d/OqDfjqaA1jLdpGviC2fwoEqAMi5zsdm1OqN1G9n2VOvkKyVTTtAXOvPI8 ad7GoQx76W1I2BqIRjwcpm7mGY00KBq5P9Sr5KBiWAI830p93O5uC/P03DRyH01fl9Rc RQNQ== 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=NEJJR5jM5Pg1NdAHfi2Ja/GWqJM/S6jo4S+TrGoD8no=; b=03KngpEI+UGY2J+OTiIOkTapMNnkl3+JjQZc7O10eEApAiVGXwPCKQkF6fM0X0vhES Pp7f1iqkQutBGfZW6ZkKTyuOrFhL+CyIBbgBrVWU2hH3JyA0N0O+f7FByszp5GTNPYZU mj2ziz6RV4gpaGERvyNUWfuf4ianVKnnbJMjBk12YV/PtY3Zyjzs58udrTda6R0GevsO agixBxn2A1VQFH9iHzpg0eLM2pnd/OGbA7rzo+75XogZGBYfMIy6jOn/87iW9+0CaPg8 3mIp+MWi8+p3cOACF50AdZ68d8b/1bWiAUWxuxQKrK16m0uTFHfEXkhAcwGcpiIdZD/l 4ezw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="DiL8/K3d"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si11435416edm.70.2021.09.25.06.25.35; Sat, 25 Sep 2021 06:25:35 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="DiL8/K3d"; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245520AbhIYN1J (ORCPT + 8 others); Sat, 25 Sep 2021 09:27:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245465AbhIYN1H (ORCPT ); Sat, 25 Sep 2021 09:27:07 -0400 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [IPv6:2a00:1450:4864:20::12f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CC4C6C061765 for ; Sat, 25 Sep 2021 06:25:32 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id g41so52863362lfv.1 for ; Sat, 25 Sep 2021 06:25:32 -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=NEJJR5jM5Pg1NdAHfi2Ja/GWqJM/S6jo4S+TrGoD8no=; b=DiL8/K3dPsNVqNucc7Xsitkyg6cmmOX556ky8qE4gwmfTBNOR00g3E5ci8i0Ji9kiM 0eTDoUGmiYzo26Fw/y8kNPI/PayCPDoizLO5RfPG3o/0WbIZvuPztL/lklnQO6W0MGY1 n1XS6OFFq/M6OtiRjkU4zKX6LOXbWOxhNZKA9K2zasO+G7LNgq++s8o0fZE312Olg+xd 3tttUS86ZhQ2KsgnJH1tEOV3K2jaYfy617vX+aWPHni/G1yQ1SGNJdsHNc41IOy8Kwlc H/fxqgixrX0K9jKt5xEE2rWr/LH8nyLHlXVo1NP5NOK2MPhyYMXkMkyoedlqxZHrinoG 1w9Q== 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=NEJJR5jM5Pg1NdAHfi2Ja/GWqJM/S6jo4S+TrGoD8no=; b=tpBCDBwRayRuQIjxnizUSJnxcbNxWGxoFF7w9QADIdQnIzJKeF2w27Eqh6B4UJe4yw rC2ikpejeSYwD9A7beF5u0Ud+/p0SAMMaCTRtVLeCSa7KsvSAWmVozaBLSFLcLm/vXsw 02hYdCXnJSdT2+BmOxvM93eLdhqTIRcF5ybc0iJmsKKy7rJB+dn8wwqUQxF/351Ko11s b3W4RWAezkSa/wznvldAQ+PK6HB9VmoWUayO27KZRK5jVze0dKz8iG/DnQJVr4T2nBG4 WK4UMvje9Ljp0HktN0pcpgNIvo7ZqW/MusB0sMNWK8MY2KmXxaoWyhcTLQIKWkuUVbYw jnTQ== X-Gm-Message-State: AOAM5339q9zStl9zvTzfdpp92asa21j/SuWooGQ2JgrCFF5TQlNIJeSh bWX7vQ9nz07ZATFgkwEEPZx3gg== X-Received: by 2002:a05:6512:3c97:: with SMTP id h23mr14692926lfv.93.1632576330414; Sat, 25 Sep 2021 06:25:30 -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 y25sm199590ljj.23.2021.09.25.06.25.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 06:25:30 -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/6 v6] net: dsa: rtl8366: Drop custom VLAN set-up Date: Sat, 25 Sep 2021 15:23:07 +0200 Message-Id: <20210925132311.2040272-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925132311.2040272-1-linus.walleij@linaro.org> References: <20210925132311.2040272-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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 v5->v6: - No changes just resending with the rest of the patches. ChangeLog v4->v5: - No changes just resending with the rest of the patches. 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(-) -- 2.31.1 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 Sat Sep 25 13:23:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514623 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2424670jao; Sat, 25 Sep 2021 06:25:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxlW3Lw2bRxN3AqaaJa1a3M6AyJRGPV15qG8suU5FG4WP7BrM9/1Op/dcbv07iDLfFm5T8+ X-Received: by 2002:a17:906:7d42:: with SMTP id l2mr17107183ejp.467.1632576338187; Sat, 25 Sep 2021 06:25:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632576338; cv=none; d=google.com; s=arc-20160816; b=qZSg9Kjh255dcBTPQuAxMJYZ/LYQc5hQgu9ANVz+WjET3TdR8iKJd6tWOIwFZ81+cm QYGEYHiHNp7bHT1TOXpqbF1IMTmnzMStXkBcm7grwsXY948ISMy2IW3vbimdP2/Pu+lb nFhi3WQF2LJv/TKwX6+LuQrWrCJ+M3u1MKE3n4sIfiLYXPhVw35FEZf18+fqgW1MGAb4 zMIKoHk4NZtrKwDNN/aB+9vxsiB2lD1a3MOfQZ/W1LNZKEWjuJq6Jihuy9ZYIyrBMmf9 4yKaBTazCMiSTvKCoB2sf2cptJzi2AE77zyWci371AWCuOpL5/qGd6tKaca9vXpRUu15 XYSQ== 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=iAP+yZt5ncqGNoQg/AEmqn2wFTwsPLnCWgGNpidADs4=; b=jM4/JlRz5YqYqRnY61dYDwcosbOJIt9iMlmo2JWJcfqEIIZDG1wru3DSzLPCGU8gDX P10bE4y1fuUgNdT4SzDiKUS9NbWmh869vZOL8Pd8GbZnSE890IYTgxvRRYWCBnpW8WTe tiMAAzSuwROv9H/4jwmTBAxPlnNq5WkLIGOKvi2Qeq+d+Eh+Xc2xGDDB1o3Mcgp6t6ll Y8fh59jg3hI/4xUE7/uPGazrRnJ1HTEbi90Sn8L3mk18X7Xv8HQTS0bSqUzgl18lkdRX 4vw6ta/m/QY8ppNj5ggfhKGLtwvwCvbEdr2bqPLvp7AzVOYBqyKp1zQjKoKbvp67mUSI kaAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KKUZslDS; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si11435416edm.70.2021.09.25.06.25.38; Sat, 25 Sep 2021 06:25:38 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=KKUZslDS; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245582AbhIYN1K (ORCPT + 8 others); Sat, 25 Sep 2021 09:27:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245524AbhIYN1J (ORCPT ); Sat, 25 Sep 2021 09:27:09 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 53791C061570 for ; Sat, 25 Sep 2021 06:25:34 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id u8so52108417lff.9 for ; Sat, 25 Sep 2021 06:25: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=iAP+yZt5ncqGNoQg/AEmqn2wFTwsPLnCWgGNpidADs4=; b=KKUZslDSHCLor8pLmklrCxphfirZNeBlXWsMIeNPIEp7Irmv3id2IpvU/cynt99Fmp ug0Zk/TTnjnTCkC3DsnAEH0xsxHVcWZiii4R0BlWMN919qM9j4VBIPmG9xjU9iNm2wKf KcXSifuGcNFTdY3dVHam8OYKWwMxCzNmIsdxEEy+Gmk9LxG1zS88cNTlSI1L1s2K+/5A xVhECQnJMCblL/6ClDYDmU0LyFtyIhTW2nndtD8Sk+47vsZ1tHFBbKUL3+ZfqXSAnHZP g9k0Tu5c+23D/t0UfQ652J8vpbwud2uffG1g2+wOpFPSnSKRRW3wDxnYZjYi3rv1d9/S /k8A== 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=iAP+yZt5ncqGNoQg/AEmqn2wFTwsPLnCWgGNpidADs4=; b=e2qa2/BBMMNfXYpjV8jqjpsBdeyzNg+pwccEsu1knLv/RrOCOkkIbjy0FAeOemilS/ 8nqWLTgyAzpmc2epL5ntZWn3bwunh5eytPofRZ686Z8EoENUc6DLEGMdpv/J42HYMTy9 YJEs102bzrhG0Xpr7IpR6klG95e/SIaEh0GQYOaqmK0yEsp4v8aE6vSflynNBwwG3E3H htSjY7Dgae1oVWaNfRg979qP32yhIlha9RJi8MdUjLfaMlaE9vI8MWVuNtVXu3n5pi6q zMewdHaBKVsl6UTvqX+fSdteko8s3buSVQsbpNXlESCRbRPW2MtcmK9tvJ3HIDer+itT p8FA== X-Gm-Message-State: AOAM531fEJaw/1hzVPFsQTnJBIFXkd2bDn/5kVgJdmjbhFyhk5ads7wM 7V82HgIS/QHjF3aXJnrLeHMG6A== X-Received: by 2002:a05:6512:3128:: with SMTP id p8mr15087412lfd.502.1632576332671; Sat, 25 Sep 2021 06:25: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 y25sm199590ljj.23.2021.09.25.06.25.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 06:25:32 -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/6 v6] net: dsa: rtl8366rb: Rewrite weird VLAN filering enablement Date: Sat, 25 Sep 2021 15:23:08 +0200 Message-Id: <20210925132311.2040272-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925132311.2040272-1-linus.walleij@linaro.org> References: <20210925132311.2040272-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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 and implement filering using the register bit that makes the switch drop frames if the port is not in the VLAN member set. Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: Florian Fainelli Cc: DENG Qingfang Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - Drop unused leftover variable "ret" ChangeLog v4->v5: - Drop the code dropping frames without VID, after Florian described that this is not expected semantics for this callback. 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 | 30 ++++++++++++++++++++----- 3 files changed, 24 insertions(+), 43 deletions(-) -- 2.31.1 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..2c66a0c2ee50 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,20 @@ 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; + + dev_dbg(smi->dev, "port %d: %s VLAN filtering\n", port, + vlan_filtering ? "enable" : "disable"); + + /* 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 +1455,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 +1612,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 Sat Sep 25 13:23:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514624 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2424686jao; Sat, 25 Sep 2021 06:25:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhufxHI96Jn6RopKbvLTOORblzVjQ6T3zsAUssW/XTVm4FgkZWrbuDSdtPsyfvqrKzpwzo X-Received: by 2002:a17:907:c22:: with SMTP id ga34mr17164375ejc.336.1632576339446; Sat, 25 Sep 2021 06:25:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632576339; cv=none; d=google.com; s=arc-20160816; b=qgx428URw8L1kvBCFCiAWss8EK64uWuKah1w8p/dJoIsVeM7Q1V+pcBueAatkducjw sfxM2iGazzPFnSFzOFds7kN8nk+WFKIb0tMfjsnSOhy5QsP6FVQeHDvbA74bAIfXlAsx zBrzktvKyyzkxhndtMngnBSibvy474GeVXlIVutvcuJY1BHiXgCbWmBDN3UNFzR+G3d3 GHvpbEnnc83WY+q86ImY/SejjTeDvMIU8ap+SE8XTGEF9t/PUUs/8/+qQsiUJB1pHDG4 fA09+jFjQx0pYjpT2GDcdULMIdYPNVW/byfiAw5ZdxthDYj7I0N+DcoCRBRqs3Y+wuzO R1HA== 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=BD8hM3ctAjh5GlIjFT5kwn0LQu6zAedelwfN30DStyE=; b=nVk7snj007yfgLHb6kBDedEUfkG5nxkNUNV0WGXPdR9bgDtaRulctw8sduJ+rmHx64 l3Zwn+jICRa9p5V4pg4GMjI9KvWLaAoPCkShNu/YUlaWByKZmtJhUtbqRwzS9c8v2e7H HSVtL1xYprui55MzlXU9aqNSBNdwpYZ3UL63nPzkMMefwOiOqPxfL81QZ0+yWaiwnKiu MRm8yPjdCG8Jo17/V5qPvzYInhHGb/rSg+7Rs4gsFgf61M3LhdaSy1jDaio4pcB5WVMl KPloZ2RMwdvq9C43EY34Bsv+QPVCk2dowZONu8OBJvMB4xlS55NrRZKvM06ZZDBgEPp5 F67g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S3QN6jBI; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si11435416edm.70.2021.09.25.06.25.39; Sat, 25 Sep 2021 06:25:39 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S3QN6jBI; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245603AbhIYN1N (ORCPT + 8 others); Sat, 25 Sep 2021 09:27:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245566AbhIYN1K (ORCPT ); Sat, 25 Sep 2021 09:27:10 -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 AC637C061570 for ; Sat, 25 Sep 2021 06:25:35 -0700 (PDT) Received: by mail-lf1-x12e.google.com with SMTP id b20so53231004lfv.3 for ; Sat, 25 Sep 2021 06:25:35 -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=BD8hM3ctAjh5GlIjFT5kwn0LQu6zAedelwfN30DStyE=; b=S3QN6jBIlqVPIXFj/FX9WnbO0Z1q/fs8vGGVrHKWZ2yIVistJmyK5dkhsxPifw4kdJ yeCp1DZ8L4i7d3GRuZ1fciS3D96Q+990huaVPKGIvWptKRwW9TnGCHQBlnZikgfGRa2w Dm/58syukCgxHqwjC1pXHPDM2EEhlh+Isd2JjU6HxHLLziHX74cvGcQsrv0RleXBZgn7 JHd892oi07oxgv5p6yGonERq3NpSq/Y5RxBIgKpVsc2h6Hg0Qn/3sGhbVLlFAH3UfuWt 58QxhuAdpDG+EkFzJCGRU53v+POeMao4RLLWfyMR/oAhRo7X3up7v5i5Tq9Z+WGL+R8f Di/Q== 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=BD8hM3ctAjh5GlIjFT5kwn0LQu6zAedelwfN30DStyE=; b=Pfl+JTmHxPOSZZKOe21MARq/UOwZwNkzpttf5tYsbku6jN0yQvqAb9ahOPYjz8JIGe +iQheVEjVi858JSDCbekcOoAhWtjha//Jvqx1YT9yEJbYcovchxg0O3S2VH6Jz4ZXKjw UAnUet2kZ6dyJlAxpsxSswGiOHmXF+DCv9vlXXWArBXS71YXHjw9ToVTJQLjRv21QCQP ph+naHMDgRRtzEFrvx3yWcYUMgJUY9T1o7ovOKGmQ0tqFjPzfeqJK8s30zzsToLO9HMR vbo1jY1CWhm+pu7RV7aA7oLWUrJkB2Oh339nKTcquzWF4yQlOY7DXkYjsK7dMcUeINBn 0TwQ== X-Gm-Message-State: AOAM5302CjVzrf1Qy4UwNDfeWKLHUGxkH2nftNIGphphRQWp9DM1hhOB 7+Pklzjz8oADt6FSAr67s4D90g== X-Received: by 2002:a05:651c:1146:: with SMTP id h6mr16907217ljo.444.1632576333998; Sat, 25 Sep 2021 06:25:33 -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 y25sm199590ljj.23.2021.09.25.06.25.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 06:25:33 -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/6 v6] net: dsa: rtl8366rb: Fix off-by-one bug Date: Sat, 25 Sep 2021 15:23:09 +0200 Message-Id: <20210925132311.2040272-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925132311.2040272-1-linus.walleij@linaro.org> References: <20210925132311.2040272-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org The max VLAN number with non-4K VLAN activated is 15, and the range is 0..15. Not 16. The impact should be low since we by default have 4K VLAN and thus have 4095 VLANs to play with in this switch. There will not be a problem unless the code is rewritten to only use 16 VLANs. Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver") Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: DENG Qingfang Cc: Florian Fainelli Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - No changes just resending with the rest of the patches. ChangeLog v4->v5: - Add some more text describing that this is not a critical bug. - Add Fixes tag 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(-) -- 2.31.1 Reviewed-by: Alvin Šipraga Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index 2c66a0c2ee50..6f25ee57069d 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -1450,7 +1450,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 Sat Sep 25 13:23:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514625 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2424692jao; Sat, 25 Sep 2021 06:25:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxvzd5VqrVqvN4/i4cRKS4MtmBCMny6a4L6BsAsLFQ0MaRNknyaKvOUhmrjhRbJPcy4BqGM X-Received: by 2002:aa7:c1c6:: with SMTP id d6mr11375722edp.117.1632576340647; Sat, 25 Sep 2021 06:25:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632576340; cv=none; d=google.com; s=arc-20160816; b=CbI22B+4Kop9m8i2EzWPGBcfZo5+TheJpS5ucfIoPT2el/8Am6bRPIBjdbTGYQjUfr B2cSiAtWZEAG8HnS+0TUo+aC4XOIds3Seft8gmFN732NzNd7ASRWUI5Ybx/J8xNMFIyq 7TEOB4EpPTNVDY/q2vJ/F0rkHdreryKOXEwt7zY0Kk0Lc7N324EZuAYhuEnw7Pr6Q2p7 1XhBmGsMFwlSXOKw2+wPq5mbjEvIPI6WCE843YxegxRZqsKMVJjkQgEkMne4Tw108cZ9 3c9zBj7sPcb7fuIncFvHTKWWcr8UdW3FoyPNh6fYoE8H9blfnPW/CHaXswGjynn+N7MG j0kA== 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=l58tRXqzKdB7MAdnaHT3OcMQZTQEtALQkUgXblUNQ0M=; b=YfxoZU8t2oK1oJByFsVDmXvk1CxGICe8QdBZ/jKSsC5HrfDEdep0M6l5oUg3TQjEPo l55nRSMbdt1GMJBw7ze0tjZnj2SU4IzPClfDPEgJdC6EpsoJW2kqfD2yqZyY3v9srGQG qskqwHNi4P8/nxwOpg0hSKAoGMy2193I2b8XI6XQ/AMRS9xrqkO1gVlVZxeKBeqw+EoO LbGxnMXe7W0qCE2MKqEu/reDmFnAJ6DnKQNU3xHnRAlWsvfBEUeq20382qh2dUbGa2hm UWh8omhGizq3yJoSdnH6oK8+/qrWEhWCRU3nuuDd906VkyY45L2N8sAr2mSyzQNL66B9 c7pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dciIA8Oi; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si11435416edm.70.2021.09.25.06.25.40; Sat, 25 Sep 2021 06:25:40 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=dciIA8Oi; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245622AbhIYN1O (ORCPT + 8 others); Sat, 25 Sep 2021 09:27:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245591AbhIYN1M (ORCPT ); Sat, 25 Sep 2021 09:27:12 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC2EAC061570 for ; Sat, 25 Sep 2021 06:25:37 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id u8so52108769lff.9 for ; Sat, 25 Sep 2021 06:25: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=l58tRXqzKdB7MAdnaHT3OcMQZTQEtALQkUgXblUNQ0M=; b=dciIA8OiaRzRMYpy8Xo6wDLagonesv4wTKocpCMMaorSVqT4IVh0JbTtVJwRk9XEXx p/ARgE295C1MAOSqRfNaQqjNYnEKo7djgSyDMv7LHqV+FeFdvieoS4uD6kzJ89qpbV0f +3FCS+qe02rymYRClR1JwQdvf1+V0DxA0kHDSb4JE38+Yiz6/9tuP68lNbAeymjmUhfU y3cZXPoHzU5T2OV+dnTidkpWCkb5V+l5ZPSaZrRf2Gn+KoliIHF6+2sL4uwv3eVuVkGP BPPPj6Xipv5FfTbpg3Yn8n5aFwKPkQ7EXyco6rBQ5d4LuYEUy1bHgCn+/IjkJ7XDM2Rs CLEQ== 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=l58tRXqzKdB7MAdnaHT3OcMQZTQEtALQkUgXblUNQ0M=; b=n+Dc1WIfJ/rT0PFosNtwdEqhEwOKvk4+zKpMRy9u4Rm2Yn0b3QAuxrNwWbaoY7EfDu Ii3xq+OvMFlPMKSGA6jiDfOjIhXCD0hiun6a9sAJv3uGH/TuBit/yPeBcg2OnpNvcpgc 05JYSmY3BNJiMtpqiAvn7spIidPubrM5by9F50BvEPU6GRMk27iDNUxJSUQVBLUicYph 8XQvtGv/Owtg55yBZTzGWq/VEV1rxcBCbu1XjCKXoeLb2yO38TQrN5vFF57/MzrQfW1Y MVNGAbAOfl1aS2E5cg0zvXOlbDX/upuC0YD+hzw7SvzvrNjivrpSpXcxSPIKv9ZTtME8 juHA== X-Gm-Message-State: AOAM530ZJ/tq+jsPNbgPSeDJegVOLg+EMHKxmCIOlh1DzGdWQ9Z+Y4Kg TsCjJbyDpX/uHh12rYFjS0KWXw== X-Received: by 2002:a2e:aa8b:: with SMTP id bj11mr17412295ljb.180.1632576336065; Sat, 25 Sep 2021 06:25: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 y25sm199590ljj.23.2021.09.25.06.25.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 06:25: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 5/6 v6] net: dsa: rtl8366: Fix a bug in deleting VLANs Date: Sat, 25 Sep 2021 15:23:10 +0200 Message-Id: <20210925132311.2040272-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925132311.2040272-1-linus.walleij@linaro.org> References: <20210925132311.2040272-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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. Fixes: 4ddcaf1ebb5e ("net: dsa: rtl8366: Properly clear member config") Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: Florian Fainelli Cc: DENG Qingfang Reviewed-by: Florian Fainelli Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - No changes just resending with the rest of the patches. ChangeLog v4->v5: - Collect Florians review tag - Add Fixes tag 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(-) -- 2.31.1 Reviewed-by: Alvin Šipraga Reviewed-by: Vladimir Oltean diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index 0672dd56c698..f815cd16ad48 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -374,7 +374,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 Sat Sep 25 13:23:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514626 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2424731jao; Sat, 25 Sep 2021 06:25:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJVPVG+NYY7+mDZrBh/GXXtQ2j0T2qu9YDjaTe7nGzQ7sO5oJfb7OI+JHdbbdRve1wHYm+ X-Received: by 2002:a17:906:dbf0:: with SMTP id yd16mr16763302ejb.445.1632576343430; Sat, 25 Sep 2021 06:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632576343; cv=none; d=google.com; s=arc-20160816; b=Cig+dZRbHLx3ImGWxU0/zk1BxTELi8wEMxy56/RscLlgNbxrVmojKe0QKJR4N0tJEu 2/CH5GJUfdEhMCQHY2Y1rHZBozq5wE+1YQ4sejjYvPdRz9Rnbj0fH4rPgDjfakJ698CJ divqc/FVNTc5sY3KUQ3mACPYa4p1PPiUuLZ2JnEk/HVPTiQJ4jUK8MFvf8I7KRBdlBuF Om+mohQBR/KxZ89HrDFuvkJc0aVEAWJEx8tY3MtEbsf/nnwbJH3BgEzmMUhHZJMUyLxz bFBcLef92J19C2h0WNeYoxfXx/TmYBZwIA7BuGM1JwkxF6djPC/Zt0U059yazl4/5AIn 3GCw== 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=k04RTdRCY30lSM9g5jnyDip9cxAIKlIITWf3Cit+LsE=; b=w9XGua70N8SDOFn1tBXhcdvZJpvW4chXtWJOO4tEIclqLTFiLT37mtswDT0YcBOA8c PLwdEPVxO8J0rxZYSdFn6qUEUNO46V6jH52mQ9RikNrwLqEGGc7+AZvPajhKiUoKH4FF OUSAwoj6vw+39FOJ513AESHwKZ8ienabUGkPzmKAtrV090X3ryILJucNn71QIHGsdTwz 3wKfA4gwP0SaK9faXfYFxS/Fi/crmI/n9tzCgyKfUV1hn4K/+gn0DIKMqtJ91k3g+KJL OExdSDzXW9BOoGkJXdEKrxD7HChIry5gMGRTmUWqFVY65/nbb/8yS5QvGYPfQb224sBU BWCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ruK58Zs3; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y17si11435416edm.70.2021.09.25.06.25.43; Sat, 25 Sep 2021 06:25:43 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ruK58Zs3; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245667AbhIYN1R (ORCPT + 8 others); Sat, 25 Sep 2021 09:27:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60576 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245633AbhIYN1O (ORCPT ); Sat, 25 Sep 2021 09:27:14 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C2BBC061570 for ; Sat, 25 Sep 2021 06:25:39 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id y26so13532843lfa.11 for ; Sat, 25 Sep 2021 06:25:39 -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=k04RTdRCY30lSM9g5jnyDip9cxAIKlIITWf3Cit+LsE=; b=ruK58Zs3GW0TXGXcuD6HBerLFVCWybbZjClbhrD3/Ybfpzm4J8XFVhozMR2VzO3uzG CeMQetz+eCArXouX69lZ0envKzNZSI8rfU+uNC02Nx5DwFlJsrCBe6awJUr+VMHMC9lZ SpqsxbkR28ycW6Jvp4JGGz9xqGjaY3TtKOy2gIKpnbAyBlgv2I7rwYs9yekoAZ+soC7C LS5pVsZPF6DTAMfX47wHuv0MWxNSDT6RAVULAaLCF7Jdkr1H7RRjFIPhzFTinvBG+ZFW 73kJtujAi6SibismDS/QdvOxjDfFrsIpoP8NgcRSCbdEZlJFDabEbMDpmUQi10SRe2qs pWrQ== 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=k04RTdRCY30lSM9g5jnyDip9cxAIKlIITWf3Cit+LsE=; b=S4kwAFx9HxCYxRYpsNorAcBvX5YUik+2opuZn6a0g/IvBmamg1RgEzJLWoBRR8ykbY ubjeaEV1r8n8jMhv7fEhZ79wk1QWgfZZ2gvU8NJ8jraVLcP50f+MFCNsWGTocGX37acr QyQP30r3Cbq8MmsBrsSOrVn78+w8vk8eX1VCQU9CW7qUdcUoozGyevDy/sAU6931WTcS lZE0/7b7Qh93Dm9wFmy6fZ68NUeps61VUk134mbubc3MYCghQaeMvki9WxklSQOVMGgY 65KqS285ISqWy9/O5vRJWkSKOfaBoDIM3i+05PqqE81vmhIsFxHLq/GEkqFKypBXmSbX Y+lQ== X-Gm-Message-State: AOAM531tJMyN4QPws4p/id0iNQHFK9gqH7rNTU42u6khlYN/Y4bYEyVl YkvTOVdvTAcX69w/Zz2YOwvNwA== X-Received: by 2002:a2e:9f4f:: with SMTP id v15mr17125288ljk.468.1632576337977; Sat, 25 Sep 2021 06:25: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 y25sm199590ljj.23.2021.09.25.06.25.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 06:25: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 6/6 v6] net: dsa: rtl8366: Drop and depromote pointless prints Date: Sat, 25 Sep 2021 15:23:11 +0200 Message-Id: <20210925132311.2040272-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925132311.2040272-1-linus.walleij@linaro.org> References: <20210925132311.2040272-1-linus.walleij@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.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: DENG Qingfang Reviewed-by: Florian Fainelli Signed-off-by: Linus Walleij --- ChangeLog v5->v6: - No changes just resending with the rest of the patches. ChangeLog v4->v5: - Collect Florians review tag. 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(-) -- 2.31.1 Reviewed-by: Alvin Šipraga diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index f815cd16ad48..bb6189aedcd4 100644 --- a/drivers/net/dsa/rtl8366.c +++ b/drivers/net/dsa/rtl8366.c @@ -318,12 +318,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); @@ -356,7 +353,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;