Skip to content

Commit 3b95d1b

Browse files
vladimirolteandavem330
authored andcommitted
net: mscc: ocelot: transmit the VLAN filtering restrictions via extack
We need to transmit more restrictions in future patches, convert this one to netlink extack. Signed-off-by: Vladimir Oltean <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 01af940 commit 3b95d1b

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

drivers/net/dsa/ocelot/felix.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ static int felix_vlan_filtering(struct dsa_switch *ds, int port, bool enabled,
770770
{
771771
struct ocelot *ocelot = ds->priv;
772772

773-
return ocelot_port_vlan_filtering(ocelot, port, enabled);
773+
return ocelot_port_vlan_filtering(ocelot, port, enabled, extack);
774774
}
775775

776776
static int felix_vlan_add(struct dsa_switch *ds, int port,

drivers/net/ethernet/mscc/ocelot.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static void ocelot_port_set_pvid(struct ocelot *ocelot, int port,
223223
}
224224

225225
int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
226-
bool vlan_aware)
226+
bool vlan_aware, struct netlink_ext_ack *extack)
227227
{
228228
struct ocelot_vcap_block *block = &ocelot->block[VCAP_IS1];
229229
struct ocelot_port *ocelot_port = ocelot->ports[port];
@@ -233,8 +233,8 @@ int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
233233
list_for_each_entry(filter, &block->rules, list) {
234234
if (filter->ingress_port_mask & BIT(port) &&
235235
filter->action.vid_replace_ena) {
236-
dev_err(ocelot->dev,
237-
"Cannot change VLAN state with vlan modify rules active\n");
236+
NL_SET_ERR_MSG_MOD(extack,
237+
"Cannot change VLAN state with vlan modify rules active");
238238
return -EBUSY;
239239
}
240240
}

drivers/net/ethernet/mscc/ocelot_net.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -913,7 +913,8 @@ static int ocelot_port_attr_set(struct net_device *dev, const void *ctx,
913913
ocelot_port_attr_ageing_set(ocelot, port, attr->u.ageing_time);
914914
break;
915915
case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING:
916-
ocelot_port_vlan_filtering(ocelot, port, attr->u.vlan_filtering);
916+
ocelot_port_vlan_filtering(ocelot, port, attr->u.vlan_filtering,
917+
extack);
917918
break;
918919
case SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED:
919920
ocelot_port_attr_mc_set(ocelot, port, !attr->u.mc_disabled);
@@ -1133,14 +1134,15 @@ static int ocelot_switchdev_sync(struct ocelot *ocelot, int port,
11331134
ocelot_port_attr_ageing_set(ocelot, port, ageing_time);
11341135

11351136
return ocelot_port_vlan_filtering(ocelot, port,
1136-
br_vlan_enabled(bridge_dev));
1137+
br_vlan_enabled(bridge_dev),
1138+
extack);
11371139
}
11381140

11391141
static int ocelot_switchdev_unsync(struct ocelot *ocelot, int port)
11401142
{
11411143
int err;
11421144

1143-
err = ocelot_port_vlan_filtering(ocelot, port, false);
1145+
err = ocelot_port_vlan_filtering(ocelot, port, false, NULL);
11441146
if (err)
11451147
return err;
11461148

include/soc/mscc/ocelot.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -807,7 +807,8 @@ int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset);
807807
int ocelot_get_ts_info(struct ocelot *ocelot, int port,
808808
struct ethtool_ts_info *info);
809809
void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs);
810-
int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled);
810+
int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled,
811+
struct netlink_ext_ack *extack);
811812
void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
812813
void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot);
813814
int ocelot_port_pre_bridge_flags(struct ocelot *ocelot, int port,

0 commit comments

Comments
 (0)