Skip to content

Commit 380702e

Browse files
committed
Merge branch 'Simplify-DSA-handling-of-VLAN-subinterface-offload'
Vladimir Oltean says: ==================== Simplify DSA handling of VLAN subinterface offload Depends on Vivien Didelot's patchset: https://patchwork.ozlabs.org/project/netdev/list/?series=127197&state=* This patchset removes a few strange-looking guards for -EOPNOTSUPP in dsa_slave_vlan_rx_add_vid and dsa_slave_vlan_rx_kill_vid, making that code path no longer possible. It also disables the code path for the sja1105 driver, which does support editing the VLAN table, but not hardware-accelerated VLAN sub-interfaces, therefore the check in the DSA core would be wrong. There was no better DSA callback to do this than .port_enable, i.e. at ndo_open time. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 1ddc5d9 + e9bf969 commit 380702e

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

drivers/net/dsa/sja1105/sja1105_main.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1728,6 +1728,21 @@ static void sja1105_teardown(struct dsa_switch *ds)
17281728
sja1105_static_config_free(&priv->static_config);
17291729
}
17301730

1731+
static int sja1105_port_enable(struct dsa_switch *ds, int port,
1732+
struct phy_device *phy)
1733+
{
1734+
struct net_device *slave;
1735+
1736+
if (!dsa_is_user_port(ds, port))
1737+
return 0;
1738+
1739+
slave = ds->ports[port].slave;
1740+
1741+
slave->features &= ~NETIF_F_HW_VLAN_CTAG_FILTER;
1742+
1743+
return 0;
1744+
}
1745+
17311746
static int sja1105_mgmt_xmit(struct dsa_switch *ds, int port, int slot,
17321747
struct sk_buff *skb, bool takets)
17331748
{
@@ -2049,6 +2064,7 @@ static const struct dsa_switch_ops sja1105_switch_ops = {
20492064
.get_ethtool_stats = sja1105_get_ethtool_stats,
20502065
.get_sset_count = sja1105_get_sset_count,
20512066
.get_ts_info = sja1105_get_ts_info,
2067+
.port_enable = sja1105_port_enable,
20522068
.port_fdb_dump = sja1105_fdb_dump,
20532069
.port_fdb_add = sja1105_fdb_add,
20542070
.port_fdb_del = sja1105_fdb_del,

net/dsa/slave.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1131,11 +1131,11 @@ static int dsa_slave_vlan_rx_add_vid(struct net_device *dev, __be16 proto,
11311131
}
11321132

11331133
ret = dsa_port_vid_add(dp, vid, 0);
1134-
if (ret && ret != -EOPNOTSUPP)
1134+
if (ret)
11351135
return ret;
11361136

11371137
ret = dsa_port_vid_add(dp->cpu_dp, vid, 0);
1138-
if (ret && ret != -EOPNOTSUPP)
1138+
if (ret)
11391139
return ret;
11401140

11411141
return 0;
@@ -1164,14 +1164,10 @@ static int dsa_slave_vlan_rx_kill_vid(struct net_device *dev, __be16 proto,
11641164
return -EBUSY;
11651165
}
11661166

1167-
ret = dsa_port_vid_del(dp, vid);
1168-
if (ret == -EOPNOTSUPP)
1169-
ret = 0;
1170-
11711167
/* Do not deprogram the CPU port as it may be shared with other user
11721168
* ports which can be members of this VLAN as well.
11731169
*/
1174-
return ret;
1170+
return dsa_port_vid_del(dp, vid);
11751171
}
11761172

11771173
static const struct ethtool_ops dsa_slave_ethtool_ops = {
@@ -1418,8 +1414,9 @@ int dsa_slave_create(struct dsa_port *port)
14181414
if (slave_dev == NULL)
14191415
return -ENOMEM;
14201416

1421-
slave_dev->features = master->vlan_features | NETIF_F_HW_TC |
1422-
NETIF_F_HW_VLAN_CTAG_FILTER;
1417+
slave_dev->features = master->vlan_features | NETIF_F_HW_TC;
1418+
if (ds->ops->port_vlan_add && ds->ops->port_vlan_del)
1419+
slave_dev->features |= NETIF_F_HW_VLAN_CTAG_FILTER;
14231420
slave_dev->hw_features |= NETIF_F_HW_TC;
14241421
slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
14251422
if (!IS_ERR_OR_NULL(port->mac))

0 commit comments

Comments
 (0)