* [PATCH v2] net: dsa: lan9303: add VLAN IDs to master device
@ 2022-02-16 20:48 Mans Rullgard
2022-02-16 21:44 ` Florian Fainelli
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Mans Rullgard @ 2022-02-16 20:48 UTC (permalink / raw)
To: Andrew Lunn, Vivien Didelot, Florian Fainelli, Vladimir Oltean,
David S. Miller, Jakub Kicinski, Juergen Borleis, netdev,
linux-kernel
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>
---
Changes:
- Fix dependency on VLAN_8021Q
- Add missing #include
---
drivers/net/dsa/Kconfig | 1 +
drivers/net/dsa/lan9303-core.c | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/dsa/Kconfig b/drivers/net/dsa/Kconfig
index 8d51c1019dcd..37a3dabdce31 100644
--- a/drivers/net/dsa/Kconfig
+++ b/drivers/net/dsa/Kconfig
@@ -72,6 +72,7 @@ source "drivers/net/dsa/realtek/Kconfig"
config NET_DSA_SMSC_LAN9303
tristate
+ depends on VLAN_8021Q || VLAN_8021Q=n
select NET_DSA_TAG_LAN9303
select REGMAP
help
diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c
index 873a5588171b..3969d89fa4db 100644
--- a/drivers/net/dsa/lan9303-core.c
+++ b/drivers/net/dsa/lan9303-core.c
@@ -10,6 +10,7 @@
#include <linux/mii.h>
#include <linux/phy.h>
#include <linux/if_bridge.h>
+#include <linux/if_vlan.h>
#include <linux/etherdevice.h>
#include "lan9303.h"
@@ -1083,21 +1084,27 @@ static void lan9303_adjust_link(struct dsa_switch *ds, int port,
static int lan9303_port_enable(struct dsa_switch *ds, int port,
struct phy_device *phy)
{
+ struct dsa_port *dp = dsa_to_port(ds, port);
struct lan9303 *chip = ds->priv;
- if (!dsa_is_user_port(ds, port))
+ if (!dsa_port_is_user(dp))
return 0;
+ vlan_vid_add(dp->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 dsa_port *dp = dsa_to_port(ds, port);
struct lan9303 *chip = ds->priv;
- if (!dsa_is_user_port(ds, port))
+ if (!dsa_port_is_user(dp))
return;
+ vlan_vid_del(dp->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
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: dsa: lan9303: add VLAN IDs to master device
2022-02-16 20:48 [PATCH v2] net: dsa: lan9303: add VLAN IDs to master device Mans Rullgard
@ 2022-02-16 21:44 ` Florian Fainelli
2022-02-16 23:59 ` Vladimir Oltean
2022-02-17 18:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2022-02-16 21:44 UTC (permalink / raw)
To: Mans Rullgard, Andrew Lunn, Vivien Didelot, Vladimir Oltean,
David S. Miller, Jakub Kicinski, Juergen Borleis, netdev,
linux-kernel
On 2/16/22 12:48 PM, Mans Rullgard wrote:
> 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>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Should this have :
Fixes: a1292595e006 ("net: dsa: add new DSA switch driver for the
SMSC-LAN9303")
--
Florian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: dsa: lan9303: add VLAN IDs to master device
2022-02-16 20:48 [PATCH v2] net: dsa: lan9303: add VLAN IDs to master device Mans Rullgard
2022-02-16 21:44 ` Florian Fainelli
@ 2022-02-16 23:59 ` Vladimir Oltean
2022-02-20 17:00 ` Vladimir Oltean
2022-02-17 18:10 ` patchwork-bot+netdevbpf
2 siblings, 1 reply; 5+ messages in thread
From: Vladimir Oltean @ 2022-02-16 23:59 UTC (permalink / raw)
To: Mans Rullgard
Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
Jakub Kicinski, Juergen Borleis, netdev, linux-kernel
On Wed, Feb 16, 2022 at 08:48:18PM +0000, Mans Rullgard wrote:
> 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>
> ---
Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: dsa: lan9303: add VLAN IDs to master device
2022-02-16 20:48 [PATCH v2] net: dsa: lan9303: add VLAN IDs to master device Mans Rullgard
2022-02-16 21:44 ` Florian Fainelli
2022-02-16 23:59 ` Vladimir Oltean
@ 2022-02-17 18:10 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 5+ messages in thread
From: patchwork-bot+netdevbpf @ 2022-02-17 18:10 UTC (permalink / raw)
To: Mans Rullgard
Cc: andrew, vivien.didelot, f.fainelli, olteanv, davem, kuba, kernel,
netdev, linux-kernel
Hello:
This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:
On Wed, 16 Feb 2022 20:48:18 +0000 you wrote:
> 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>
> ---
> Changes:
> - Fix dependency on VLAN_8021Q
> - Add missing #include
>
> [...]
Here is the summary with links:
- [v2] net: dsa: lan9303: add VLAN IDs to master device
https://git.kernel.org/netdev/net/c/430065e26719
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] net: dsa: lan9303: add VLAN IDs to master device
2022-02-16 23:59 ` Vladimir Oltean
@ 2022-02-20 17:00 ` Vladimir Oltean
0 siblings, 0 replies; 5+ messages in thread
From: Vladimir Oltean @ 2022-02-20 17:00 UTC (permalink / raw)
To: Mans Rullgard
Cc: Andrew Lunn, Vivien Didelot, Florian Fainelli, David S. Miller,
Jakub Kicinski, Juergen Borleis, netdev, linux-kernel
On Thu, Feb 17, 2022 at 01:59:30AM +0200, Vladimir Oltean wrote:
> On Wed, Feb 16, 2022 at 08:48:18PM +0000, Mans Rullgard wrote:
> > 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>
> > ---
>
> Reviewed-by: Vladimir Oltean <olteanv@gmail.com>
There's a problem with this patch.
CONFIG_NET_DSA_SMSC_LAN9303 is not user-selectable, but it is selected
by CONFIG_NET_DSA_SMSC_LAN9303_I2C or CONFIG_NET_DSA_SMSC_LAN9303_MDIO.
The point is that config options that aren't user-selectable but are
automatically selected shouldn't have dependencies. AFAIK, the
dependencies should be transferred to the user-facing options
(_I2C and _MDIO).
What happens is that if you make CONFIG_VLAN_8021Q a module, you get
this warning:
WARNING: unmet direct dependencies detected for NET_DSA_SMSC_LAN9303
Depends on [m]: NETDEVICES [=y] && NET_DSA [=y] && (VLAN_8021Q [=m] || VLAN_8021Q [=m]=n)
Selected by [y]:
- NET_DSA_SMSC_LAN9303_I2C [=y] && NETDEVICES [=y] && NET_DSA [=y] && I2C [=y]
- NET_DSA_SMSC_LAN9303_MDIO [=y] && NETDEVICES [=y] && NET_DSA [=y]
The point of the dependency was to force the LAN9303 driver as a module
if 8021Q is a module, but this doesn't happen because the dependency
isn't where it should be.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-02-20 17:00 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-16 20:48 [PATCH v2] net: dsa: lan9303: add VLAN IDs to master device Mans Rullgard
2022-02-16 21:44 ` Florian Fainelli
2022-02-16 23:59 ` Vladimir Oltean
2022-02-20 17:00 ` Vladimir Oltean
2022-02-17 18:10 ` patchwork-bot+netdevbpf
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).