From: Mans Rullgard <mans@mansr.com>
To: Andrew Lunn <andrew@lunn.ch>,
Vivien Didelot <vivien.didelot@gmail.com>,
Florian Fainelli <f.fainelli@gmail.com>,
Vladimir Oltean <olteanv@gmail.com>,
"David S. Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Juergen Borleis <kernel@pengutronix.de>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] net: dsa: lan9303: add VLAN IDs to master device
Date: Wed, 16 Feb 2022 15:11:11 +0000 [thread overview]
Message-ID: <20220216151111.6376-1-mans@mansr.com> (raw)
If the master device does VLAN filtering, the IDs used by the switch
must be added for any frames to be received. Do this in the
port_enable() function, and remove them in port_disable().
Signed-off-by: Mans Rullgard <mans@mansr.com>
---
drivers/net/dsa/lan9303-core.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
index 873a5588171b..f3bf642fbf92 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
@@ -1084,20 +1084,32 @@ static int lan9303_port_enable(struct dsa_switch *ds, int port,
struct phy_device *phy)
{
struct lan9303 *chip = ds->priv;
+ struct dsa_port *cpu_dp;
if (!dsa_is_user_port(ds, port))
return 0;
+ dsa_switch_for_each_cpu_port(cpu_dp, ds)
+ break;
+
+ vlan_vid_add(cpu_dp->master, htons(ETH_P_8021Q), port);
+
return lan9303_enable_processing_port(chip, port);
}
static void lan9303_port_disable(struct dsa_switch *ds, int port)
{
struct lan9303 *chip = ds->priv;
+ struct dsa_port *cpu_dp;
if (!dsa_is_user_port(ds, port))
return;
+ dsa_switch_for_each_cpu_port(cpu_dp, ds)
+ break;
+
+ vlan_vid_del(cpu_dp->master, htons(ETH_P_8021Q), port);
+
lan9303_disable_processing_port(chip, port);
lan9303_phy_write(ds, chip->phy_addr_base + port, MII_BMCR, BMCR_PDOWN);
}
--
2.35.1
next reply other threads:[~2022-02-16 15:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-16 15:11 Mans Rullgard [this message]
2022-02-16 15:30 ` [PATCH] net: dsa: lan9303: add VLAN IDs to master device Vladimir Oltean
2022-02-16 19:33 ` kernel test robot
2022-02-16 19:33 ` kernel test robot
2022-02-16 19: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=20220216151111.6376-1-mans@mansr.com \
--to=mans@mansr.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=kernel@pengutronix.de \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vivien.didelot@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 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).