diff options
author | Ioana Ciornei <ioana.ciornei@nxp.com> | 2020-07-21 12:19:15 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-07-21 16:53:34 +0200 |
commit | af85d0e06c6ab1a2d9432cf5923a1a5de816ac22 (patch) | |
tree | 48f20e4f91ab30fb381dcaef4f98aa59e671b0e2 /drivers/staging/fsl-dpaa2 | |
parent | b99a3f7093be7d7ff67491f75bf24fd60d8ba774 (diff) | |
download | linux-af85d0e06c6ab1a2d9432cf5923a1a5de816ac22.tar.bz2 |
staging: dpaa2-ethsw: don't allow interfaces from different DPSWs to be bridged
Error out when the user tries to bridge two switch interfaces that are
from different DPSW instances. This is not supported by the hardware and
we should reflect this into what the user is aware of.
Signed-off-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Link: https://lore.kernel.org/r/20200721091919.20394-3-ioana.ciornei@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/fsl-dpaa2')
-rw-r--r-- | drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 15 |
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) |