From patchwork Sat Sep 25 22:59:24 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514630 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2775883jao; Sat, 25 Sep 2021 16:01:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwETj2ndQTdDE3Rov2GxMk9EkGU9fyduvuvtE+a+6TJRaG95KUsOoNMwT/37R7cuYtk62wq X-Received: by 2002:a05:6e02:bc4:: with SMTP id c4mr13789176ilu.129.1632610915078; Sat, 25 Sep 2021 16:01:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632610915; cv=none; d=google.com; s=arc-20160816; b=q3ah0tYhJIDDJze3SpNpzT3C16O19RXNDpvom6B13RvZohCY9PPQWn4l9CE6gQKDMx egA1RsRQApxx5XcYiIGhfs5nOd7EJvlt38mMmCfakJmfXQB82Ery1gioutUfJHVO7h1M rtErkDsParJXNJtPNuKWfmWmr7I/Zm25QpPJWYfPtdpRX8cwKlkU8LBxJ6Q+ARZUtlVt vVMkd11SxIi4eS7rDyEjF3MPyw72ggKmFhqKG0sADqLia4Xvvu6cSiCDr0R8MnpGMU4m dSjZ6d9gdg5nrMToEPA7GF8cVJdNj6UeY/a/VNgAZkoBkH7+xeoSC5V6rO6kCWIu66Od 0QKA== 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=MR0PfYx22ke+kh/lxH00XljqzBmM0dQBgyVIJd3ubUI=; b=nZB37bZtq5Uep7uQTsgiS/wOGHMbBM42XKL26EkIZvhwupHevKOM3OiC5Xh9PmLZu9 9tubhce97S7OS4fUXtjKDPD5PDhUeMfB9V4sxck7KqJUm3ugP6IlkAQClqHIfaKYv0XM RC7r67E+R8PFYvkOzBMby8UfpRXc5afIabzc9AYmMB0aEsnMWcmbDTqGfkwvN3zOjMcF 9yJ8Y9ksI826lkyh395j+Xgl/BHNYHhLFvUBz5Ntryl3iaty8ru+gnLDItgvK8/TijHc ExGYf3izqQ/zRR+R4AIGcsOA7gByf0bwJTZrqduUxz0UcdVvZDn2emtrJR1jA5pHvkl+ L+Lw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ovrA7yy4; 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 u6si16405707jao.3.2021.09.25.16.01.53; Sat, 25 Sep 2021 16:01:54 -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=ovrA7yy4; 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 S230185AbhIYXD2 (ORCPT + 8 others); Sat, 25 Sep 2021 19:03:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbhIYXD1 (ORCPT ); Sat, 25 Sep 2021 19:03:27 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED482C061570 for ; Sat, 25 Sep 2021 16:01:51 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id z24so58286955lfu.13 for ; Sat, 25 Sep 2021 16:01:51 -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=MR0PfYx22ke+kh/lxH00XljqzBmM0dQBgyVIJd3ubUI=; b=ovrA7yy4r3PPO/W6llfIAmnxGiNudqE3KRajjaehEBA1OA8Sv+wlMg6JOC7W3qTGgD CmAaAM3C3slNSD1K70rfgN6xtcCT1CWOuZIjz+C+zt5LfH+uJlWIWUwMgQDwM98oivn4 XXgLYpTkXyDtnRTszctePc4PG7VhC3FBfUghJBYWIg25xzsraw/ZOaw2DkkiguzLuUPt RiVn/DqOsR0UVFA+18gfFzT5LFAKyIV0nhywKjCQMsWZ0+U9ueVz8KyQ4615pOcdGDI7 XsIzSrqBf/XzUBzAWJKwJTmF1Xekl/k3vPOdZxWdUbUA10OAk5u0FKVwhjF8Ki5qEt7l uW/w== 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=MR0PfYx22ke+kh/lxH00XljqzBmM0dQBgyVIJd3ubUI=; b=PINoqTpy4zx1W0U9BQrWSjnNgtnsUjdCWzVREtHBWgbUWfATYehDBa8ZgfDt/fN6LS loNmSLbQWKm2bJ7mBi7bvn7nhKB2eD8jULntmtPXDE1xAP2sZGETSCWlHtY4umW7ffxM A7ypbKgVtdnCtzXnEp0qbhIM+4lJ8KJkInw6t6SuSRDdnbQDeo2XTbC1l5x2zc16R8PH B6eyBIrISIdZDnUgAyz4nv0AazjTN7nX63MvAYLwjFhJsUo60C2FkQDCCswb65zmlkoo pzubQ9fNLSDHqrbwPv//VfxFBLGNaEF3BoLRe8PiBpvnTc73LASl/yTxOYdxZLm8TIsz GBMQ== X-Gm-Message-State: AOAM530ZKn2V56SA15b9plp+LR3WByKLN0+Rd1i0LoN0vpyakeYCn5jE 08fb714Zac92jZ+guCeZGRXn2A== X-Received: by 2002:a2e:8782:: with SMTP id n2mr20157642lji.177.1632610910343; Sat, 25 Sep 2021 16:01:50 -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 d27sm1448111ljo.119.2021.09.25.16.01.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 16:01:50 -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 v7] net: dsa: rtl8366rb: Support bridge offloading Date: Sun, 26 Sep 2021 00:59:24 +0200 Message-Id: <20210925225929.2082046-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925225929.2082046-1-linus.walleij@linaro.org> References: <20210925225929.2082046-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: Vladimir Oltean Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Signed-off-by: DENG Qingfang Signed-off-by: Linus Walleij --- ChangeLog v6->v7: - Collect Vladimir's review tag. 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 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 22:59:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514631 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2775896jao; Sat, 25 Sep 2021 16:01:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZ6g6WyEohqUWlp70FUi/zysmyDlPhEzmyw/TmijG44AnMVyP9/ATseeiu3cctIrHl2YQJ X-Received: by 2002:a05:6e02:1a6b:: with SMTP id w11mr14141173ilv.21.1632610916498; Sat, 25 Sep 2021 16:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632610916; cv=none; d=google.com; s=arc-20160816; b=QR/Yk4A5+UxtGGr7xAX4VonwAYO5sItutn3d6oMmrhvYtG83m6tEy/yN1H7uEYSW/e 7ogf9p95uN9ypKpybpx+UfEeI/gei+XP9VTPo2SoYwOgssldx/v/5IOgo87MV9tattn9 DYhNFixF97Xz+TcrNzjxMtGsQv5HSvMwEiSCAyvoUQx0LC1/nJp0Oae0WvC4zQTk+d95 07smQ3DjrZ6weQaSMIN/oHEFI6VX80DVSPkKHK1d/V9dOkO0Mc7XGdq0tkUSAmliVfLX YjEEhE9mHdds69zeLZjMkzyYFBain9F9dX6AFkkc0rBcaMuXEhBwcvUqfX24ttepmWoS +YCA== 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=Am2nspigH+pLh8OOda+Rspcz6sX8DsgevaljawbRmuw=; b=1K/YlD4rM6TgD+unkU2TN81PIygSLP2SnYG+ErMkKi39QbZaYjetYgsEy7oDFf/89B rgEG4MCVDuxKQJouik+DeklWOYu3wDzF7rKXtfH9LJsJcw50YsSjCCQ6J1rQhxv8opyz sdwRh+WaXWW6dP2Pgz0KzWdNWzAalnboTJUYZrX/eI4wrEqk3t1oVksl/J/C4t71j7uw 6gMYGtf8rq6E5X4Xma4Z/Zy4JKtmm+eo8myd1jfjGHZbRci4E/dyZ6KsW6kV5Jy/pGF+ pSZ7r5G4F0/szuX47E9TIywc9cTK8JwmWruZie8PVJGi1nbnxRtWS7l0oBe158jB06J0 as5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zAGG3LJn; 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 s9si15087247jat.70.2021.09.25.16.01.56; Sat, 25 Sep 2021 16:01:56 -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=zAGG3LJn; 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 S230190AbhIYXDa (ORCPT + 8 others); Sat, 25 Sep 2021 19:03:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45056 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230078AbhIYXD3 (ORCPT ); Sat, 25 Sep 2021 19:03:29 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B089C061570 for ; Sat, 25 Sep 2021 16:01:54 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id i4so57556253lfv.4 for ; Sat, 25 Sep 2021 16:01:54 -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=Am2nspigH+pLh8OOda+Rspcz6sX8DsgevaljawbRmuw=; b=zAGG3LJnUT375BrHUuZP4ngHaDe1tQJCk4GGTN/aSc9FLdjF+sD5colknALEbf0LEq R2d4JnODHSlUtH39uKBbd1oPNA43mZW4+B+MQCgF2Dlc0AjjsjvwU9wOHzGsABAkzcpg er7uztfF7+OvbrE0i1pFpRtjC44oKyXruIq082CvELDfNdllPB3j0eJZ+0DDeVrE59ap OwbnupjAK48GGLsy7V3mJdJAYEW6j+1QgDidijjRqN0xMVMVsA9hdQeEsFlK2pVzWMOz ceMyKgV7AbUrQtHWJzNsCBlT3yXDSY4ZAEiI1eXEkNo1PhtWDcoT7vVqjupZZPKtvTot UURg== 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=Am2nspigH+pLh8OOda+Rspcz6sX8DsgevaljawbRmuw=; b=zc7PN0Aq1HfbxgA0tid7doWcP4+NoxeBZ8QmNUB7UbO3CxUttBkG/sTDf2Dhxip7ze Ka6FWHuoIDxxNNvjnBbubQRZCPS7yAQLU6FXZbYBxdYvFhQ/IYDfcrI8Jpi64XvHx5vF bIFD9yS634u4AOY6wrzuKzzOM/qsZekvNpgmo1nFihtJQX7RFPIXYyzymqu2T1G5jMP1 lFfTTwzzQPvj0sn8uWMTbaRxbHZvVskPmwui3Qp9/KVIoltU4fRXy8Zifvdftfgo8hYY f3jMHOFrzW8N1RR3ulwA7PaevAyNfNhE5xEJvFIuFQJ5KVQHVLxAUirej1Yzo/682axb fNrw== X-Gm-Message-State: AOAM531wUTX7C+Rfq3uMVjAFeaGZOjZ57oZuSZOenksVY5504tmzZlu4 Q4C/5TUPCZEcniTQKAq5s6J20x1XJEQKCQ== X-Received: by 2002:a05:6512:12d6:: with SMTP id p22mr16853515lfg.42.1632610911929; Sat, 25 Sep 2021 16:01:51 -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 d27sm1448111ljo.119.2021.09.25.16.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 16:01:51 -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 v7] net: dsa: rtl8366: Drop custom VLAN set-up Date: Sun, 26 Sep 2021 00:59:25 +0200 Message-Id: <20210925225929.2082046-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925225929.2082046-1-linus.walleij@linaro.org> References: <20210925225929.2082046-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 v6->v7: - No changes just resending with the rest of the patches. 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 22:59:26 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514632 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2775909jao; Sat, 25 Sep 2021 16:01:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtjeGbxyZPyR2JsoM4yvVDYLCcUQNV0+YMlLZnGf+GlTj+NbABsHRmmQG4gcb4EL9eQjRb X-Received: by 2002:a5e:de4b:: with SMTP id e11mr8854808ioq.188.1632610917722; Sat, 25 Sep 2021 16:01:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632610917; cv=none; d=google.com; s=arc-20160816; b=RRmyrgad4m2pOAL7IIiJKR793Y1HW9NhXLJybJuCKX6nfJeqVX0gu5zl/DYq5lwHeP ish3B0pBsKUQTot5Rm4dfzBR3914V/8N52VPzh44eeCK8iKRgpAyAwcqfPsL+391wTCQ gTDY6PFVmBDWq7NZUjR3A3MIhTeAZyA/0FtBSXJOW6pQK4LKr8zPfvCzN3N+4HNcZ+xz +o6nscTtrpMlsjqiO2L2ZSd/ShOSnPINxJBX7nUjqtGXBkNtTU+IVWPjI4qM9ik4BxW5 vFSecoQ0QW9buK/WT9h+lb9ADqvLQaCiQBALmEIzMGRp7qiHdZFRCX1vtxNmzA+agrOl 3e9g== 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=sKDUssqVz+/qoJsjXpg0QPpUeBEW2l8CI8Pyxj6n6bA=; b=BM+VM4hAbO03eJtMWe6iyYkAu8wQdm3G4ypKy0rEYyvl4N6PeUljUAoOo8g+G1oVRb guPerqc6vzpQQr9xApoSvN/vcGHiHr8xYwjqHazxqeyXO2gN/aWtRi5bspRwCu5Fgglh XnW1eqPFsZ5y+G4/AXhN09ErJMxLnGFiQcF2jVLL7AwBP5ZkeLVlSbhUlKHIhPNA4BZP XFNceh9PvaQugGtnjkO+VNWP6XyJ9YjUOVqr9eEfaIRWimFCY/pnElUNuIOuLAPAH1qa r/pDNOHLrBePuYP1vqZC/c1QQ8LOyZ2ZhGn7DgleiXG9UQKoK52WdBIiwkgwzvy8FcME 5klw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XWZuyzqQ; 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 r17si20127962iov.104.2021.09.25.16.01.57; Sat, 25 Sep 2021 16:01:57 -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=XWZuyzqQ; 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 S230196AbhIYXDb (ORCPT + 8 others); Sat, 25 Sep 2021 19:03:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbhIYXDa (ORCPT ); Sat, 25 Sep 2021 19:03: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 1AB79C061570 for ; Sat, 25 Sep 2021 16:01:55 -0700 (PDT) Received: by mail-lf1-x129.google.com with SMTP id y26so18089573lfa.11 for ; Sat, 25 Sep 2021 16:01:55 -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=sKDUssqVz+/qoJsjXpg0QPpUeBEW2l8CI8Pyxj6n6bA=; b=XWZuyzqQU26EUYd9hYMXFPSF5AA/HhkeSjdzdENcUbFz1xidlYNTY33a444yBx7EFf O8+uEcctzrQlv/Awb1wSeKH/o3u6ylsXy5tvCrhYZerDkGEYyIwkZu+sVkrcc+wS3TaH Jh42hoHD2qS31/7zPht96WXsfst4eM1SNLqI2AGffrefZ5uIoOiwKMWdWBY901C1KHg3 ++KTKD1kvv9HsVHSpoodyR0R7m06xLWMVX1nJkqAbdTd+JUgj6+3O8vx0dWm65zjFzaJ oUPXcKsppeVwNV0nayByqh8FAnd3nJKsjbNVro4iCuEidczqeVZDDoFZjb5DSPzPPTsQ svFw== 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=sKDUssqVz+/qoJsjXpg0QPpUeBEW2l8CI8Pyxj6n6bA=; b=HG9fe9XerUJpLhDeTrCFxMXciJpnp6K1e6oYX4FHIx+xpJ2IZ6TMRRD9jBAjHflDSH 40+RCDft2O0/0PB0nb0fxrUJ14MGVGcwWS12GIMSJv08asLmo8PKmjLz0/P99qUM8O+L M7nWc7LPH1lM0yFNFkptgadRW+Bj4d83jBDHnRLzGTFiqRIOuz7EDKfYolUdBs7Tx6BB IoqF5doMIZEjMWFfKsTz7zFKLhZMgZssDL4Zzjh+4vTOJMo2NnLStnaWhi2ViM+xOKfS DTt9Lklx2ghOPgnG0S769ZusV5cX2JV49qIZ/6hnb/vJa54el5uO8S4uk+J2ruY+RiQ0 TH0Q== X-Gm-Message-State: AOAM533SNw1Yw+f6aELP0kzWS3eMUZ9yJZpvHRUW6iT5rxY4xKBLWjul fpWeFagjCJ0wexns1V4XgEMStw== X-Received: by 2002:a2e:1508:: with SMTP id s8mr19464157ljd.47.1632610913467; Sat, 25 Sep 2021 16:01:53 -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 d27sm1448111ljo.119.2021.09.25.16.01.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 16:01:53 -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 v7] net: dsa: rtl8366rb: Rewrite weird VLAN filering enablement Date: Sun, 26 Sep 2021 00:59:26 +0200 Message-Id: <20210925225929.2082046-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925225929.2082046-1-linus.walleij@linaro.org> References: <20210925225929.2082046-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. The DSA documentation Documentation/networking/switchdev.rst states: When the bridge has VLAN filtering enabled and a PVID is not configured on the ingress port, untagged and 802.1p tagged packets must be dropped. When the bridge has VLAN filtering enabled and a PVID exists on the ingress port, untagged and priority-tagged packets must be accepted and forwarded according to the bridge's port membership of the PVID VLAN. When the bridge has VLAN filtering disabled, the presence/lack of a PVID should not influence the packet forwarding decision. To comply with this, we add two arrays of bool in the RTL8366RB state that keeps track of if filtering and PVID is enabled or not for each port. We then add code such that whenever filtering or PVID changes, we update the filter according to the specification. Cc: Vladimir Oltean Cc: Mauri Sandberg Cc: Alvin Šipraga Cc: Florian Fainelli Cc: DENG Qingfang Signed-off-by: Linus Walleij --- ChangeLog v6->v7: - Add comments to the register definitions. - Rewrite the code to keep track on whether filtering and PVID is enabled on each port, and use this information to selectively drop untagged and C-tagged (802.1p) frames. - Add a hook in the PVID setup to always check the filtering of untagged and C-tagged frames when changing the PVID setting. 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 | 102 +++++++++++++++++++++++++++-- 3 files changed, 95 insertions(+), 44 deletions(-) -- 2.31.1 Reviewed-by: Alvin Šipraga 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..01d794f94156 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -143,6 +143,21 @@ #define RTL8366RB_PHY_NO_OFFSET 9 #define RTL8366RB_PHY_NO_MASK (0x1f << 9) +/* VLAN Ingress Control Register 1, one bit per port. + * bit 0 .. 5 will make the switch drop ingress frames without + * VID such as untagged or priority-tagged frames for respective + * port. + * bit 6 .. 11 will make the switch drop ingress frames carrying + * a C-tag with VID != 0 for respective port. + */ +#define RTL8366RB_VLAN_INGRESS_CTRL1_REG 0x037E +#define RTL8366RB_VLAN_INGRESS_CTRL1_DROP(port) (BIT((port)) | BIT((port) + 6)) + +/* VLAN Ingress Control Register 2, one bit per port. + * bit0 .. bit5 will make the switch drop all ingress frames with + * a VLAN classification that does not include the port is in its + * member set. + */ #define RTL8366RB_VLAN_INGRESS_CTRL2_REG 0x037f /* LED control registers */ @@ -321,9 +336,13 @@ /** * struct rtl8366rb - RTL8366RB-specific data * @max_mtu: per-port max MTU setting + * @pvid_enabled: if PVID is set for respective port + * @vlan_filtering: if VLAN filtering is enabled for respective port */ struct rtl8366rb { unsigned int max_mtu[RTL8366RB_NUM_PORTS]; + bool pvid_enabled[RTL8366RB_NUM_PORTS]; + bool vlan_filtering[RTL8366RB_NUM_PORTS]; }; static struct rtl8366_mib_counter rtl8366rb_mib_counters[] = { @@ -933,11 +952,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 +1230,53 @@ rtl8366rb_port_bridge_leave(struct dsa_switch *ds, int port, RTL8366RB_PORT_ISO_PORTS(port_bitmap), 0); } +/** + * rtl8366rb_drop_untagged() - make the switch drop untagged and C-tagged frames + * @smi: SMI state container + * @port: the port to drop untagged and C-tagged frames on + * @drop: whether to drop or pass untagged and C-tagged frames + */ +static int rtl8366rb_drop_untagged(struct realtek_smi *smi, int port, bool drop) +{ + return regmap_update_bits(smi->map, RTL8366RB_VLAN_INGRESS_CTRL1_REG, + RTL8366RB_VLAN_INGRESS_CTRL1_DROP(port), + drop ? RTL8366RB_VLAN_INGRESS_CTRL1_DROP(port) : 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; + struct rtl8366rb *rb; + int ret; + + rb = smi->chip_data; + + 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 */ + ret = regmap_update_bits(smi->map, RTL8366RB_VLAN_INGRESS_CTRL2_REG, + BIT(port), vlan_filtering ? BIT(port) : 0); + if (ret) + return ret; + + /* Keep track if filtering is enabled on each port */ + rb->vlan_filtering[port] = vlan_filtering; + + /* If VLAN filtering is enabled and PVID is also enabled, we must + * not drop any untagged or C-tagged frames. If we turn off VLAN + * filtering on a port, we need ti accept any frames. + */ + if (vlan_filtering) + ret = rtl8366rb_drop_untagged(smi, port, !rb->pvid_enabled[port]); + else + ret = rtl8366rb_drop_untagged(smi, port, false); + + return ret; +} + static int rtl8366rb_change_mtu(struct dsa_switch *ds, int port, int new_mtu) { struct realtek_smi *smi = ds->priv; @@ -1420,14 +1488,34 @@ static int rtl8366rb_get_mc_index(struct realtek_smi *smi, int port, int *val) static int rtl8366rb_set_mc_index(struct realtek_smi *smi, int port, int index) { + struct rtl8366rb *rb; + bool pvid_enabled; + int ret; + + rb = smi->chip_data; + pvid_enabled = !!index; + if (port >= smi->num_ports || index >= RTL8366RB_NUM_VLANS) return -EINVAL; - return regmap_update_bits(smi->map, RTL8366RB_PORT_VLAN_CTRL_REG(port), + ret = regmap_update_bits(smi->map, RTL8366RB_PORT_VLAN_CTRL_REG(port), RTL8366RB_PORT_VLAN_CTRL_MASK << RTL8366RB_PORT_VLAN_CTRL_SHIFT(port), (index & RTL8366RB_PORT_VLAN_CTRL_MASK) << RTL8366RB_PORT_VLAN_CTRL_SHIFT(port)); + if (ret) + return ret; + + rb->pvid_enabled[port] = pvid_enabled; + + /* If VLAN filtering is enabled and PVID is also enabled, we must + * not drop any untagged or C-tagged frames. Make sure to update the + * filtering setting. + */ + if (rb->vlan_filtering[port]) + ret = rtl8366rb_drop_untagged(smi, port, !pvid_enabled); + + return ret; } static bool rtl8366rb_is_vlan_valid(struct realtek_smi *smi, unsigned int vlan) @@ -1437,7 +1525,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 +1682,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 22:59:27 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514633 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2775944jao; Sat, 25 Sep 2021 16:02:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwUFY4U2B9iMJsmh9vI3gRn5x0osEQ47+KbVP03vspcUKWaj+9w4Skw+UwNOSBJAjHCBuLu X-Received: by 2002:a6b:5f10:: with SMTP id t16mr14390483iob.183.1632610920468; Sat, 25 Sep 2021 16:02:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632610920; cv=none; d=google.com; s=arc-20160816; b=k1T+ywif3TLuKlP8zRxOP19MfrWeeG0mcsELx+G989DXhHLExCGIa4ck69Cx3IOPRu KhwiR8+U08E5Z76r11GYPwN3Nkp2DrTFsv5GbPBh6h5AJ6tFwvD+fQb2AwZRt4u6k+Kh ya6QDmRvZxDGyh6fjupYXCfI55c5MfmJP5tVYmLkBwPcWX28F4eymGsO9kGWs1hdTKUl VGoKbez4KMHJWmPB4ERUpSM+3Ejr6yfEwx+ulbYjBnGesT8hI8fUZt/Q75fGgrk1gS/U Z50UsbEn/5YIlFl4LOpQZgZDWirETzZtcCGol3AribKXvRiNK2BlQxoacT9vUTqJ0lj9 hY5Q== 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=i0sY75wD5swGSqNDlKhqp58pnTCdqC44xbx+KZQkxwI=; b=T821XyJwIV0b1fG98wk1+a+sDM5lRGEgTqi7cNPB/eyeTGAjFmBAWKCNk+1gYnT0Lq GHYoTxJKbGZV1VzZ1wtCsjTGWkyUHF1L54Q5D42WjNf+CzZG/bsB8gbysChmNfBi4Rit N7QwjUOrFP8/R1/mJvL4YuDFhmn2oVJQceynQOkv5C56LwMNh0c64k666AmM6NXU2Ty3 z4B5ZlSpieyNUOEMnTuBw0S/InYlFJl3DvMU9YHKRqejnSbexdRoADR8iOwAFA2DbUCE JDloS4rkHHS5bexEivwpm3Nyxe02kO0QC7kChG2k6yrC2W0BXFIYdKEnAwbZKUOrD1Wk Z1/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XJDyVlEv; 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 r17si20127962iov.104.2021.09.25.16.02.00; Sat, 25 Sep 2021 16:02:00 -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=XJDyVlEv; 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 S230211AbhIYXDe (ORCPT + 8 others); Sat, 25 Sep 2021 19:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230197AbhIYXDb (ORCPT ); Sat, 25 Sep 2021 19:03:31 -0400 Received: from mail-lf1-x12b.google.com (mail-lf1-x12b.google.com [IPv6:2a00:1450:4864:20::12b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A10BC061570 for ; Sat, 25 Sep 2021 16:01:56 -0700 (PDT) Received: by mail-lf1-x12b.google.com with SMTP id g41so57391050lfv.1 for ; Sat, 25 Sep 2021 16:01:56 -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=i0sY75wD5swGSqNDlKhqp58pnTCdqC44xbx+KZQkxwI=; b=XJDyVlEvQtS3bTaTYnHTNV+c/AP+9HBH4i4eW/2ugIV6KB4vvSIhBtpHFweXxanl4b MEY4t0++ZrUugHlqkTOe3AHLDr34WK/vZVxS7qrAyE6QLQJ42edFlkqfh4J9Iwzem/q9 QuugkwMkVsfuXSUWu0NwsWv2VqP6AdYWip1guzDfvdFtjV4/Q6RUatInvVCldzvKHZuZ E2aVHU669MHvQ7hg7+RGLQwT3jKXvERB3CtrIwCPCq0CGteCrBEjHB/xKCTAX6BHRY2K 8qm2/R6KJJICDaTNNbAhow5t3+1CnIluwzfVzz5hboMbuAxOEoby+RbEQ4aMXRqUEJ9O fXeg== 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=i0sY75wD5swGSqNDlKhqp58pnTCdqC44xbx+KZQkxwI=; b=v/k8debNIXxPG+2HcgzEdhTQPasXl6pnvnuxq2Rwf6pYsg7jTFI/fS028BF4cCG6X3 3SybET1aegDPZWy9Qm7NA3q59OnPhfXCHXqR0hJEMkqtEcMXLyDf/Ki+sCALg8uT8XWh +7ixd3PBudq6WwF6fMChRyI4N/hjOpm2rUheH3Wa/PU74Ccfw6Cv48oGJRYZJj97XUrp L/4/LWBF2gk97x9R25rQrfNZujjHDfo/OcPRQt2K8KTMkTynmo4RyTs37MoFF1UoBkk2 WWCteGPAdULhk9JTxhadxjdEVtNm5Cr4R6A3aWvAnLzxrB3yY5FIgnOq7lqRtWzDcab+ SXAw== X-Gm-Message-State: AOAM530tJArGKlouM/gNg1SPOCqohCxTIkjnayiosJWRFsyQJdLk2Ab5 9dseMawZGkhDiQcBw3nRPLSfow== X-Received: by 2002:a05:6512:3f1b:: with SMTP id y27mr14388488lfa.606.1632610914838; Sat, 25 Sep 2021 16:01:54 -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 d27sm1448111ljo.119.2021.09.25.16.01.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 16:01:54 -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 4/6 v7] net: dsa: rtl8366rb: Fix off-by-one bug Date: Sun, 26 Sep 2021 00:59:27 +0200 Message-Id: <20210925225929.2082046-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925225929.2082046-1-linus.walleij@linaro.org> References: <20210925225929.2082046-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: Mauri Sandberg Cc: DENG Qingfang Cc: Florian Fainelli Reviewed-by: Alvin Šipraga Reviewed-by: Vladimir Oltean Signed-off-by: Linus Walleij --- ChangeLog v6->v7: - Collect Alvin's and Vladimir's review tags. 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: Florian Fainelli diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index 01d794f94156..6382404814c3 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -1520,7 +1520,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 22:59:28 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514634 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2775972jao; Sat, 25 Sep 2021 16:02:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwaPoN60LubtpXlmQuqM1D7WqTIX+/+VOCreuAVxUsne+fe2V/+7S3IlgR0PKBfDm2eA1BK X-Received: by 2002:a6b:7016:: with SMTP id l22mr14748034ioc.48.1632610923223; Sat, 25 Sep 2021 16:02:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632610923; cv=none; d=google.com; s=arc-20160816; b=hycNssnCArkJkoy5f04zvp34LUL40mOAHJTqCB8hvnOOb5YTykjVqi3CVPx7rs4uL7 GwAP2TQEZTBAt/tBbx+ZkThzrmkS+LrB/Hifw4tCxzty+dSemKjhSKjPclp6oqswv1UV VYAhUWhQ7qHom92MbOvWsmPwcFWVc9f42RUlKQELS0OMJA6RTf85vKGTPIEdx9bX4gay W0tF7c/8MyTMkoHiT2Ydi4utPQRofr4ury/fYwfcYflNcatr/6i7BRBdESEMNm2vsR+U WJeBO0Lh4ykJ3xvZd097vsQOzQQlV7t/Z0ctoCl0qLgf6+7E6sPtER/3sG5aWSznzvQE /V8w== 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=aEbVU1x57FyQIizkQNokEr+/kzDXEj5p9oOADNfgO3o=; b=CeCsHnskk5BIUYE5n0l8Hm+1O11GkhLS+0bO0pv0giimzauZ+PLAW2MZpoIKDMbj9E Kc0oykcMrlc0NwY/QKjcaqRfOUw/977NYNbOpJkFzrYqPaLwiKgc1K9i9UT0SFRtpu1/ aEmC0kHd/pqTUTE4gyRRodZvMi2oCcJdXk2kbPU3kH7XyqWCRY7UBZK3cN/pqTS2d2Sa G8W/l/VuOifY/gLU6upT1pgIJJkF++RQq6lQcEEs7bJSaUhf7R8wNlrQ7EfBW4hATmgS etvEMBrxZW2wq7t7RDPaTbvKfyF6XD/DBrPZWi/13p+pE59/gxKMwsV/oCEgNkqreY+V dysA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zX1p4w34; 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 r17si20127962iov.104.2021.09.25.16.02.03; Sat, 25 Sep 2021 16:02:03 -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=zX1p4w34; 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 S230222AbhIYXDh (ORCPT + 8 others); Sat, 25 Sep 2021 19:03:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230207AbhIYXDd (ORCPT ); Sat, 25 Sep 2021 19:03:33 -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 1B656C061740 for ; Sat, 25 Sep 2021 16:01:58 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id u8so56650933lff.9 for ; Sat, 25 Sep 2021 16:01:57 -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=aEbVU1x57FyQIizkQNokEr+/kzDXEj5p9oOADNfgO3o=; b=zX1p4w34JlmsFP7th4iRnPU5Y4gl28/MSTRDbgahObrRZfeFcQyp6Cun1uLuL7ZRgh XbJxbpvTZbZnEIWY2HFP6Zzz9vUzAvofY1tFRt+RfmKRoyKQ0iLkq/Z+8P6QemaaNZ3X mWkgtzYUu6QeHzDBEH5rX8foGmgnIB11UFOq9eTIHts7uxVfwnH1X4zuMzPWkFRgGu+H aUCobVYvXUp/q2qc2xp7IcfhexaHR+4Zj3RuvMrOOMS1L400UjzM1HnPQr8ZCdJiJ4ks 6ZMelXBsdiApbiXWc4nQVTuLLbPrC3kDNXv1xSeSQGJfHFrwadRiPGe67br4+YMMQ1up VPUA== 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=aEbVU1x57FyQIizkQNokEr+/kzDXEj5p9oOADNfgO3o=; b=1T+wo85zg/E+3matGmqU8QBLe5jBv1F3csZIN/B5gpUgQdPPyVCgsWS0KNkVbbJvK7 OQfX+5++RqzCX4C6PXh4c7rwlz0Rmu2poAHtNajl2a6fVGHS2MHiN/RNcA8y5VS8uEFD NQtXE38DjGrWxKtDn4sj0cJT8Uvn1+NVbOMMX7qhrBPJwTy7g5wjIP+KP82HOEzLlLQI PwNhgynN8TrW8njbrX9ncbKYRDeknjUvB+HNrHpMI28QzKgVToGVpAt0pgrCpleXCjjA 7jq6hoMqLckHtN6MKU18ubfuBxse7nDoypPYUbwyWG3EgczURUsLLGjKynj93yCwxuD9 4rTw== X-Gm-Message-State: AOAM533DWkKwABE0DoOFBmmvw4HATpp+fOv9rdYI2oacSDnDRjpLF4D7 RYySW17NvdcjCt3OvE1UOMPaQg== X-Received: by 2002:ac2:5e23:: with SMTP id o3mr16860180lfg.352.1632610916457; Sat, 25 Sep 2021 16:01:56 -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 d27sm1448111ljo.119.2021.09.25.16.01.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 16:01:56 -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 5/6 v7] net: dsa: rtl8366: Fix a bug in deleting VLANs Date: Sun, 26 Sep 2021 00:59:28 +0200 Message-Id: <20210925225929.2082046-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925225929.2082046-1-linus.walleij@linaro.org> References: <20210925225929.2082046-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: Mauri Sandberg Cc: DENG Qingfang Reviewed-by: Alvin Šipraga Reviewed-by: Vladimir Oltean Reviewed-by: Florian Fainelli Signed-off-by: Linus Walleij --- ChangeLog v6->v7: - Collect Alvin's and Vladimir's review tags. 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 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 22:59:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514635 Delivered-To: patch@linaro.org Received: by 2002:a02:c816:0:0:0:0:0 with SMTP id p22csp2776013jao; Sat, 25 Sep 2021 16:02:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx6qjq0g5F97Sg5VQRcO4vQQma8ijOePw9jOvbMxParJKawRRzn7RSHIM3mYhZ0yjDOGfRV X-Received: by 2002:a5e:c110:: with SMTP id v16mr14939987iol.43.1632610925888; Sat, 25 Sep 2021 16:02:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632610925; cv=none; d=google.com; s=arc-20160816; b=aw1lbTPgTxoxx+P54/9SwuPT1fAGkN8wjXTEQ3MKK460Wj8YPWAtrYX+D59ex4Kium 0VlNSletj86bu+4Mtah66PLPg5OJUCvctSE4ZowYTDJoKx74pe5OSlNlFISDwwa0hlzl FAEHzj9WlQHzXPHA8KRyuE9D+hW/fTOa/ppIpSM8827dif7/DFgFGR0e+UoMxlfY31rD 0ACkxCWfJayhPTmwwsfn3VetyHUW5ycid5OYsr88sjB5HqjPz0+qvK4G/ruvM6IRIdKx wWuHgtT8lOI47OIXetYvGeNyyXn+usf9zp/3W0fofyDOHzwPCAPq7mHA9LHTdC4xaKyt mZGg== 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=6VfYsnn3GVcEaA6EHi8p6QPzT7sjqJpMMo1EYwRS950=; b=BKITeJlV3r448WQkuD+d/DH4fXMu9Cl85FYWKqokWtxL2F4Z7K9rrOxsAfzk5A+8CT Ckyp2G3p6/WvJvjUGwbWKKzFMQgKJrHufdsn/cXRs5a7d2GwI3L7480LSASISGO96Vso 3oBF1ffQBfLXMI4CtoZG4VOXsyLROHocVQrTuJNpc8Y+GJpfVz9Q3NkjWeNh/FPeXcnF ZTSFhvJSXRK/sIyfdNYvYvnaCh3xUIuqQ9cOhBDjN3ltsuh+VHpZ/hxJBKSBPmB3Wma8 TrMcZdfWByKvBv9YcYE7arU4E4Z4yYn1DYM5L8LpasnVxYSbqNik44bGMoLJFD1r6HW+ kjEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=awT1mbns; 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 r17si20127962iov.104.2021.09.25.16.02.05; Sat, 25 Sep 2021 16:02:05 -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=awT1mbns; 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 S230227AbhIYXDk (ORCPT + 8 others); Sat, 25 Sep 2021 19:03:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45110 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230191AbhIYXDf (ORCPT ); Sat, 25 Sep 2021 19:03:35 -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 56B69C06176A for ; Sat, 25 Sep 2021 16:01:59 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id u8so56651041lff.9 for ; Sat, 25 Sep 2021 16:01:59 -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=6VfYsnn3GVcEaA6EHi8p6QPzT7sjqJpMMo1EYwRS950=; b=awT1mbnsCgJ6bB5yjKJgluu4r6q60V3FyC0vDLcXG6atpwJylnvWFnqIwWnC11k/JC E4b6+v5mC2wDaFROYCO6ou/NUT4HVeHcgD4dIMxJY9Y0lNSUgXwmU7oHdcN20Q08Q3z8 gXVECa38nydF5oVExrwliDRPCem0dEJhi0rQO2kplwEQi5s8S+bg/WsHtqPBJb1QqSoe VdZ0S8fk+fsPOyK83ClPCfbP2nZPQZLUM2OEMO1MgoBo5D4S3h/oBnfq0Umul4GIsRKO MLAd+gn61diHU7IWykhI6WP0Iw891Bc7E5RvbjfNHGjxy/HLwXvYiUHDGYnK0W96Luk2 h9TA== 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=6VfYsnn3GVcEaA6EHi8p6QPzT7sjqJpMMo1EYwRS950=; b=f6cCR7uwu8M7ShEHpkoUiyoQaYtL9F7A2Dr4QpDv7DEu4A89boSWWDVxhVKEcEpFR9 HmiU2i/JkRE0pTBT+IMd+nZt9/ImSCgfoqcJVdFjofRBq7pNVoWj1NhCgojOmMVn3PCf pq7THtkqL5O1BA/50v+4lfZH0U7QEbyUyjNrvmueIdqtYoVlYVsb3WeB6F9r+YWzmQBL h8hmlPxf/Z+m2ytnETKOLsAaOg7JylGQ7VUXgZRuINiy21feL8EBzr8GfO4/c3GNB5M8 gW2KjyyuSMYIwd6UF+dOvUgV4ckGfO2rHRtbwpU/Gnh7PJZlR3HudFFclOomJUZas/xH 9XCQ== X-Gm-Message-State: AOAM530uFAAV1X6Qz9vTPzVkCFCOxc7VQMSJ0+Yub8HwGkkL9GCtQzxk e/3sIYvZWf5RD9J794FKF2HhSg== X-Received: by 2002:ac2:4d48:: with SMTP id 8mr16221343lfp.394.1632610917748; Sat, 25 Sep 2021 16:01:57 -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 d27sm1448111ljo.119.2021.09.25.16.01.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Sep 2021 16:01:57 -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 6/6 v7] net: dsa: rtl8366: Drop and depromote pointless prints Date: Sun, 26 Sep 2021 00:59:29 +0200 Message-Id: <20210925225929.2082046-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210925225929.2082046-1-linus.walleij@linaro.org> References: <20210925225929.2082046-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: DENG Qingfang Reviewed-by: Alvin Šipraga Reviewed-by: Florian Fainelli Signed-off-by: Linus Walleij --- ChangeLog v6->v7: - Fix a small whitespace error in one of the debug messages. - Collect Alvin's review tag. 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 diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c index f815cd16ad48..bdb8d8d34880 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;