Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>
Subject: Re: [net-next PATCH] net: dsa: rtl8366: Properly clear member config
Date: Sun, 6 Sep 2020 10:40:58 -0700	[thread overview]
Message-ID: <20200906104058.1b0ac9bc@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> (raw)
In-Reply-To: <20200905103233.16922-1-linus.walleij@linaro.org>

On Sat,  5 Sep 2020 12:32:33 +0200 Linus Walleij wrote:
> When removing a port from a VLAN we are just erasing the
> member config for the VLAN, which is wrong: other ports
> can be using it.
> 
> Just mask off the port and only zero out the rest of the
> member config once ports using of the VLAN are removed
> from it.
> 
> Reported-by: Florian Fainelli <f.fainelli@gmail.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

I see you labeled this for net-net, but it reads like a fix, is it not?

Fixes: d8652956cf37 ("net: dsa: realtek-smi: Add Realtek SMI driver")

Like commit 15ab7906cc92 ("net: dsa: rtl8366: Fix VLAN semantics") had?

> diff --git a/drivers/net/dsa/rtl8366.c b/drivers/net/dsa/rtl8366.c
> index 2dcde7a91721..bd3c947976ce 100644
> --- a/drivers/net/dsa/rtl8366.c
> +++ b/drivers/net/dsa/rtl8366.c
> @@ -471,13 +471,19 @@ int rtl8366_vlan_del(struct dsa_switch *ds, int port,
>  				return ret;
>  
>  			if (vid == vlanmc.vid) {
> -				/* clear VLAN member configurations */
> -				vlanmc.vid = 0;
> -				vlanmc.priority = 0;
> -				vlanmc.member = 0;
> -				vlanmc.untag = 0;
> -				vlanmc.fid = 0;
> -
> +				/* Remove this port from the VLAN */
> +				vlanmc.member &= ~BIT(port);
> +				vlanmc.untag &= ~BIT(port);
> +				/*
> +				 * If no ports are members of this VLAN
> +				 * anymore then clear the whole member
> +				 * config so it can be reused.
> +				 */
> +				if (!vlanmc.member && vlanmc.untag) {
> +					vlanmc.vid = 0;
> +					vlanmc.priority = 0;
> +					vlanmc.fid = 0;
> +				}
>  				ret = smi->ops->set_vlan_mc(smi, i, &vlanmc);
>  				if (ret) {
>  					dev_err(smi->dev,


  reply	other threads:[~2020-09-06 17:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-05 10:32 [net-next PATCH] net: dsa: rtl8366: Properly clear member config Linus Walleij
2020-09-06 17:40 ` Jakub Kicinski [this message]
2020-09-06 19:23   ` Linus Walleij
2020-09-06 19:34     ` Jakub Kicinski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200906104058.1b0ac9bc@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=f.fainelli@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=vivien.didelot@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).