Skip to content

Commit 7357eb3

Browse files
pmachatadavem330
authored andcommitted
mlxsw: spectrum_switchdev: Propagate extack on port VLAN events
After switchdev_handle_port_obj_add() was extended in a preceding patch, mlxsw_sp_port_obj_add() now takes an extack argument. Propagate it further by extending a callee chain from mlxsw_sp_port_vlans_add(), via mlxsw_sp_bridge_port_vlan_add() via mlxsw_sp_port_vlan_bridge_join() via mlxsw_sp_port_vlan_fid_join() to mlxsw_sp_bridge_ops.fid_get, adding an extack argument for each of them. This code path is used when a VLAN is added to a port netdevice if there already is an unoffloadable VXLAN device with that VLAN mapped. mlxsw_sp_bridge_8021d_port_join() is updated to obey the new interfaces changed by the abovementioned code, propagating extack ultimately from NETDEV_CHANGEUPPER events. Signed-off-by: Petr Machata <[email protected]> Acked-by: Jiri Pirko <[email protected]> Reviewed-by: Ido Schimmel <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 0a5a2ae commit 7357eb3

File tree

1 file changed

+23
-15
lines changed

1 file changed

+23
-15
lines changed

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

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ struct mlxsw_sp_bridge_ops {
8989
struct netlink_ext_ack *extack);
9090
struct mlxsw_sp_fid *
9191
(*fid_get)(struct mlxsw_sp_bridge_device *bridge_device,
92-
u16 vid);
92+
u16 vid, struct netlink_ext_ack *extack);
9393
struct mlxsw_sp_fid *
9494
(*fid_lookup)(struct mlxsw_sp_bridge_device *bridge_device,
9595
u16 vid);
@@ -933,7 +933,8 @@ static int mlxsw_sp_port_attr_set(struct net_device *dev,
933933

934934
static int
935935
mlxsw_sp_port_vlan_fid_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
936-
struct mlxsw_sp_bridge_port *bridge_port)
936+
struct mlxsw_sp_bridge_port *bridge_port,
937+
struct netlink_ext_ack *extack)
937938
{
938939
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
939940
struct mlxsw_sp_bridge_device *bridge_device;
@@ -943,7 +944,7 @@ mlxsw_sp_port_vlan_fid_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
943944
int err;
944945

945946
bridge_device = bridge_port->bridge_device;
946-
fid = bridge_device->ops->fid_get(bridge_device, vid);
947+
fid = bridge_device->ops->fid_get(bridge_device, vid, extack);
947948
if (IS_ERR(fid))
948949
return PTR_ERR(fid);
949950

@@ -1011,7 +1012,8 @@ mlxsw_sp_port_pvid_determine(const struct mlxsw_sp_port *mlxsw_sp_port,
10111012

10121013
static int
10131014
mlxsw_sp_port_vlan_bridge_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
1014-
struct mlxsw_sp_bridge_port *bridge_port)
1015+
struct mlxsw_sp_bridge_port *bridge_port,
1016+
struct netlink_ext_ack *extack)
10151017
{
10161018
struct mlxsw_sp_port *mlxsw_sp_port = mlxsw_sp_port_vlan->mlxsw_sp_port;
10171019
struct mlxsw_sp_bridge_vlan *bridge_vlan;
@@ -1024,7 +1026,8 @@ mlxsw_sp_port_vlan_bridge_join(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan,
10241026
return 0;
10251027
}
10261028

1027-
err = mlxsw_sp_port_vlan_fid_join(mlxsw_sp_port_vlan, bridge_port);
1029+
err = mlxsw_sp_port_vlan_fid_join(mlxsw_sp_port_vlan, bridge_port,
1030+
extack);
10281031
if (err)
10291032
return err;
10301033

@@ -1101,7 +1104,8 @@ mlxsw_sp_port_vlan_bridge_leave(struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan)
11011104
static int
11021105
mlxsw_sp_bridge_port_vlan_add(struct mlxsw_sp_port *mlxsw_sp_port,
11031106
struct mlxsw_sp_bridge_port *bridge_port,
1104-
u16 vid, bool is_untagged, bool is_pvid)
1107+
u16 vid, bool is_untagged, bool is_pvid,
1108+
struct netlink_ext_ack *extack)
11051109
{
11061110
u16 pvid = mlxsw_sp_port_pvid_determine(mlxsw_sp_port, vid, is_pvid);
11071111
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
@@ -1121,7 +1125,8 @@ mlxsw_sp_bridge_port_vlan_add(struct mlxsw_sp_port *mlxsw_sp_port,
11211125
if (err)
11221126
goto err_port_pvid_set;
11231127

1124-
err = mlxsw_sp_port_vlan_bridge_join(mlxsw_sp_port_vlan, bridge_port);
1128+
err = mlxsw_sp_port_vlan_bridge_join(mlxsw_sp_port_vlan, bridge_port,
1129+
extack);
11251130
if (err)
11261131
goto err_port_vlan_bridge_join;
11271132

@@ -1171,7 +1176,8 @@ mlxsw_sp_br_ban_rif_pvid_change(struct mlxsw_sp *mlxsw_sp,
11711176

11721177
static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
11731178
const struct switchdev_obj_port_vlan *vlan,
1174-
struct switchdev_trans *trans)
1179+
struct switchdev_trans *trans,
1180+
struct netlink_ext_ack *extack)
11751181
{
11761182
bool flag_untagged = vlan->flags & BRIDGE_VLAN_INFO_UNTAGGED;
11771183
bool flag_pvid = vlan->flags & BRIDGE_VLAN_INFO_PVID;
@@ -1208,7 +1214,7 @@ static int mlxsw_sp_port_vlans_add(struct mlxsw_sp_port *mlxsw_sp_port,
12081214

12091215
err = mlxsw_sp_bridge_port_vlan_add(mlxsw_sp_port, bridge_port,
12101216
vid, flag_untagged,
1211-
flag_pvid);
1217+
flag_pvid, extack);
12121218
if (err)
12131219
return err;
12141220
}
@@ -1787,7 +1793,8 @@ static int mlxsw_sp_port_obj_add(struct net_device *dev,
17871793
switch (obj->id) {
17881794
case SWITCHDEV_OBJ_ID_PORT_VLAN:
17891795
vlan = SWITCHDEV_OBJ_PORT_VLAN(obj);
1790-
err = mlxsw_sp_port_vlans_add(mlxsw_sp_port, vlan, trans);
1796+
err = mlxsw_sp_port_vlans_add(mlxsw_sp_port, vlan, trans,
1797+
extack);
17911798

17921799
if (switchdev_trans_ph_prepare(trans)) {
17931800
/* The event is emitted before the changes are actually
@@ -2087,7 +2094,7 @@ mlxsw_sp_bridge_8021q_vxlan_dev_find(struct net_device *br_dev, u16 vid)
20872094

20882095
static struct mlxsw_sp_fid *
20892096
mlxsw_sp_bridge_8021q_fid_get(struct mlxsw_sp_bridge_device *bridge_device,
2090-
u16 vid)
2097+
u16 vid, struct netlink_ext_ack *extack)
20912098
{
20922099
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev);
20932100
struct net_device *vxlan_dev;
@@ -2113,7 +2120,7 @@ mlxsw_sp_bridge_8021q_fid_get(struct mlxsw_sp_bridge_device *bridge_device,
21132120
return fid;
21142121

21152122
err = mlxsw_sp_bridge_8021q_vxlan_join(bridge_device, vxlan_dev, vid,
2116-
NULL);
2123+
extack);
21172124
if (err)
21182125
goto err_vxlan_join;
21192126

@@ -2190,7 +2197,8 @@ mlxsw_sp_bridge_8021d_port_join(struct mlxsw_sp_bridge_device *bridge_device,
21902197
if (mlxsw_sp_port_vlan->fid)
21912198
mlxsw_sp_port_vlan_router_leave(mlxsw_sp_port_vlan);
21922199

2193-
return mlxsw_sp_port_vlan_bridge_join(mlxsw_sp_port_vlan, bridge_port);
2200+
return mlxsw_sp_port_vlan_bridge_join(mlxsw_sp_port_vlan, bridge_port,
2201+
extack);
21942202
}
21952203

21962204
static void
@@ -2253,7 +2261,7 @@ mlxsw_sp_bridge_8021d_vxlan_join(struct mlxsw_sp_bridge_device *bridge_device,
22532261

22542262
static struct mlxsw_sp_fid *
22552263
mlxsw_sp_bridge_8021d_fid_get(struct mlxsw_sp_bridge_device *bridge_device,
2256-
u16 vid)
2264+
u16 vid, struct netlink_ext_ack *extack)
22572265
{
22582266
struct mlxsw_sp *mlxsw_sp = mlxsw_sp_lower_get(bridge_device->dev);
22592267
struct net_device *vxlan_dev;
@@ -2275,7 +2283,7 @@ mlxsw_sp_bridge_8021d_fid_get(struct mlxsw_sp_bridge_device *bridge_device,
22752283
return fid;
22762284

22772285
err = mlxsw_sp_bridge_8021d_vxlan_join(bridge_device, vxlan_dev, 0,
2278-
NULL);
2286+
extack);
22792287
if (err)
22802288
goto err_vxlan_join;
22812289

0 commit comments

Comments
 (0)