netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>, netdev@vger.kernel.org
Cc: Woojung Huh <woojung.huh@microchip.com>,
	UNGLinuxDriver@microchip.com, Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net 2/6] net: dsa: ksz: move tag/untag action
Date: Wed, 13 Jan 2021 15:35:07 -0800	[thread overview]
Message-ID: <4c1d3d0e-5059-ec4c-cfd4-751c0d954c34@gmail.com> (raw)
In-Reply-To: <8e1cd9b167bd39c0f82ca8970a355cdfbc0fe885.1610540603.git.gilles.doffe@savoirfairelinux.com>

On 1/13/21 4:45 AM, Gilles DOFFE wrote:
> Move tag/untag action at the end of the function to avoid
> tagging or untagging traffic if only vlan 0 is handled.
> 
> Signed-off-by: Gilles DOFFE <gilles.doffe@savoirfairelinux.com>
> ---
>  drivers/net/dsa/microchip/ksz8795.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/dsa/microchip/ksz8795.c b/drivers/net/dsa/microchip/ksz8795.c
> index 6962ba4ee125..4b060503b2e8 100644
> --- a/drivers/net/dsa/microchip/ksz8795.c
> +++ b/drivers/net/dsa/microchip/ksz8795.c
> @@ -840,8 +840,6 @@ static void ksz8795_port_vlan_add(struct dsa_switch *ds, int port,
>  	u8 fid, member, valid;
>  	int ret;
>  
> -	ksz_port_cfg(dev, port, P_TAG_CTRL, PORT_REMOVE_TAG, untagged);
> -
>  	for (vid = vlan->vid_begin; vid <= vlan->vid_end; vid++) {
>  		if (vid == 0)
>  			continue;
> @@ -874,6 +872,8 @@ static void ksz8795_port_vlan_add(struct dsa_switch *ds, int port,
>  		vid |= new_pvid;
>  		ksz_pwrite16(dev, port, REG_PORT_CTRL_VID, vid);
>  	}
> +
> +	ksz_port_cfg(dev, port, P_TAG_CTRL, PORT_REMOVE_TAG, untagged);

You should be giving an example how this fails, because it is not
immediately obvious why this fixes a problem and how it does fix it,
especially for VID == 0 given that the loop would be skipped over.
--
Florian

  reply	other threads:[~2021-01-14  2:01 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-13 12:45 [PATCH net 0/6] Fixes on Microchip KSZ8795 DSA switch driver Gilles DOFFE
2021-01-13 12:45 ` [PATCH net 1/6] net: dsa: ksz: fix FID management Gilles DOFFE
2021-01-13 14:01   ` Gilles Doffe
2021-01-13 23:26   ` Vladimir Oltean
2021-01-13 12:45 ` [PATCH net 2/6] net: dsa: ksz: move tag/untag action Gilles DOFFE
2021-01-13 23:35   ` Florian Fainelli [this message]
2021-01-14  0:00   ` Vladimir Oltean
2021-01-13 12:45 ` [PATCH net 3/6] net: dsa: ksz: insert tag on ks8795 ingress packets Gilles DOFFE
2021-01-13 23:41   ` Florian Fainelli
2021-01-14  0:10   ` Vladimir Oltean
2021-01-13 12:45 ` [PATCH net 4/6] net: dsa: ksz: do not change tagging on del Gilles DOFFE
2021-01-13 23:48   ` Florian Fainelli
2021-01-14  0:15   ` Vladimir Oltean
2021-01-13 12:45 ` [PATCH net 5/6] net: dsa: ksz: fix wrong pvid Gilles DOFFE
2021-01-13 17:23   ` Florian Fainelli
2021-01-13 23:54   ` Vladimir Oltean
2021-01-13 12:45 ` [PATCH net 6/6] net: dsa: ksz: fix wrong read cast to u64 Gilles DOFFE
2021-01-13 23:39   ` Vladimir Oltean
2021-01-14  0:26 ` [PATCH net 0/6] Fixes on Microchip KSZ8795 DSA switch driver Vladimir Oltean

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=4c1d3d0e-5059-ec4c-cfd4-751c0d954c34@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=gilles.doffe@savoirfairelinux.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=vivien.didelot@gmail.com \
    --cc=woojung.huh@microchip.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).