From patchwork Fri Sep 24 23:36:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 514612 Delivered-To: patch@linaro.org Received: by 2002:a17:906:f46:0:0:0:0 with SMTP id h6csp1777392ejj; Fri, 24 Sep 2021 16:38:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwahtogvmh90/CMHWed04bhgAR8QedQFJqGLg/tXYiFOxIRgYoljYTmzg18Nn/wODPzMX88 X-Received: by 2002:a17:906:fc7:: with SMTP id c7mr14584958ejk.333.1632526733648; Fri, 24 Sep 2021 16:38:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632526733; cv=none; d=google.com; s=arc-20160816; b=JhkY1yIdRmvrdgtbXY2/RJ9O1bRJ0muyyrp0gcuc172gUrwUUwbW2YodRoaMTLUpsA z+z+4abHCUGyc3ILTphzPL/ze4uLcwaMT+mEb++fVZCzmquW07Dyl3H4r6eVSXFmSJiG 5AFZ6fLBK3ryG2wxKU+ArYLRCE0KeJlhGShC2e92li99XxPZr1GJuTpjxnNgWaVwDRJs SLKfSfcaaqlKNc3ZnOZEXCcHBr33hKW/GjrVuowl3k3w9uo+u3cVm6q9+UqTpz5IKOlr asXvnCra512CKn/z2rSQ2qaHNRHI7pglhIEt/u8z4/WjpPKw5bBGxeDOiS0ESclVwQMd /2Gg== 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=jnT3sJXLA57GZ/AQJZhWi+XbpVu8sqEszBnk3MfHqYw=; b=puJpb9//XX1egO74nast1DVn+bpcOAqC8fxTTcTuUlMuQLAsLNRoLKxC5qWHLB5Dn4 UFgqTAh1xFkdAC7whh2a9cLaFbNWcOlJWifoqvVQFdE6Mder8dOuHbRDsRhJSQ6Uent4 QX6DNrY1rq61F6a0BQMntQUEXtvNFBJo78A7TzNH3GKCegDY103BGpcu9TmOOqeCtf1W PZRrSX8icNo0uyoEHANU9aFS93zSlFibouYPcCXaZ62hXdGPmtyMKmaBfUBAGeRyQ8z5 nAD4oSem9b79sOwAdol/Pq+qY9Wkj8EYCjRyvjbdvGsOu9i5g2EWmKJn4MIPxVRiw3AO tjuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=N9KaThGn; 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 a11si10803843edx.158.2021.09.24.16.38.53; Fri, 24 Sep 2021 16:38:53 -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=N9KaThGn; 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 S230303AbhIXXk0 (ORCPT + 8 others); Fri, 24 Sep 2021 19:40:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51582 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245038AbhIXXkZ (ORCPT ); Fri, 24 Sep 2021 19:40:25 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 941F4C061571 for ; Fri, 24 Sep 2021 16:38:51 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id y28so46385668lfb.0 for ; Fri, 24 Sep 2021 16:38: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=jnT3sJXLA57GZ/AQJZhWi+XbpVu8sqEszBnk3MfHqYw=; b=N9KaThGn050IWLOTn66Xm2lRr5ap3DTFLn0IKfXqELLK6pL788ReLU7AhgNq/fxoG/ fM/LDX7dpHk0SP+IQwE8Wp2bEbdS+uifcgzkrKooikYCQJ99GpEInsjblxRls+yU1Xql VLBq7rAdFgWIimTayIrndpFJzzY8yGgfkfWMG9pHsiCZ5rk+c9SbZw1ed7GjtErfEoET EemczMimWqxTKj0L7/W4m4a+o81qbe2XzJDC8efrOxIEILIR7f5P/fohGmwFmWThyAeq 8llTJbFfOBXEy83/+Uy4+4paytvsVK5qO25fbBwAdh3pf2vshTdH2RvpgChlmlJaFDbg 4T3Q== 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=jnT3sJXLA57GZ/AQJZhWi+XbpVu8sqEszBnk3MfHqYw=; b=AjWae71xihsUMCYfZNrdcZCdDK0WohMqzjm2Jtft4KuwZEerTKyU8HBB5G3OMfTOC9 bRHJDnRZJ5KXLTyCoAhbuQPJAFtMCrx6Ms6/v6mMa4a2SNLhFRwqzlLIRgfGwkKt13au /Dl46zvZSG0XVGQYlCbDLkojcjygXNK9KaXkJrlh7LNIM5p38cTe33hM3rwAdSegmPbq HFl0CxewOnl0KsQox7zpDyIsTwnLrcu+Rrk3KNaV8slBC4+iyLfijn1qyJGlVRPNq6G6 nLBG4lqoui634RpvRoTBJMJ1NHbFbb8tMoW5OHYHOCOc1LE+AfZ6PFJcJq8v6Vv7T+qE R6Lg== X-Gm-Message-State: AOAM531M9cm9j9901DHHhwI71cRz/zAdZShdHU0/jjpz/0WwvQG4jvux LkR2HjQDyHbEkQQidFNXarvtJA== X-Received: by 2002:a2e:87ca:: with SMTP id v10mr13094638ljj.369.1632526729882; Fri, 24 Sep 2021 16:38:49 -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 k21sm1176652lji.81.2021.09.24.16.38.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 16:38:49 -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 v5] net: dsa: rtl8366rb: Support bridge offloading Date: Sat, 25 Sep 2021 01:36:23 +0200 Message-Id: <20210924233628.2016227-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924233628.2016227-1-linus.walleij@linaro.org> References: <20210924233628.2016227-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 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 Fri Sep 24 23:36: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: 514613 Delivered-To: patch@linaro.org Received: by 2002:a17:906:f46:0:0:0:0 with SMTP id h6csp1777455ejj; Fri, 24 Sep 2021 16:39:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQFaaqhma3L71UfzSO4Cs1z6ZLZTQ20LhkD8XzLp5lb1rP9s/kq8FLQklupiM5hNmR0A8/ X-Received: by 2002:aa7:da91:: with SMTP id q17mr8111966eds.276.1632526739967; Fri, 24 Sep 2021 16:38:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632526739; cv=none; d=google.com; s=arc-20160816; b=QUMC0brt5ZVOtEZDRPr8P5qWjJNhGOfqs2lFRyu9QUeblwDqIZ3oQ4JFVPQN53lAZE z60vRpax1yCSWkvb0LERttl9G4spEbWDRE6QwOuMGndwMtEISZuKOdYTcWxpGp1qcJby kG4qiov1KptGoccX2Y93qc5eyM9nw7t28WNILG27SVZBKPnCfyNcigiNczbt0RalEX2a Ljftp9Vq9D+wdSuwdZU5VMajrtZs7kMmrQ9m0DrQWGkNcz8Xpwg7PCMKNpWijEN/j1iy oiUzk2loLLNvDg/imAOC0eYgUheK4nZoF/yZoRb/Tmlc7uzNt/pcktCTGjp+BK4oSrwj Acqg== 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=1ndp/1UpmZSSJkO792vxD6IRr0Ne7P+vQpY+t6aGjlY=; b=MPAj1LwcMVkrm4/ScUZcCt1jgrKYTW+qExHmROT/L/584UvHNDvPd0vshk1Fr6V9zc LWCgv0WFeb4GKd60fIEBs5+uo6uzv0fuE1Aa8EACdm1BhHuMnZ6gVa9APDcYIjL+1Ina uqPOesI5meIkzpIYBXcr8P/AFfoNlcHbPrbncek5BV/W/U8rjcZUOeNQmQJnNZJM9gTJ ucpQ/NNXC3nLLq6DEHueMs9iHZpsrFNS8mhbqtpoD9Xl34yQVqWQn0jRn7yeFx15uX+L B/Uo36ipcyAfmoRpBI+NgI0u3IEZV3FhpzBXymxzdethWkSY4QTsjpWPBNu7TMLGyFQI o5Pg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=zFJJV5FU; 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 a11si10803843edx.158.2021.09.24.16.38.59; Fri, 24 Sep 2021 16:38:59 -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=zFJJV5FU; 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 S1345193AbhIXXkb (ORCPT + 8 others); Fri, 24 Sep 2021 19:40:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51590 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245038AbhIXXk0 (ORCPT ); Fri, 24 Sep 2021 19:40:26 -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 E0675C061571 for ; Fri, 24 Sep 2021 16:38:52 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id y26so7383349lfa.11 for ; Fri, 24 Sep 2021 16:38:52 -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=1ndp/1UpmZSSJkO792vxD6IRr0Ne7P+vQpY+t6aGjlY=; b=zFJJV5FUwPQ7lYQYifECC+qifOaN6x/GcMhftTPVnJ3sUUsZCLGJNpsCyrv7EREPz9 YxWaRBxKAP9iM7aouJcQ2dJXsR32/WD8LKMhwmJvFeKkgKwAjeSya6Y4o3FrHiNgjzFY VjjAG98CA29Szae8azcTdFbJgdQ6wOUcC2P8cbLho5/3yO7r6C1wM7w9QnDtmkTHqcGo sntq2tB55aNGNVycqyeq4cn1Ept4s9wuW9yjGwTPwzG031zVoShVf9GhehJHfcrIrqWM fyZo/D7gZamTPMUFsVTH6jOWfhsfwtkzwZ8BHrJD7WhRm2gPp7UmfPw9hPoRFb/t3MLa 8h+g== 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=1ndp/1UpmZSSJkO792vxD6IRr0Ne7P+vQpY+t6aGjlY=; b=TdriLmuZB4yBQcDomezsu4xly6lCH7geoQtKvwq2EWVQ7z70Ma5nshNQIFiGojlES2 /f10G51p/jT3E7vb25kaU8Q+iewjWXFupah5lCyqNCAnaxKodEJLJ091lh4WSkkIucRg hTmyvOFxRreUwozSgrR8d0CcQpWcL25hYVHtbsOSVuC6ev9+yr//9lLkDOpx7tTkU7L1 KsU2xWV76oVHK6gBhGC2Xx+K9lYDwU8BYnTpHc3Kq8wRJ2Jf9JFaKWMJM9djIsI8kcG7 z+R41CsmKsRSOPQvFKCwlaMzorPi/rI5eHQ9q6vkQmao8eWpTld22Xeup0k52Vlif+NQ lYaA== X-Gm-Message-State: AOAM531JeLBSNp57z9ZXvGFiF6qeIsr0YVjfczIXQ83APKSZekrG+87f QAsKhsr8jWo6VjO16llI9l1pvg== X-Received: by 2002:a2e:974b:: with SMTP id f11mr13497805ljj.385.1632526731294; Fri, 24 Sep 2021 16:38: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 k21sm1176652lji.81.2021.09.24.16.38.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 16:38: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 v5] net: dsa: rtl8366: Drop custom VLAN set-up Date: Sat, 25 Sep 2021 01:36:24 +0200 Message-Id: <20210924233628.2016227-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924233628.2016227-1-linus.walleij@linaro.org> References: <20210924233628.2016227-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 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 Fri Sep 24 23:36: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: 514614 Delivered-To: patch@linaro.org Received: by 2002:a17:906:f46:0:0:0:0 with SMTP id h6csp1777486ejj; Fri, 24 Sep 2021 16:39:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEp6hvpY9E+mzT84hoBU55PiORUzQffeGeAZcDKPNvlrE1iJp31q9Gu9HCAk2OiOR7ziW+ X-Received: by 2002:aa7:c2d3:: with SMTP id m19mr8374272edp.57.1632526741761; Fri, 24 Sep 2021 16:39:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632526741; cv=none; d=google.com; s=arc-20160816; b=JC2s670rFUkXSdJwSCa6qxboJKgWvxSRyVDL5m2TqNNs7c4UU+R7ICG6aqlIXeuJDH FCBK2MtsWXuSwR31yq89RkjYFFk/Vwxk4qRJfnVbce8jvg2LQSp7cy2h/85SxI5tRgr5 7dnf81YEc7czFoGoygsIJTwiMgToFraXfgoP6EsmTwjhqLtuV4Ga396wL8z1ZfRJ/rDW 8VylBXSQ1+aTd9iVJg4croprUYhBytdBg/rp+GZO0mn5JgksrXndIKQdaO/kGgjasJU5 AM3NP4Wol5Fk5dxCpVIFRgFL9twb394UYwFlYo5vqJdcFDU14MW27k6LeR01k97QPxK2 lxww== 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=f1Lk6JdP5CWoXDRFIqdoJOcLkUVMzlgSPzu3lEYWJIc=; b=J7IHDWn0EJFPk1L6wkE0evKkPlBQqCm3nygzljtqozONmnT6QQOrPmgPM9m5EajzXK Xgl8moDSFKE9RVnEOTR7ASTfiK5ufjlfZJo7sQJJfgks89pCgmEeuxerqTyvCa5IwJi0 2F1K1sfeeGYLl1otfDEiMK0AQqtyJz6zkIglOi3Ex71mENivUGLNxXwrm/5WF4P6BkGH 54fASOM4gbNV3PR2r2l9Pk5mIpde39mLAkXH6VaKwGEhY31Ei6Z71XjvIg+6142C8RNT jYr9CxzBto24MGWdgAcJIsZZ2gkL+QQhLunKy9HFOoQcep8HPO5faIDsJ2OyEfbEWY7Q ITcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XF3jgE+v; 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 a11si10803843edx.158.2021.09.24.16.39.01; Fri, 24 Sep 2021 16:39:01 -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=XF3jgE+v; 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 S1345131AbhIXXke (ORCPT + 8 others); Fri, 24 Sep 2021 19:40:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343829AbhIXXk2 (ORCPT ); Fri, 24 Sep 2021 19:40:28 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57A37C061571 for ; Fri, 24 Sep 2021 16:38:54 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id t10so46788346lfd.8 for ; Fri, 24 Sep 2021 16:38: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=f1Lk6JdP5CWoXDRFIqdoJOcLkUVMzlgSPzu3lEYWJIc=; b=XF3jgE+vk2ccsQuTLBTjaKFiYp1g/ox3qMJvsDITvKU/jSindLuUFEmdT0PEkgXWUz 2yP0grzmGa0iMviNtdwW6eSJr6Yvk/T62daq37kIgqrZFV0ADix+rcwz4+nPPOoc4reP vM2e8cLV62sZMFNmp56k7lNQdt0nhhqRKs9dXibLO8U/zul52mIAtWphjbROhbkgUkxG WGtEsxKGjOn5PKlvy7D3v/z6QhSTbHw9z3iJDzOBX0ssFG/tUDs5Wk6Bs06XYghmwPuj Vu46NFqx1r7KsbuSBVpq5N1jKCk5zMmCytmbk2hQEx2tSuOLuy9BOKc6On7LbFxpT+4r 5DyA== 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=f1Lk6JdP5CWoXDRFIqdoJOcLkUVMzlgSPzu3lEYWJIc=; b=2waDXP2AKwyDHvV95MlVUFVlhRUvUW7wmcdek08jH5DjUZtl9swbLe2mDwHC/aq28k k4LDT9pA2+nXQaUZ32mK2pQpKTaFo3XiVXYqJs2YKX4OxjlZUwYlkudgjMAHhWGnvqpX ViikSxeVZWUsM2/nLm4PQG0qTmWhcZr8PyfGyoEt5gZSeddCANZTa1LJ3els89+D+gMh GaJpSHKK+wym/FjU+n85V8eRbluzVT9F3JIxShQABis2MG5ITcgzEin9Pl2AhSBQOVm4 2X/c/UT0pT+fGyORBXe1ubH3wOFxKX1v5w0HOallkC4dbS606Pd3yvFy1/SQETPTNWQG YreQ== X-Gm-Message-State: AOAM531zdOU7NFTdyUTD8ITiFBEZ2OwqfNglAnA2ecLvCa6LU0/BkEAV YDIBtxA6yTfA35FRl1NlWK+WZg== X-Received: by 2002:a2e:82c4:: with SMTP id n4mr14212417ljh.283.1632526732732; Fri, 24 Sep 2021 16:38:52 -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 k21sm1176652lji.81.2021.09.24.16.38.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 16:38:52 -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 v5] net: dsa: rtl8366rb: Rewrite weird VLAN filering enablement Date: Sat, 25 Sep 2021 01:36:25 +0200 Message-Id: <20210924233628.2016227-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924233628.2016227-1-linus.walleij@linaro.org> References: <20210924233628.2016227-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 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 | 31 +++++++++++++++++++++----- 3 files changed, 25 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..1f228a7a5685 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,21 @@ rtl8366rb_port_bridge_leave(struct dsa_switch *ds, int port, RTL8366RB_PORT_ISO_PORTS(port_bitmap), 0); } +static int rtl8366rb_vlan_filtering(struct dsa_switch *ds, int port, + bool vlan_filtering, + struct netlink_ext_ack *extack) +{ + struct realtek_smi *smi = ds->priv; + int ret; + + dev_dbg(smi->dev, "port %d: %s VLAN filtering\n", port, + vlan_filtering ? "enable" : "disable"); + + /* 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 +1456,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 +1613,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 Fri Sep 24 23:36: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: 514616 Delivered-To: patch@linaro.org Received: by 2002:a17:906:f46:0:0:0:0 with SMTP id h6csp1777584ejj; Fri, 24 Sep 2021 16:39:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx1dRDHFZx26VuoghARpKleseZm9fTFoIUBiEA9RLhzm8qefFpevxF4GQZP3GgOnRz+ng8E X-Received: by 2002:a05:6402:1459:: with SMTP id d25mr8268437edx.78.1632526748884; Fri, 24 Sep 2021 16:39:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632526748; cv=none; d=google.com; s=arc-20160816; b=OnqTc/dXR6+gscJepduLuxVnc1v7ax7HjqFLACSiGZT2b8D8LO/c3EaG4YwY757Aub VVh0AyO6Ddu0fg1eBizfO6RlY9+o1/bJJKcyL2aeJVY93Z3MCDIjqo6DXaBp6ycw5xJ1 PyNgRGIFUUCteEKvNfz1rjP0pIGz7yZwDwQDkSzlE7RV/pRY7//PvzR8uJ/Lc4K3DJP2 6/0+5y4fx7z/bD94cmG0NoZ2RmZSmA10bRc7kDYH8ewbgfEfRC5BrUm3aN7HmgWJJxFF 4DOuojj38TPhUSYJpOpuXHq4RJmf+kwO0MyWVxu+naSOIa1ZGZnvzID6XPQsVl/kPSD7 fWxw== 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=WMsTxrWHhRC1xT+2K/5RB0/0syWqfSvMlujp2wqvh6k=; b=zoL+cjIZolHmIOuZ7MXWkB9BKYfwcSVDApUpHcZ+icxaGvjKWfHF+v/QiNRJLQTyFO hCK/3wmCDCLcEiZSKEA0B+mjRtBFPuUiEu4RIvrDlmN3UnaN+CgF6G7WB4m57mYmSoyI T0zNhvBAmHub03A0NDajWf7MdqhqiJcbUi8uDY9QdOFnUB3BrOwurGzQh2f+dZvC8P9V vETMRyEKY84JxdC45NnpthGCLEEDaNRrMknI+YhdHm3kCKEnxGJ8oShHMRMQkOQlu1Gt G61vibKreicZNh3kZ7Tj36WgJi71lpwhBtWqCodqtj1KMCuVLGNcS6w/mSKSAT+asPAT /skQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XDeHQPoN; 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 a11si10803843edx.158.2021.09.24.16.39.08; Fri, 24 Sep 2021 16:39:08 -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=XDeHQPoN; 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 S1345243AbhIXXkk (ORCPT + 8 others); Fri, 24 Sep 2021 19:40:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345149AbhIXXka (ORCPT ); Fri, 24 Sep 2021 19:40:30 -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 B14F5C061760 for ; Fri, 24 Sep 2021 16:38:55 -0700 (PDT) Received: by mail-lf1-x12f.google.com with SMTP id u18so45415653lfd.12 for ; Fri, 24 Sep 2021 16:38: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=WMsTxrWHhRC1xT+2K/5RB0/0syWqfSvMlujp2wqvh6k=; b=XDeHQPoN24Et/JFoyMK1/35+aWdPmmX80Maar1VdfEj3YmfR1x35uwbzhYJEfj/Z6Z f8xzBoKnYjmvXsiBEW+67wnpviqPOuGm/qfzKlT/akhgNgCi/AjBxY27BP4GoCTP0q+N xiD7TEA5urE99Fpd/cKdXIIXLf2rRxmRS6BuWgqcjBPXdBB7NxVlHMm/YjEpO0o6XPpq RT4vVnlabWE3iADKcdeOnGxWyGNTfMVmB8fkujRz+BeoZwbvb+q1ec5RKD4whr0SSPf0 kOzIaon6dF46mmKnuwnK1rTWKSLlcmAx06107CjBB2PDC/UF85EOWj6Irp3BjQZGlpEq AwpQ== 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=WMsTxrWHhRC1xT+2K/5RB0/0syWqfSvMlujp2wqvh6k=; b=Sy4KS50gpoWQtwL5QHJdgbps7G9JhSm6jbG+S1PfT5A61zcwFrHvrTWyiN/rJOF4Sl qKWVxWM/0pjKFXudoFJerTUbCe9WkSLRkVVqN2u8zfbuazrMHvrU8tJDXpGAMAnzooje lOPgYGGJRPxlj5e2yFPTTGtran2s6B748Krzjt7NGUHHR/cD8zSqnrb2i7S3RtZ6q3QI Q6wVRq70DAkGzvt9HlDLqe8BkX9FLbRt37rPUseyUYj4Wyp+2NPt72kazh4bzFhb9lm5 n3Mp0GD/YKheXnyMNP3tC7w2DmP/OiDtvXvKNB072cu5yx2vx3/byp+HONViDzTg07PG cVHQ== X-Gm-Message-State: AOAM5306MGoSLRRk+7uMHLnUXS8Imq3w78P+CvPc4GxsAh0BFJfqPse+ W+QrEIYb9l5cAqFfYaNdYEP8OQ== X-Received: by 2002:a2e:5803:: with SMTP id m3mr13948055ljb.137.1632526734130; Fri, 24 Sep 2021 16:38: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 k21sm1176652lji.81.2021.09.24.16.38.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 16:38: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 4/6 v5] net: dsa: rtl8366rb: Fix off-by-one bug Date: Sat, 25 Sep 2021 01:36:26 +0200 Message-Id: <20210924233628.2016227-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924233628.2016227-1-linus.walleij@linaro.org> References: <20210924233628.2016227-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 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 diff --git a/drivers/net/dsa/rtl8366rb.c b/drivers/net/dsa/rtl8366rb.c index 1f228a7a5685..7e57442ab0ca 100644 --- a/drivers/net/dsa/rtl8366rb.c +++ b/drivers/net/dsa/rtl8366rb.c @@ -1451,7 +1451,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 Fri Sep 24 23:36: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: 514615 Delivered-To: patch@linaro.org Received: by 2002:a17:906:f46:0:0:0:0 with SMTP id h6csp1777547ejj; Fri, 24 Sep 2021 16:39:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJetk060cU2oslAxyAzWg7AdFdbihQPRi6/BziG8uo9AYo2mxtlLhmvO8Dvxhim8nGs6Xh X-Received: by 2002:a50:aa9c:: with SMTP id q28mr7976164edc.199.1632526745877; Fri, 24 Sep 2021 16:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632526745; cv=none; d=google.com; s=arc-20160816; b=mo5KmgdfKoeQKY0ThoVHHKHyvg1586z7QeEkUnihdz6OnRB604sATKngst7d4bw1Fr 5JyphUrOvkW2VCYwsWymTipjDo2ymjCOLGKW3aW0i7RxIFlqW4GYPiZ+/gEUKnvHoXQ4 jlb6bOd6uD03SgxDJzEfVEv960NeIBgMSHSyaVm4QZJ5DNUq+ZFmxQgYAVlQkkPtJ1IX 17MT/B9fPt3xbxqbbnCWrgYsyu8srJmdmyF43MG25EUjTJxkuF+UzkJhnvDn2gvzQJeh G3Tb9i7sl7GHRPKpRAQxa9X4l7D1g6RroVcZ7P9W8mSrDVI7PNGKppPMbSSEUaXDJ3T7 Pi0w== 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=6oyOVt1g+lnmeELtwPigIKUcCfyMaHiZkeh2y7CVFYY=; b=sYL72JmKoozytamqXS5uSt9d+0EvjiMoAISrH7SMFos0RauCWLEgXZL3c5ADWGAKQ7 WD1N8EhPCLD2SjCbiPo2haHotwI8KCmJChgcxWnMhPWqLpfxUf74JEq3TpHLnzKnDFFU JmVNJ8sM5KndVASQqbh1KtCmxWoE2Mfrfr0NOZFkROli+WbuIHdZVsCjTMxEzemq4BsV 6jsG8akcfn8skhQjua6iJjrSdbyhg5Tth7MyMsbk5c/kTCC6hjeCp/fj2lbYfaYAVgUP yd4vbpbTUgCGMnuEcg/pbDIInewZ/wx1Emym6Ch4hb+9sQoy1BM/hGePxiHoyBLGMpSj 9V9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=xOCL6IKY; 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 a11si10803843edx.158.2021.09.24.16.39.05; Fri, 24 Sep 2021 16:39: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=xOCL6IKY; 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 S1343829AbhIXXki (ORCPT + 8 others); Fri, 24 Sep 2021 19:40:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345192AbhIXXkb (ORCPT ); Fri, 24 Sep 2021 19:40:31 -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 20D10C061762 for ; Fri, 24 Sep 2021 16:38:57 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id z24so47583990lfu.13 for ; Fri, 24 Sep 2021 16:38: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=6oyOVt1g+lnmeELtwPigIKUcCfyMaHiZkeh2y7CVFYY=; b=xOCL6IKYthmKz1XSjk8ogEaoN8jLKXYKWm2NjgeyV9Q+YGO+RgSAeDqd0v9YChtErz ukWDpMTpFBb3XNsSP9428IV5Z3yaNWGSlhWm3wtw5QodWxNS3aI4Pu9C3y1Icf6DHeIV j2PtlQpn1G3BYGrCGDg0eDBqh3cDjXqAIrEo0QMFcjdFJP2+tMvOaSMKwhLobwNCgzi3 FYnHFnYvHL8WmZwmonletxU3jWq1pql5cMoMfF+bTg1F9Ok0P2jR973MnvsuF67x11Nz 7DrVvKjFGSeQCq4Tu5IbpdDjeCeYAXg5jGnl1OuGV3YHSPDAgfBBKsvbPvPRYGezqMbR yLsQ== 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=6oyOVt1g+lnmeELtwPigIKUcCfyMaHiZkeh2y7CVFYY=; b=WMjsKF2U+KnoMD9p2XuKBaH5+0dJq2IBXyV3OdmsN+gqoG2XpEr9u74hcG3SsbS7X/ sQ/9SEMnfhQBz1/QdQcLOZAdzVcHgNUopWhtdj/1ibbswNdvmJw2YgxvergG+J2Dk2yq LK04zEz98lUZ+kGe5QZ0btTF8guLNZhtx64Qpz/R5fN+XJutnmOqHtkYsUOGbnA9KOrs 9/dJ4EgoKJ4GrQZdKb0AAshTbn91GSimzgOxJwb/TPsRCIho2kQcDk9rheLce9DoY6ai yHF3r0V1jHoh2ZXzpWHg6tSmd+OUVMk8UwERVrODoNwd99Afowj2TR3AaRwv68RGZuE6 JVoA== X-Gm-Message-State: AOAM532KdmrDsPPK8xmNiTNnA1KfESUcToglD7/NgBuRc0hgWLh6uEKg 17hzCRC3VlFKHjn5amVvEKjHIA== X-Received: by 2002:a2e:750d:: with SMTP id q13mr14266925ljc.420.1632526735512; Fri, 24 Sep 2021 16:38:55 -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 k21sm1176652lji.81.2021.09.24.16.38.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 16:38:55 -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 v5] net: dsa: rtl8366: Fix a bug in deleting VLANs Date: Sat, 25 Sep 2021 01:36:27 +0200 Message-Id: <20210924233628.2016227-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924233628.2016227-1-linus.walleij@linaro.org> References: <20210924233628.2016227-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 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 Fri Sep 24 23:36: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: 514617 Delivered-To: patch@linaro.org Received: by 2002:a17:906:f46:0:0:0:0 with SMTP id h6csp1777615ejj; Fri, 24 Sep 2021 16:39:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSN/EXQRbnS0ClZkwB7xjmXijB/96gXgAKPYBAnnzHJMFIw+qqnW8k6V9EIvbPeiYXNURr X-Received: by 2002:a50:bec9:: with SMTP id e9mr2016591edk.33.1632526750617; Fri, 24 Sep 2021 16:39:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632526750; cv=none; d=google.com; s=arc-20160816; b=yMMtD2zksGUS/tpQGZnRxapmGgw3ABIJO4xltlHtkI4xKlpIub7ehDxBlnoui9qftp Hy+4uxGXrb/F4K0bkBF4lRdZhCWJuY8GQ/rwnsqo08Dkj7cdO2IEgsaN1GCOmQLg90C0 I6f32mkLkEERT6VdFNcXoqzA3yuA0vGEv/yE/9YelSw66DCY6O36daS6rCWs5z6zvRhu XEHK7syn2fC174xBQZW+IYE57CwQ47iEZUZsfkf1pWeIpmwq5WYStPB6p0fmHyCq55xw H6hCeVabQVQ3ow+VX284vZLcKzzpxembMtGmvCAp1umiS7WFVQ2X1kZRznHr4Fqq5039 wXog== 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=mYZoFK7FS+15PHZW0TzOGr7TcQmdt+hsCtzBIKDLxuQ=; b=ceH/dksEOX+Ej9aP7kLEAi8XvbCo80pktGnhIY9q0vRjcgbOIJ0hVWe0D/96Tmk5mo vTI/5qDa6LtUG5BKjqerIqpM3D1WWarBq9N7taGGBYtCSMJ/qD9esJ3yvOC7Cf2kCjs/ T+KVXeWf62hP0Ozr237N5O9e1sE0lcJE7A+O99hDEhtwoQXwDDwcsR1wMuNXQQYKDN6q uHuVKbeGjscqoQn16YOuIJTm40SCNXtcHJHXhhm/SFysd3/Sv1vRAdet3gNUzqC3Pj7T ruti68Tb1E0NiIepNEhE7Hzz4MVzHnhCOCxGb1q7oD+ZksKTtUU1E+GrPUTV2QsD99TH ze5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Y6q64wXQ; 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 a11si10803843edx.158.2021.09.24.16.39.10; Fri, 24 Sep 2021 16:39:10 -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=Y6q64wXQ; 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 S1345149AbhIXXkn (ORCPT + 8 others); Fri, 24 Sep 2021 19:40:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51622 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343603AbhIXXkc (ORCPT ); Fri, 24 Sep 2021 19:40:32 -0400 Received: from mail-lf1-x12a.google.com (mail-lf1-x12a.google.com [IPv6:2a00:1450:4864:20::12a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E3C9C061571 for ; Fri, 24 Sep 2021 16:38:58 -0700 (PDT) Received: by mail-lf1-x12a.google.com with SMTP id z24so47584145lfu.13 for ; Fri, 24 Sep 2021 16:38:58 -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=mYZoFK7FS+15PHZW0TzOGr7TcQmdt+hsCtzBIKDLxuQ=; b=Y6q64wXQ1G+Q4gu4gMAGZQ0LHwi/3PTMcBtOV88cfQqyzw+97wAtPs1PXipSW+nijs wAT/8DW7ygLjGHQKo6+PkpSMWlFqUYsuF2XBltHFRtNb6JVOYZq4jXZtDI0i6ylbKmCD oKpXRMsX5VWksn8g+nZjjoKcNuHpQtPV/IZ8WAhQDPOwCxml6quWtnqRQu3IhmN3vqTJ WTuhR6ftWjBSqfV3wB6BODqVOrwu8ieQTAI3FuuGWUYgNUp6BwqQCg4ogWjhq1ShedXQ 2TPNqCtyDhnY4nUYOwD49C67gYpcu70sWLIg6470zusM9e9rh9Q/D+FBujA+OZ5+VTiW mdfA== 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=mYZoFK7FS+15PHZW0TzOGr7TcQmdt+hsCtzBIKDLxuQ=; b=F9UbfGTld02w57Q7nouxrnwsD3Z4ZmNlQpx6oNYI1dezPRWqb+U0x8cDlVKNE0XTuw zNJtPGYp48xpEWF2o5nme7B6ymYqLMXOo3z01v3aypqdsgeJOSy/IORQvHW8UbxQQD70 ONY3+B86M2D/Dj5ib19ziKw5iauAu7PaMPJkKaVGRod6Y6kPja6QpIi1tvAveuOcBHXA zNXNHlqufTu+/dbAOagDxQbA+DYmNTSmtiG9jpeZucI0jo+Fp9HZwj5aXXQA8HGFFGSJ qMQBlIfsq/Xpna6hVO9rP2cquMG663fJJVf+opZQbbrfmO1JlDIV4Nlo6MOwa+gdVEJx zGgQ== X-Gm-Message-State: AOAM531rLYZWNo6i4o8JXOhzyR83Dhm49E72AkU5/EuL0bMW5dQPaWQZ 89zFusETDo69R4Z56oclXYZHYA== X-Received: by 2002:a05:6512:3d8b:: with SMTP id k11mr11720754lfv.633.1632526736845; Fri, 24 Sep 2021 16:38: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 k21sm1176652lji.81.2021.09.24.16.38.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 Sep 2021 16:38: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 , =?utf-8?q?Alvin_=C5=A0ipraga?= , DENG Qingfang Subject: [PATCH net-next 6/6 v5] net: dsa: rtl8366: Drop and depromote pointless prints Date: Sat, 25 Sep 2021 01:36:28 +0200 Message-Id: <20210924233628.2016227-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210924233628.2016227-1-linus.walleij@linaro.org> References: <20210924233628.2016227-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 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..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;