From: Vladimir Oltean <olteanv@gmail.com>
To: Florian Fainelli <f.fainelli@gmail.com>
Cc: "Måns Rullgård" <mans@mansr.com>,
netdev@vger.kernel.org,
"Egil Hjelmeland" <privat@egil-hjelmeland.no>,
"Andrew Lunn" <andrew@lunn.ch>,
"Juergen Borleis" <jbe@pengutronix.de>,
"Grygorii Strashko" <grygorii.strashko@ti.com>,
lorenzo@kernel.org
Subject: Re: DSA using cpsw and lan9303
Date: Tue, 15 Feb 2022 22:54:18 +0200 [thread overview]
Message-ID: <20220215205418.a25ro255qbv5hpjk@skbuf> (raw)
In-Reply-To: <d19abc0a-4685-514d-387b-ac75503ee07a@gmail.com>
Hi Måns,
On Mon, Feb 14, 2022 at 09:16:10AM -0800, Florian Fainelli wrote:
> +others,
>
> netdev is a high volume list, you should probably copy directly the
> people involved with the code you are working with.
>
> On 2/14/22 8:44 AM, Måns Rullgård wrote:
> > The hardware I'm working on has a LAN9303 switch connected to the
> > Ethernet port of an AM335x (ZCE package). In trying to make DSA work
> > with this combination, I have encountered two problems.
> >
> > Firstly, the cpsw driver configures the hardware to filter out frames
> > with unknown VLAN tags. To make it accept the tagged frames coming from
> > the LAN9303, I had to modify the latter driver like this:
> >
> > diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
> > index 2de67708bbd2..460c998c0c33 100644
> > --- a/drivers/net/dsa/lan9303-core.c
> > +++ b/drivers/net/dsa/lan9303-core.c
> > @@ -1078,20 +1079,28 @@ static int lan9303_port_enable(struct dsa_switch *ds, int port,
> > struct phy_device *phy)
> > {
> > struct lan9303 *chip = ds->priv;
> > + struct net_device *master;
> >
> > if (!dsa_is_user_port(ds, port))
> > return 0;
> >
> > + master = dsa_to_port(chip->ds, 0)->master;
> > + vlan_vid_add(master, htons(ETH_P_8021Q), port);
>
> That looks about right given that net/dsa/tag_lan9303.c appears to be a
> quasi DSA_TAG_PROTO_8021Q implementation AFAICT.
In case it was not clear, I agree with Florian that this looks "about right",
I just thought that mentioning it wouldn't bring much to the table.
But I noticed you submitted a patch for the other issue and not for this.
Some complaints about accessing the CPU port as dsa_to_port(chip->ds, 0),
but it's not the first place in this driver where that is done.
dsa_tag_8021q_port_setup() also has:
/* Add @rx_vid to the master's RX filter. */
vlan_vid_add(master, ctx->proto, rx_vid);
which is an indication that other switches with VLAN-based tagging
protocols should handle this somehow, somewhere.
Note, though, that vlan_vid_add() allocates memory, so it would be good
to have a vlan_vid_del() too at some point.
next prev parent reply other threads:[~2022-02-15 20:54 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-14 16:44 DSA using cpsw and lan9303 Måns Rullgård
2022-02-14 17:16 ` Florian Fainelli
2022-02-14 17:43 ` Vladimir Oltean
2022-02-14 19:17 ` Måns Rullgård
2022-02-15 20:54 ` Vladimir Oltean [this message]
2022-02-16 13:17 ` Måns Rullgård
2022-02-16 14:15 ` Vladimir Oltean
2022-02-16 14:23 ` Måns Rullgård
2022-02-16 14:26 ` Vladimir Oltean
2022-02-16 17:00 ` Vladimir Oltean
2022-02-16 17:47 ` Måns Rullgård
2022-02-16 17:55 ` 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=20220215205418.a25ro255qbv5hpjk@skbuf \
--to=olteanv@gmail.com \
--cc=andrew@lunn.ch \
--cc=f.fainelli@gmail.com \
--cc=grygorii.strashko@ti.com \
--cc=jbe@pengutronix.de \
--cc=lorenzo@kernel.org \
--cc=mans@mansr.com \
--cc=netdev@vger.kernel.org \
--cc=privat@egil-hjelmeland.no \
/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