Skip to content

Commit 3bb500c

Browse files
vladimirolteankuba-moo
authored andcommitted
net: dsa: lantiq_gswip: drop untagged on VLAN-aware bridge ports with no PVID
Implement the required functionality, as written in Documentation/networking/switchdev.rst section "Bridge VLAN filtering", by using the "VLAN Ingress Tag Rule" feature of the switch. The bit field definitions for this were found while browsing the Intel dual BSD/GPLv2 licensed drivers for this switch IP. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: Daniel Golle <[email protected]> Link: https://patch.msgid.link/787aa807d00b726d75db2a40add215c8b8ba7466.1760566491.git.daniel@makrotopia.org Signed-off-by: Jakub Kicinski <[email protected]>
1 parent a576276 commit 3bb500c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

drivers/net/dsa/lantiq/lantiq_gswip.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,7 @@ static void gswip_port_commit_pvid(struct gswip_priv *priv, int port)
551551
{
552552
struct dsa_port *dp = dsa_to_port(priv->ds, port);
553553
struct net_device *br = dsa_port_bridge_dev_get(dp);
554+
u32 vinr;
554555
int idx;
555556

556557
if (!dsa_port_is_user(dp))
@@ -582,6 +583,11 @@ static void gswip_port_commit_pvid(struct gswip_priv *priv, int port)
582583
idx = port + 1;
583584
}
584585

586+
vinr = idx ? GSWIP_PCE_VCTRL_VINR_ALL : GSWIP_PCE_VCTRL_VINR_TAGGED;
587+
gswip_switch_mask(priv, GSWIP_PCE_VCTRL_VINR,
588+
FIELD_PREP(GSWIP_PCE_VCTRL_VINR, vinr),
589+
GSWIP_PCE_VCTRL(port));
590+
585591
/* GSWIP 2.2 (GRX300) and later program here the VID directly. */
586592
gswip_switch_w(priv, idx, GSWIP_PCE_DEFPVID(port));
587593
}

drivers/net/dsa/lantiq/lantiq_gswip.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@
159159
#define GSWIP_PCE_PCTRL_0_PSTATE_MASK GENMASK(2, 0)
160160
#define GSWIP_PCE_VCTRL(p) (0x485 + ((p) * 0xA))
161161
#define GSWIP_PCE_VCTRL_UVR BIT(0) /* Unknown VLAN Rule */
162+
#define GSWIP_PCE_VCTRL_VINR GENMASK(2, 1) /* VLAN Ingress Tag Rule */
163+
#define GSWIP_PCE_VCTRL_VINR_ALL 0 /* Admit tagged and untagged packets */
164+
#define GSWIP_PCE_VCTRL_VINR_TAGGED 1 /* Admit only tagged packets */
165+
#define GSWIP_PCE_VCTRL_VINR_UNTAGGED 2 /* Admit only untagged packets */
162166
#define GSWIP_PCE_VCTRL_VIMR BIT(3) /* VLAN Ingress Member violation rule */
163167
#define GSWIP_PCE_VCTRL_VEMR BIT(4) /* VLAN Egress Member violation rule */
164168
#define GSWIP_PCE_VCTRL_VSR BIT(5) /* VLAN Security */

0 commit comments

Comments
 (0)