Commit 2a130551 authored by Vladimir Oltean's avatar Vladimir Oltean Committed by David S. Miller

net: dsa: mt7530: Use the DSA vlan_filtering helper function

This was recently introduced, so keeping state inside the driver is no
longer necessary.
Signed-off-by: default avatarVladimir Oltean <olteanv@gmail.com>
Suggested-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cf2d45f5
...@@ -828,11 +828,9 @@ mt7530_port_set_vlan_unaware(struct dsa_switch *ds, int port) ...@@ -828,11 +828,9 @@ mt7530_port_set_vlan_unaware(struct dsa_switch *ds, int port)
mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK, mt7530_rmw(priv, MT7530_PVC_P(port), VLAN_ATTR_MASK,
VLAN_ATTR(MT7530_VLAN_TRANSPARENT)); VLAN_ATTR(MT7530_VLAN_TRANSPARENT));
priv->ports[port].vlan_filtering = false;
for (i = 0; i < MT7530_NUM_PORTS; i++) { for (i = 0; i < MT7530_NUM_PORTS; i++) {
if (dsa_is_user_port(ds, i) && if (dsa_is_user_port(ds, i) &&
priv->ports[i].vlan_filtering) { dsa_port_is_vlan_filtering(&ds->ports[i])) {
all_user_ports_removed = false; all_user_ports_removed = false;
break; break;
} }
...@@ -891,8 +889,8 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port, ...@@ -891,8 +889,8 @@ mt7530_port_bridge_leave(struct dsa_switch *ds, int port,
* And the other port's port matrix cannot be broken when the * And the other port's port matrix cannot be broken when the
* other port is still a VLAN-aware port. * other port is still a VLAN-aware port.
*/ */
if (!priv->ports[i].vlan_filtering && if (dsa_is_user_port(ds, i) && i != port &&
dsa_is_user_port(ds, i) && i != port) { !dsa_port_is_vlan_filtering(&ds->ports[i])) {
if (dsa_to_port(ds, i)->bridge_dev != bridge) if (dsa_to_port(ds, i)->bridge_dev != bridge)
continue; continue;
if (priv->ports[i].enable) if (priv->ports[i].enable)
...@@ -1011,10 +1009,6 @@ static int ...@@ -1011,10 +1009,6 @@ static int
mt7530_port_vlan_filtering(struct dsa_switch *ds, int port, mt7530_port_vlan_filtering(struct dsa_switch *ds, int port,
bool vlan_filtering) bool vlan_filtering)
{ {
struct mt7530_priv *priv = ds->priv;
priv->ports[port].vlan_filtering = vlan_filtering;
if (vlan_filtering) { if (vlan_filtering) {
/* The port is being kept as VLAN-unaware port when bridge is /* The port is being kept as VLAN-unaware port when bridge is
* set up with vlan_filtering not being set, Otherwise, the * set up with vlan_filtering not being set, Otherwise, the
...@@ -1139,7 +1133,7 @@ mt7530_port_vlan_add(struct dsa_switch *ds, int port, ...@@ -1139,7 +1133,7 @@ mt7530_port_vlan_add(struct dsa_switch *ds, int port,
/* The port is kept as VLAN-unaware if bridge with vlan_filtering not /* The port is kept as VLAN-unaware if bridge with vlan_filtering not
* being set. * being set.
*/ */
if (!priv->ports[port].vlan_filtering) if (!dsa_port_is_vlan_filtering(&ds->ports[port]))
return; return;
mutex_lock(&priv->reg_mutex); mutex_lock(&priv->reg_mutex);
...@@ -1170,7 +1164,7 @@ mt7530_port_vlan_del(struct dsa_switch *ds, int port, ...@@ -1170,7 +1164,7 @@ mt7530_port_vlan_del(struct dsa_switch *ds, int port,
/* The port is kept as VLAN-unaware if bridge with vlan_filtering not /* The port is kept as VLAN-unaware if bridge with vlan_filtering not
* being set. * being set.
*/ */
if (!priv->ports[port].vlan_filtering) if (!dsa_port_is_vlan_filtering(&ds->ports[port]))
return 0; return 0;
mutex_lock(&priv->reg_mutex); mutex_lock(&priv->reg_mutex);
......
...@@ -410,7 +410,6 @@ struct mt7530_port { ...@@ -410,7 +410,6 @@ struct mt7530_port {
bool enable; bool enable;
u32 pm; u32 pm;
u16 pvid; u16 pvid;
bool vlan_filtering;
}; };
/* struct mt7530_priv - This is the main data structure for holding the state /* struct mt7530_priv - This is the main data structure for holding the state
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment