net: mscc: ocelot: transmit the VLAN filtering restrictions via extack
authorVladimir Oltean <vladimir.oltean@nxp.com>
Thu, 19 Aug 2021 17:40:07 +0000 (20:40 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 20 Aug 2021 13:39:52 +0000 (14:39 +0100)
We need to transmit more restrictions in future patches, convert this
one to netlink extack.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/ocelot/felix.c
drivers/net/ethernet/mscc/ocelot.c
drivers/net/ethernet/mscc/ocelot_net.c
include/soc/mscc/ocelot.h

index 72d746f..3656e67 100644 (file)
@@ -770,7 +770,7 @@ static int felix_vlan_filtering(struct dsa_switch *ds, int port, bool enabled,
 {
        struct ocelot *ocelot = ds->priv;
 
-       return ocelot_port_vlan_filtering(ocelot, port, enabled);
+       return ocelot_port_vlan_filtering(ocelot, port, enabled, extack);
 }
 
 static int felix_vlan_add(struct dsa_switch *ds, int port,
index ccb8a98..e848e03 100644 (file)
@@ -223,7 +223,7 @@ static void ocelot_port_set_pvid(struct ocelot *ocelot, int port,
 }
 
 int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
-                              bool vlan_aware)
+                              bool vlan_aware, struct netlink_ext_ack *extack)
 {
        struct ocelot_vcap_block *block = &ocelot->block[VCAP_IS1];
        struct ocelot_port *ocelot_port = ocelot->ports[port];
@@ -233,8 +233,8 @@ int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port,
        list_for_each_entry(filter, &block->rules, list) {
                if (filter->ingress_port_mask & BIT(port) &&
                    filter->action.vid_replace_ena) {
-                       dev_err(ocelot->dev,
-                               "Cannot change VLAN state with vlan modify rules active\n");
+                       NL_SET_ERR_MSG_MOD(extack,
+                                          "Cannot change VLAN state with vlan modify rules active");
                        return -EBUSY;
                }
        }
index 690f39e..c0c465a 100644 (file)
@@ -913,7 +913,8 @@ static int ocelot_port_attr_set(struct net_device *dev, const void *ctx,
                ocelot_port_attr_ageing_set(ocelot, port, attr->u.ageing_time);
                break;
        case SWITCHDEV_ATTR_ID_BRIDGE_VLAN_FILTERING:
-               ocelot_port_vlan_filtering(ocelot, port, attr->u.vlan_filtering);
+               ocelot_port_vlan_filtering(ocelot, port, attr->u.vlan_filtering,
+                                          extack);
                break;
        case SWITCHDEV_ATTR_ID_BRIDGE_MC_DISABLED:
                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,
        ocelot_port_attr_ageing_set(ocelot, port, ageing_time);
 
        return ocelot_port_vlan_filtering(ocelot, port,
-                                         br_vlan_enabled(bridge_dev));
+                                         br_vlan_enabled(bridge_dev),
+                                         extack);
 }
 
 static int ocelot_switchdev_unsync(struct ocelot *ocelot, int port)
 {
        int err;
 
-       err = ocelot_port_vlan_filtering(ocelot, port, false);
+       err = ocelot_port_vlan_filtering(ocelot, port, false, NULL);
        if (err)
                return err;
 
index ac07230..06706a9 100644 (file)
@@ -807,7 +807,8 @@ int ocelot_get_sset_count(struct ocelot *ocelot, int port, int sset);
 int ocelot_get_ts_info(struct ocelot *ocelot, int port,
                       struct ethtool_ts_info *info);
 void ocelot_set_ageing_time(struct ocelot *ocelot, unsigned int msecs);
-int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled);
+int ocelot_port_vlan_filtering(struct ocelot *ocelot, int port, bool enabled,
+                              struct netlink_ext_ack *extack);
 void ocelot_bridge_stp_state_set(struct ocelot *ocelot, int port, u8 state);
 void ocelot_apply_bridge_fwd_mask(struct ocelot *ocelot);
 int ocelot_port_pre_bridge_flags(struct ocelot *ocelot, int port,