From: Vladimir Oltean <olteanv@gmail.com>
To: Pawel Dembicki <paweldembicki@gmail.com>
Cc: netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew@lunn.ch>,
Florian Fainelli <f.fainelli@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Claudiu Manoil <claudiu.manoil@nxp.com>,
Alexandre Belloni <alexandre.belloni@bootlin.com>,
UNGLinuxDriver@microchip.com,
Russell King <linux@armlinux.org.uk>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v2 08/12] net: dsa: vsc73xx: Implement the tag_8021q VLAN operations
Date: Thu, 20 Jun 2024 17:09:43 +0300 [thread overview]
Message-ID: <20240620140943.viiqlzgcmneyywdf@skbuf> (raw)
In-Reply-To: <20240619205220.965844-9-paweldembicki@gmail.com> <20240619205220.965844-9-paweldembicki@gmail.com>
On Wed, Jun 19, 2024 at 10:52:14PM +0200, Pawel Dembicki wrote:
> +static int vsc73xx_tag_8021q_vlan_add(struct dsa_switch *ds, int port, u16 vid,
> + u16 flags)
> +{
> + bool untagged = flags & BRIDGE_VLAN_INFO_UNTAGGED;
> + bool pvid = flags & BRIDGE_VLAN_INFO_PVID;
> + struct vsc73xx_portinfo *portinfo;
> + struct vsc73xx *vsc = ds->priv;
> + bool commit_to_hardware;
> + int ret;
> +
> + portinfo = &vsc->portinfo[port];
> +
> + if (untagged) {
> + portinfo->untagged_tag_8021q_configured = true;
> + portinfo->untagged_tag_8021q = vid;
> + }
This is something I don't really like, but I understand why you're
doing it. dsa_tag_8021q_bridge_join() first adds the bridge_vid and
only then deletes the standalone_vid. Both are egress-untagged.
The fact that you have storage in this driver for a single egress-tagged
tag_8021q VLAN makes it awkward if not impossible to track the deletion
properly from tag_8021q_vlan_del(). You just record the last added VID
in tag_8021q_vlan_add() and silently discard any previous one during the
VSC73XX_TXUPDCFG_TX_UNTAGGED_VID setting, earlier than the deletion API.
I'm wondering if this isn't actually a self-inflicted problem created by
the data structures in use. I see that when the port is in VSC73XX_VLAN_IGNORE
(which it is for tag_8021q), VSC73XX_TXUPDCFG_TX_INSERT_TAG will be
unset. So the port is egress-untagged for all VIDs, and there's little
point in tracking any one single egress untagged VID coming from
tag_8021q. No?
Wouldn't it be better, assuming that is the case, to just return an
error if this is a user port and tag_8021q is requesting a VID which
is _not_ egress-untagged? If you also respond positively to my comment
about returning early in vsc73xx_vlan_commit_untagged() without doing
anything in the tag_8021q case, then you can actually get rid of
untagged_tag_8021q_configured and untagged_tag_8021q from portinfo.
> + if (pvid) {
> + portinfo->pvid_tag_8021q_configured = true;
> + portinfo->pvid_tag_8021q = vid;
> + }
> +
> + commit_to_hardware = vsc73xx_tag_8021q_active(dsa_to_port(ds, port));
> + if (commit_to_hardware) {
> + ret = vsc73xx_vlan_commit_untagged(vsc, port);
> + if (ret)
> + return ret;
> +
> + ret = vsc73xx_vlan_commit_pvid(vsc, port);
> + if (ret)
> + return ret;
Hmm, here I notice that the vsc73xx_vlan_commit_conf() call is missing.
Am I right that if you add it here, then the entire vsc73xx_vlan_commit_*()
string of 3 calls from vsc73xx_port_enable() becomes unnecessary?
The tag_8021q VLAN add operations are initiated by you when you call
dsa_tag_8021q_register(). So you have good control over when the VLAN
configuration of the port for standalone mode is done.
> + }
> +
> + return vsc73xx_update_vlan_table(vsc, port, vid, true);
> +}
> +
> +static int vsc73xx_tag_8021q_vlan_del(struct dsa_switch *ds, int port, u16 vid)
> +{
> + struct vsc73xx *vsc = ds->priv;
> +
As a matter of API compliance, I guess you could add a snippet:
if (portinfo->pvid_tag_8021q_configured &&
portinfo->pvid_tag_8021q == vid) {
portinfo->pvid_tag_8021q_configured = false;
if (commit_to_hardware) {
err = vsc73xx_vlan_commit_pvid(vsc, port);
if (err)
return err;
}
}
Of course, this is not to say that tag_8021q will _currently_ configure
ports for an operating mode without PVID. But it's something that the
API permits.
> + return vsc73xx_update_vlan_table(vsc, port, vid, false);
> +}
next prev parent reply other threads:[~2024-06-20 14:09 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-19 20:52 [PATCH net-next v2 00/12] net: dsa: vsc73xx: Implement VLAN operations Pawel Dembicki
2024-06-19 20:52 ` [PATCH net-next v2 01/12] net: dsa: vsc73xx: add port_stp_state_set function Pawel Dembicki
2024-06-19 20:52 ` [PATCH net-next v2 02/12] net: dsa: vsc73xx: Add vlan filtering Pawel Dembicki
2024-06-20 11:59 ` Vladimir Oltean
2024-06-21 14:59 ` Vladimir Oltean
2024-06-19 20:52 ` [PATCH net-next v2 03/12] net: dsa: tag_sja1105: absorb logic for not overwriting precise info into dsa_8021q_rcv() Pawel Dembicki
2024-06-20 15:39 ` Vladimir Oltean
2024-06-19 20:52 ` [PATCH net-next v2 04/12] net: dsa: tag_sja1105: absorb entire sja1105_vlan_rcv() " Pawel Dembicki
2024-06-20 12:28 ` Vladimir Oltean
2024-06-21 14:32 ` Vladimir Oltean
2024-06-19 20:52 ` [PATCH net-next v2 05/12] net: dsa: tag_sja1105: prefer precise source port info on SJA1110 too Pawel Dembicki
2024-06-21 14:33 ` Vladimir Oltean
2024-06-19 20:52 ` [PATCH net-next v2 06/12] net: dsa: tag_sja1105: refactor skb->dev assignment to dsa_tag_8021q_find_user() Pawel Dembicki
2024-06-19 20:52 ` [PATCH net-next v2 07/12] net: dsa: vsc73xx: introduce tag 8021q for vsc73xx Pawel Dembicki
2024-06-19 20:52 ` [PATCH net-next v2 08/12] net: dsa: vsc73xx: Implement the tag_8021q VLAN operations Pawel Dembicki
2024-06-20 14:09 ` Vladimir Oltean [this message]
2024-06-19 20:52 ` [PATCH net-next v2 09/12] net: dsa: Define max num of bridges in tag8021q implementation Pawel Dembicki
2024-06-20 12:29 ` Vladimir Oltean
2024-06-19 20:52 ` [PATCH net-next v2 10/12] net: dsa: prepare 'dsa_tag_8021q_bridge_join' for standalone use Pawel Dembicki
2024-06-20 12:32 ` Vladimir Oltean
2024-06-19 20:52 ` [PATCH net-next v2 11/12] net: dsa: vsc73xx: Add bridge support Pawel Dembicki
2024-06-20 12:42 ` Vladimir Oltean
2024-06-20 12:44 ` Vladimir Oltean
2024-06-19 20:52 ` [PATCH net-next v2 12/12] net: dsa: vsc73xx: start treating the BR_LEARNING flag Pawel Dembicki
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=20240620140943.viiqlzgcmneyywdf@skbuf \
--to=olteanv@gmail.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=alexandre.belloni@bootlin.com \
--cc=andrew@lunn.ch \
--cc=claudiu.manoil@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=f.fainelli@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=paweldembicki@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 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.