Skip to content

Commit 430065e

Browse files
mansrkuba-moo
authored andcommitted
net: dsa: lan9303: add VLAN IDs to master device
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(). Fixes: a129259 ("net: dsa: add new DSA switch driver for the SMSC-LAN9303") Signed-off-by: Mans Rullgard <mans@mansr.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Link: https://lore.kernel.org/r/20220216204818.28746-1-mans@mansr.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent 017b355 commit 430065e

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

drivers/net/dsa/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ config NET_DSA_REALTEK_SMI
8282

8383
config NET_DSA_SMSC_LAN9303
8484
tristate
85+
depends on VLAN_8021Q || VLAN_8021Q=n
8586
select NET_DSA_TAG_LAN9303
8687
select REGMAP
8788
help

drivers/net/dsa/lan9303-core.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/mii.h>
1111
#include <linux/phy.h>
1212
#include <linux/if_bridge.h>
13+
#include <linux/if_vlan.h>
1314
#include <linux/etherdevice.h>
1415

1516
#include "lan9303.h"
@@ -1083,21 +1084,27 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port,
10831084
static int lan9303_port_enable(struct dsa_switch *ds, int port,
10841085
struct phy_device *phy)
10851086
{
1087+
struct dsa_port *dp = dsa_to_port(ds, port);
10861088
struct lan9303 *chip = ds->priv;
10871089

1088-
if (!dsa_is_user_port(ds, port))
1090+
if (!dsa_port_is_user(dp))
10891091
return 0;
10901092

1093+
vlan_vid_add(dp->cpu_dp->master, htons(ETH_P_8021Q), port);
1094+
10911095
return lan9303_enable_processing_port(chip, port);
10921096
}
10931097

10941098
static void lan9303_port_disable(struct dsa_switch *ds, int port)
10951099
{
1100+
struct dsa_port *dp = dsa_to_port(ds, port);
10961101
struct lan9303 *chip = ds->priv;
10971102

1098-
if (!dsa_is_user_port(ds, port))
1103+
if (!dsa_port_is_user(dp))
10991104
return;
11001105

1106+
vlan_vid_del(dp->cpu_dp->master, htons(ETH_P_8021Q), port);
1107+
11011108
lan9303_disable_processing_port(chip, port);
11021109
lan9303_phy_write(ds, chip->phy_addr_base + port, MII_BMCR, BMCR_PDOWN);
11031110
}

0 commit comments

Comments
 (0)