Skip to content

Commit c19c44f

Browse files
ffainellidavem330
authored andcommitted
mlxsw: spectrum: Handle PORT_PRE_BRIDGE_FLAGS
In preparation for getting rid of switchdev_port_attr_get(), have mlxsw check for the bridge flags being set through switchdev_port_attr_set() when the SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS attribute identifier is used. Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Ido Schimmel <idosch@mellanox.com> Acked-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 746dc18 commit c19c44f

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,17 @@ mlxsw_sp_bridge_port_learning_set(struct mlxsw_sp_port *mlxsw_sp_port,
595595
return err;
596596
}
597597

598+
static int mlxsw_sp_port_attr_br_pre_flags_set(struct mlxsw_sp_port
599+
*mlxsw_sp_port,
600+
struct switchdev_trans *trans,
601+
unsigned long brport_flags)
602+
{
603+
if (brport_flags & ~(BR_LEARNING | BR_FLOOD | BR_MCAST_FLOOD))
604+
return -EINVAL;
605+
606+
return 0;
607+
}
608+
598609
static int mlxsw_sp_port_attr_br_flags_set(struct mlxsw_sp_port *mlxsw_sp_port,
599610
struct switchdev_trans *trans,
600611
struct net_device *orig_dev,
@@ -841,6 +852,11 @@ static int mlxsw_sp_port_attr_set(struct net_device *dev,
841852
attr->orig_dev,
842853
attr->u.stp_state);
843854
break;
855+
case SWITCHDEV_ATTR_ID_PORT_PRE_BRIDGE_FLAGS:
856+
err = mlxsw_sp_port_attr_br_pre_flags_set(mlxsw_sp_port,
857+
trans,
858+
attr->u.brport_flags);
859+
break;
844860
case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
845861
err = mlxsw_sp_port_attr_br_flags_set(mlxsw_sp_port, trans,
846862
attr->orig_dev,

0 commit comments

Comments
 (0)