提交 90e0f0c1 编写于 作者: N Nogah Frankel 提交者: David S. Miller

mlxsw: spectrum: Update mc_disabled flag by switchdev attr

Add a function to update mc_disabled from switchdev attr
SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED
Signed-off-by: NNogah Frankel <nogahf@mellanox.com>
Signed-off-by: NYotam Gigi <yotamg@mellanox.com>
Signed-off-by: NJiri Pirko <jiri@mellanox.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 1e5d9432
...@@ -274,6 +274,30 @@ static int mlxsw_sp_port_flood_table_set(struct mlxsw_sp_port *mlxsw_sp_port, ...@@ -274,6 +274,30 @@ static int mlxsw_sp_port_flood_table_set(struct mlxsw_sp_port *mlxsw_sp_port,
return err; return err;
} }
static int mlxsw_sp_port_mc_disabled_set(struct mlxsw_sp_port *mlxsw_sp_port,
struct switchdev_trans *trans,
bool mc_disabled)
{
int set;
int err = 0;
if (switchdev_trans_ph_prepare(trans))
return 0;
if (mlxsw_sp_port->mc_router != mlxsw_sp_port->mc_flood) {
set = mc_disabled ?
mlxsw_sp_port->mc_flood : mlxsw_sp_port->mc_router;
err = mlxsw_sp_port_flood_table_set(mlxsw_sp_port,
MLXSW_SP_FLOOD_TABLE_MC,
set);
}
if (!err)
mlxsw_sp_port->mc_disabled = mc_disabled;
return err;
}
int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 fid, int mlxsw_sp_vport_flood_set(struct mlxsw_sp_port *mlxsw_sp_vport, u16 fid,
bool set) bool set)
{ {
...@@ -461,6 +485,10 @@ static int mlxsw_sp_port_attr_set(struct net_device *dev, ...@@ -461,6 +485,10 @@ static int mlxsw_sp_port_attr_set(struct net_device *dev,
err = mlxsw_sp_port_attr_mc_router_set(mlxsw_sp_port, trans, err = mlxsw_sp_port_attr_mc_router_set(mlxsw_sp_port, trans,
attr->u.mrouter); attr->u.mrouter);
break; break;
case SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED:
err = mlxsw_sp_port_mc_disabled_set(mlxsw_sp_port, trans,
attr->u.mc_disabled);
break;
default: default:
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册