From: Vladimir Oltean <olteanv@gmail.com>
To: "Paweł Dembicki" <paweldembicki@gmail.com>
Cc: netdev@vger.kernel.org, Dan Carpenter <dan.carpenter@linaro.org>,
Simon Horman <simon.horman@corigine.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>, Paolo Abeni <pabeni@redhat.com>,
Russell King <linux@armlinux.org.uk>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next v3 5/8] net: dsa: vsc73xx: Add vlan filtering
Date: Wed, 27 Sep 2023 02:58:48 +0300 [thread overview]
Message-ID: <20230926235848.3uftpkj7m24qsord@skbuf> (raw)
In-Reply-To: <CAJN1Kkwzwt++6GtrAnCbKzYto-uQECYZz5=N7bePqK9wsK2_+g@mail.gmail.com>
On Fri, Sep 22, 2023 at 04:26:00PM +0200, Paweł Dembicki wrote:
> > > + if (vsc->untagged_storage[port] < VLAN_N_VID &&
> > > + !vid_is_dsa_8021q(vsc->untagged_storage[port]) &&
> > > + !vid_is_dsa_8021q(vid) &&
> >
> > The problem here which led to these vid_is_dsa_8021q() checks is that
> > dsa_switch_tag_8021q_vlan_add() sets all flags on user ports to
> > BRIDGE_VLAN_INFO_UNTAGGED | BRIDGE_VLAN_INFO_PVID, and you can't offload
> > those, correct?
>
> In my case, the major problem with tag8021q vlans is
> "dsa_tag_8021q_bridge_join" function:
> "dsa_port_tag_8021q_vlan_add" is called before "dsa_port_tag_8021q_vlan_del".
> I must disable pvid/untagged checking, because it will always fail. I
> let kernel do the job,
> it keeps only one untagged/pvid per port after "dsa_tag_8021q_bridge_join".
I'm not sure that you described the problem in a way that I can understand, here.
After dsa_tag_8021q_bridge_join():
-> dsa_port_tag_8021q_vlan_add(dp, bridge_vid)
-> dsa_port_tag_8021q_vlan_del(dp, standalone_vid)
it's *expected* that there should be only one untagged/pvid per port: the bridge_vid.
For context, consider the fact that you can run the following commands:
bridge vlan add dev eth0 vid 10 pvid
bridge vlan add dev eth0 vid 11 pvid
and after the second command, vid 10 stops being a pvid.
So I think that the "Port %d can have only one pvid! Now is: %d.\n" behavior
is not correct. You need to implement the pvid overwriting behavior, since
there's always only 1 pvid.
So that leaves the "untagged" flag as being problematic, correct? Could
you comment...
>
> > But when the port is VSC73XX_VLAN_IGNORE mode (and
> > tag_8021q is active), VSC73XX_TXUPDCFG_TX_INSERT_TAG is 0, and thus,
> > *all* VLANs are egress-untagged VLANs, correct?
> >
> > If that is the case, why do you call vsc73xx_vlan_set_untagged() in the
> > first place, for tag_8021q VLANs, if you don't rely on the port's native
> > VLAN for egress untagging?
... on this? Here I'm pointing out that "all VLANs have the egress-untagged flag"
is a configuration that can actually be supported by vsc73xx. You just
need to ensure that VSC73XX_TXUPDCFG_TX_INSERT_TAG is 0. And tag_8021q
basically requests exactly that configuration on user ports (both the
bridge_vid and the standalone_vid are egress-untagged). So your check is
too restrictive, you are denying a configuration that would work.
The problem only appears when you mix egress-tagged with egress-untagged
VLANs on a port. Only then there can be at most 1 egress-untagged VID,
because you need to enable VSC73XX_TXUPDCFG_TX_INSERT_TAG for the
egress-tagged VIDs to work.
> > A comment would be good which states that the flipping between the
> > hardware and the storage values relies on the fact that vsc73xx_port_vlan_filtering()
> > only gets called on actual changes to vlan_filtering, and thus, to
> > vsc73xx_tag_8021q_active(). So, we know for sure that what is in storage
> > needs to go to hardware, and what is in hardware needs to go to storage.
> >
> > It's an interesting implementation for sure.
> >
>
> Thank you.
I'm not sure if that was a compliment :) At least in this form, it's
certainly non-trivial to determine by looking at the code if it is
correct or not, and it uses different patterns than the other VLAN
implementations in DSA drivers. Generally, boring and obvious is
preferable. But after I took the time to understand, it seems plausible
that the approach might work.
Let's see how the same idea looks, cleaned up a bit but not redesigned,
in v4.
next prev parent reply other threads:[~2023-09-26 23:58 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-12 12:21 [PATCH net-next v3 0/8] net: dsa: vsc73xx: Make vsc73xx usable Pawel Dembicki
2023-09-12 12:21 ` [PATCH net-next v3 1/8] net: dsa: vsc73xx: use read_poll_timeout instead delay loop Pawel Dembicki
2023-09-12 12:21 ` [PATCH net-next v3 2/8] net: dsa: vsc73xx: convert to PHYLINK Pawel Dembicki
2023-09-12 16:49 ` Russell King (Oracle)
2023-09-26 23:03 ` Vladimir Oltean
2023-10-03 20:45 ` Paweł Dembicki
2023-10-03 21:14 ` Vladimir Oltean
2023-10-03 21:32 ` Andrew Lunn
2023-10-03 21:50 ` Paweł Dembicki
2023-09-12 12:21 ` [PATCH net-next v3 3/8] net: dsa: vsc73xx: Add define for max num of ports Pawel Dembicki
2023-09-12 12:21 ` [PATCH net-next v3 4/8] net: dsa: vsc73xx: add port_stp_state_set function Pawel Dembicki
2023-09-12 14:48 ` Vladimir Oltean
2023-09-12 15:27 ` Paweł Dembicki
2023-09-12 15:42 ` Vladimir Oltean
2023-09-12 12:21 ` [PATCH net-next v3 5/8] net: dsa: vsc73xx: Add vlan filtering Pawel Dembicki
2023-09-12 16:17 ` Vladimir Oltean
2023-09-22 14:26 ` Paweł Dembicki
2023-09-26 23:58 ` Vladimir Oltean [this message]
2023-10-03 21:14 ` Paweł Dembicki
2023-10-03 21:27 ` Vladimir Oltean
2023-09-12 12:22 ` [PATCH net-next v3 6/8] net: dsa: vsc73xx: introduce tag 8021q for vsc73xx Pawel Dembicki
2023-09-12 21:39 ` Vladimir Oltean
2023-09-25 20:55 ` Paweł Dembicki
2023-09-27 0:11 ` Vladimir Oltean
2023-09-12 12:22 ` [PATCH net-next v3 7/8] net: dsa: vsc73xx: Implement vsc73xx 8021q tagger Pawel Dembicki
2023-09-12 12:22 ` [PATCH net-next v3 8/8] net: dsa: vsc73xx: Add bridge support Pawel Dembicki
2023-09-12 22:23 ` 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=20230926235848.3uftpkj7m24qsord@skbuf \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=dan.carpenter@linaro.org \
--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 \
--cc=simon.horman@corigine.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