All of lore.kernel.org
 help / color / mirror / Atom feed
From: Florian Fainelli <f.fainelli@gmail.com>
To: Vladimir Oltean <olteanv@gmail.com>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	netdev@vger.kernel.org
Cc: Andrew Lunn <andrew@lunn.ch>,
	Vivien Didelot <vivien.didelot@gmail.com>,
	Kurt Kanzenbach <kurt@linutronix.de>,
	Hauke Mehrtens <hauke@hauke-m.de>,
	Woojung Huh <woojung.huh@microchip.com>,
	Microchip Linux Driver Support <UNGLinuxDriver@microchip.com>,
	Sean Wang <sean.wang@mediatek.com>,
	Landen Chao <Landen.Chao@mediatek.com>,
	Claudiu Manoil <claudiu.manoil@nxp.com>,
	Alexandre Belloni <alexandre.belloni@bootlin.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Vadym Kochan <vkochan@marvell.com>,
	Taras Chornyi <tchornyi@marvell.com>,
	Jiri Pirko <jiri@nvidia.com>, Ido Schimmel <idosch@nvidia.com>,
	Grygorii Strashko <grygorii.strashko@ti.com>,
	Ioana Ciornei <ioana.ciornei@nxp.com>,
	Ivan Vecera <ivecera@redhat.com>, Petr Machata <petrm@nvidia.com>
Subject: Re: [PATCH v4 net-next 02/11] net: dsa: mv88e6xxx: deny vid 0 on the CPU port and DSA links too
Date: Fri, 8 Jan 2021 20:05:41 -0800	[thread overview]
Message-ID: <eec03805-d240-07c5-f5a1-5a0248419666@gmail.com> (raw)
In-Reply-To: <20210109000156.1246735-3-olteanv@gmail.com>



On 1/8/2021 4:01 PM, Vladimir Oltean wrote:
> From: Vladimir Oltean <vladimir.oltean@nxp.com>
> 
> mv88e6xxx apparently has a problem offloading VID 0, which the 8021q
> module tries to install as part of commit ad1afb003939 ("vlan_dev: VLAN
> 0 should be treated as "no vlan tag" (802.1p packet)"). That mv88e6xxx
> restriction seems to have been introduced by the "VTU GetNext VID-1
> trick to retrieve a single entry" - see commit 2fb5ef09de7c ("net: dsa:
> mv88e6xxx: extract single VLAN retrieval").
> 
> There is one more problem. The mv88e6xxx CPU port and DSA links do not
> report properly in the prepare phase what are the VLANs that they can
> offload. They'll say they can offload everything:
> 
> mv88e6xxx_port_vlan_prepare
> -> mv88e6xxx_port_check_hw_vlan:
> 
> 	/* DSA and CPU ports have to be members of multiple vlans */
> 	if (dsa_is_dsa_port(ds, port) || dsa_is_cpu_port(ds, port))
> 		return 0;
> 
> Except that if you actually try to commit to it, they'll error out and
> print this message:
> 
> [   32.802438] mv88e6085 d0032004.mdio-mii:12: p9: failed to add VLAN 0t
> 
> which comes from:
> 
> mv88e6xxx_port_vlan_add
> -> mv88e6xxx_port_vlan_join:
> 
> 	if (!vid)
> 		return -EOPNOTSUPP;
> 
> What prevents this condition from triggering in real life? The fact that
> when a DSA_NOTIFIER_VLAN_ADD is emitted, it never targets a DSA link
> directly. Instead, the notifier will always target either a user port or
> a CPU port. DSA links just happen to get dragged in by:
> 
> static bool dsa_switch_vlan_match(struct dsa_switch *ds, int port,
> 				  struct dsa_notifier_vlan_info *info)
> {
> 	...
> 	if (dsa_is_dsa_port(ds, port))
> 		return true;
> 	...
> }
> 
> So for every DSA VLAN notifier, during the prepare phase, it will just
> so happen that there will be somebody to say "no, don't do that".
> 
> This will become a problem when the switchdev prepare/commit transactional
> model goes away. Every port needs to think on its own. DSA links can no
> longer bluff and rely on the fact that the prepare phase will not go
> through to the end, because there will be no prepare phase any longer.
> 
> Fix this issue before it becomes a problem, by having the "vid == 0"
> check earlier than the check whether we are a CPU port / DSA link or not.
> Also, the "vid == 0" check becomes unnecessary in the .port_vlan_add
> callback, so we can remove it.
> 
> Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
-- 
Florian

  reply	other threads:[~2021-01-09  4:06 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-09  0:01 [PATCH v4 net-next 00/11] Get rid of the switchdev transactional model Vladimir Oltean
2021-01-09  0:01 ` [PATCH v4 net-next 01/11] net: switchdev: remove vid_begin -> vid_end range from VLAN objects Vladimir Oltean
2021-01-09  4:10   ` Florian Fainelli
2021-01-09  7:39   ` Kurt Kanzenbach
2021-01-15 19:35   ` Grygorii Strashko
2021-01-09  0:01 ` [PATCH v4 net-next 02/11] net: dsa: mv88e6xxx: deny vid 0 on the CPU port and DSA links too Vladimir Oltean
2021-01-09  4:05   ` Florian Fainelli [this message]
2021-01-09  0:01 ` [PATCH v4 net-next 03/11] net: switchdev: remove the transaction structure from port object notifiers Vladimir Oltean
2021-01-09  0:01 ` [PATCH v4 net-next 04/11] net: switchdev: delete switchdev_port_obj_add_now Vladimir Oltean
2021-01-09  0:01 ` [PATCH v4 net-next 05/11] net: switchdev: remove the transaction structure from port attributes Vladimir Oltean
2021-01-09  1:53   ` Florian Fainelli
2021-01-09  0:01 ` [PATCH v4 net-next 06/11] net: dsa: remove the transactional logic from ageing time notifiers Vladimir Oltean
2021-01-09  0:01 ` [PATCH v4 net-next 07/11] net: dsa: remove the transactional logic from MDB entries Vladimir Oltean
2021-01-09  0:01 ` [PATCH v4 net-next 08/11] net: dsa: remove the transactional logic from VLAN objects Vladimir Oltean
2021-01-09  0:01 ` [PATCH v4 net-next 09/11] net: dsa: remove obsolete comments about switchdev transactions Vladimir Oltean
2021-01-09  0:01 ` [PATCH v4 net-next 10/11] mlxsw: spectrum_switchdev: remove transactional logic for VLAN objects Vladimir Oltean
2021-01-09  1:48   ` Florian Fainelli
2021-01-09  0:01 ` [PATCH v4 net-next 11/11] net: switchdev: delete the transaction object Vladimir Oltean
2021-01-12  0:20 ` [PATCH v4 net-next 00/11] Get rid of the switchdev transactional model patchwork-bot+netdevbpf

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=eec03805-d240-07c5-f5a1-5a0248419666@gmail.com \
    --to=f.fainelli@gmail.com \
    --cc=Landen.Chao@mediatek.com \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=andrew@lunn.ch \
    --cc=claudiu.manoil@nxp.com \
    --cc=davem@davemloft.net \
    --cc=grygorii.strashko@ti.com \
    --cc=hauke@hauke-m.de \
    --cc=idosch@nvidia.com \
    --cc=ioana.ciornei@nxp.com \
    --cc=ivecera@redhat.com \
    --cc=jiri@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=kurt@linutronix.de \
    --cc=linus.walleij@linaro.org \
    --cc=netdev@vger.kernel.org \
    --cc=olteanv@gmail.com \
    --cc=petrm@nvidia.com \
    --cc=sean.wang@mediatek.com \
    --cc=tchornyi@marvell.com \
    --cc=vivien.didelot@gmail.com \
    --cc=vkochan@marvell.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.