Skip to content

Commit 6d46a4f

Browse files
IoanaCiorneidavem330
authored andcommitted
dpaa2-switch: move a check to the prechangeupper stage
Two different DPAA2 switch ports from two different DPSW instances cannot be under the same bridge. Instead of checking for this unsupported configuration in the CHANGEUPPER event, check it as early as possible in the PRECHANGEUPPER one. Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Ioana Ciornei <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a8150c9 commit 6d46a4f

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

drivers/net/ethernet/freescale/dpaa2/dpaa2-switch.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,24 +2005,9 @@ static int dpaa2_switch_port_bridge_join(struct net_device *netdev,
20052005
{
20062006
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
20072007
struct ethsw_core *ethsw = port_priv->ethsw_data;
2008-
struct ethsw_port_priv *other_port_priv;
2009-
struct net_device *other_dev;
2010-
struct list_head *iter;
20112008
bool learn_ena;
20122009
int err;
20132010

2014-
netdev_for_each_lower_dev(upper_dev, other_dev, iter) {
2015-
if (!dpaa2_switch_port_dev_check(other_dev))
2016-
continue;
2017-
2018-
other_port_priv = netdev_priv(other_dev);
2019-
if (other_port_priv->ethsw_data != port_priv->ethsw_data) {
2020-
NL_SET_ERR_MSG_MOD(extack,
2021-
"Interface from a different DPSW is in the bridge already");
2022-
return -EINVAL;
2023-
}
2024-
}
2025-
20262011
/* Delete the previously manually installed VLAN 1 */
20272012
err = dpaa2_switch_port_del_vlan(port_priv, 1);
20282013
if (err)
@@ -2156,6 +2141,10 @@ dpaa2_switch_prechangeupper_sanity_checks(struct net_device *netdev,
21562141
struct net_device *upper_dev,
21572142
struct netlink_ext_ack *extack)
21582143
{
2144+
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
2145+
struct ethsw_port_priv *other_port_priv;
2146+
struct net_device *other_dev;
2147+
struct list_head *iter;
21592148
int err;
21602149

21612150
if (!br_vlan_enabled(upper_dev)) {
@@ -2170,6 +2159,18 @@ dpaa2_switch_prechangeupper_sanity_checks(struct net_device *netdev,
21702159
return 0;
21712160
}
21722161

2162+
netdev_for_each_lower_dev(upper_dev, other_dev, iter) {
2163+
if (!dpaa2_switch_port_dev_check(other_dev))
2164+
continue;
2165+
2166+
other_port_priv = netdev_priv(other_dev);
2167+
if (other_port_priv->ethsw_data != port_priv->ethsw_data) {
2168+
NL_SET_ERR_MSG_MOD(extack,
2169+
"Interface from a different DPSW is in the bridge already");
2170+
return -EINVAL;
2171+
}
2172+
}
2173+
21732174
return 0;
21742175
}
21752176

0 commit comments

Comments
 (0)