aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/staging/fsl-dpaa2/ethsw/ethsw.c')
-rw-r--r--drivers/staging/fsl-dpaa2/ethsw/ethsw.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index 59ad7c75341a..f0d10afb1460 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -1182,6 +1182,9 @@ static int port_bridge_join(struct net_device *netdev,
{
struct ethsw_port_priv *port_priv = netdev_priv(netdev);
struct ethsw_core *ethsw = port_priv->ethsw_data;
+ struct ethsw_port_priv *other_port_priv;
+ struct net_device *other_dev;
+ struct list_head *iter;
int i, err;
for (i = 0; i < ethsw->sw_attr.num_ifs; i++)
@@ -1192,6 +1195,18 @@ static int port_bridge_join(struct net_device *netdev,
return -EINVAL;
}
+ netdev_for_each_lower_dev(upper_dev, other_dev, iter) {
+ if (!ethsw_port_dev_check(other_dev, NULL))
+ continue;
+
+ other_port_priv = netdev_priv(other_dev);
+ if (other_port_priv->ethsw_data != port_priv->ethsw_data) {
+ netdev_err(netdev,
+ "Interface from a different DPSW is in the bridge already!\n");
+ return -EINVAL;
+ }
+ }
+
/* Enable flooding */
err = ethsw_port_set_flood(port_priv, 1);
if (!err)