net: dsa: pass extack to dsa_switch_ops :: port_mirror_add()
authorVladimir Oltean <vladimir.oltean@nxp.com>
Wed, 16 Mar 2022 20:41:43 +0000 (22:41 +0200)
committerJakub Kicinski <kuba@kernel.org>
Fri, 18 Mar 2022 00:42:47 +0000 (17:42 -0700)
Drivers might have error messages to propagate to user space, most
common being that they support a single mirror port.

Propagate the netlink extack so that they can inform user space in a
verbal way of their limitations.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/dsa/b53/b53_common.c
drivers/net/dsa/b53/b53_priv.h
drivers/net/dsa/microchip/ksz8795.c
drivers/net/dsa/microchip/ksz9477.c
drivers/net/dsa/mt7530.c
drivers/net/dsa/mv88e6xxx/chip.c
drivers/net/dsa/qca8k.c
drivers/net/dsa/sja1105/sja1105_main.c
include/net/dsa.h
net/dsa/slave.c

index 122e6376297901d2e607e36613d40e9ac8c3c61d..77501f9c59159e4ad3870ba7b2cd9ef14108dc93 100644 (file)
@@ -2110,7 +2110,8 @@ out:
 EXPORT_SYMBOL(b53_get_tag_protocol);
 
 int b53_mirror_add(struct dsa_switch *ds, int port,
-                  struct dsa_mall_mirror_tc_entry *mirror, bool ingress)
+                  struct dsa_mall_mirror_tc_entry *mirror, bool ingress,
+                  struct netlink_ext_ack *extack)
 {
        struct b53_device *dev = ds->priv;
        u16 reg, loc;
index 86e7eb7924e750b4a291290bb3c94dd3c53a79bd..3085b6cc7d407e935b98a262d65d04853b9f591f 100644 (file)
@@ -373,7 +373,8 @@ int b53_mdb_del(struct dsa_switch *ds, int port,
                const struct switchdev_obj_port_mdb *mdb,
                struct dsa_db db);
 int b53_mirror_add(struct dsa_switch *ds, int port,
-                  struct dsa_mall_mirror_tc_entry *mirror, bool ingress);
+                  struct dsa_mall_mirror_tc_entry *mirror, bool ingress,
+                  struct netlink_ext_ack *extack);
 enum dsa_tag_protocol b53_get_tag_protocol(struct dsa_switch *ds, int port,
                                           enum dsa_tag_protocol mprot);
 void b53_mirror_del(struct dsa_switch *ds, int port,
index 6f9cdd5204fb686d1a345c85f4ac9062cb9d1740..b2752978cb0919ec998f75ff329c55bb7e6e0f41 100644 (file)
@@ -1233,7 +1233,7 @@ static int ksz8_port_vlan_del(struct dsa_switch *ds, int port,
 
 static int ksz8_port_mirror_add(struct dsa_switch *ds, int port,
                                struct dsa_mall_mirror_tc_entry *mirror,
-                               bool ingress)
+                               bool ingress, struct netlink_ext_ack *extack)
 {
        struct ksz_device *dev = ds->priv;
 
index a4699481c746549819dc9de532642bf472f94900..8222c8a6c5ec56969a7edd951a46215d0e0220f8 100644 (file)
@@ -1018,7 +1018,7 @@ exit:
 
 static int ksz9477_port_mirror_add(struct dsa_switch *ds, int port,
                                   struct dsa_mall_mirror_tc_entry *mirror,
-                                  bool ingress)
+                                  bool ingress, struct netlink_ext_ack *extack)
 {
        struct ksz_device *dev = ds->priv;
 
index 669f008528ecf5805c91e09c5e6a63819abd1e37..19f0035d4410ff109021680cc32d44af25d2aad3 100644 (file)
@@ -1714,7 +1714,7 @@ static int mt753x_mirror_port_set(unsigned int id, u32 val)
 
 static int mt753x_port_mirror_add(struct dsa_switch *ds, int port,
                                  struct dsa_mall_mirror_tc_entry *mirror,
-                                 bool ingress)
+                                 bool ingress, struct netlink_ext_ack *extack)
 {
        struct mt7530_priv *priv = ds->priv;
        int monitor_port;
index bed1a5658eac0db259ac5e28ff1666867897badf..b36393ba6d49e3b6d545a130211ac4a5250d2c0c 100644 (file)
@@ -6321,7 +6321,8 @@ static int mv88e6xxx_port_mdb_del(struct dsa_switch *ds, int port,
 
 static int mv88e6xxx_port_mirror_add(struct dsa_switch *ds, int port,
                                     struct dsa_mall_mirror_tc_entry *mirror,
-                                    bool ingress)
+                                    bool ingress,
+                                    struct netlink_ext_ack *extack)
 {
        enum mv88e6xxx_egress_direction direction = ingress ?
                                                MV88E6XXX_EGRESS_DIR_INGRESS :
index ee0dbf32426855c7f35c96c96aabde8353ff773c..d3ed0a7f80771cfbcffe8bf60a68e4c0a7199597 100644 (file)
@@ -2473,7 +2473,7 @@ qca8k_port_mdb_del(struct dsa_switch *ds, int port,
 static int
 qca8k_port_mirror_add(struct dsa_switch *ds, int port,
                      struct dsa_mall_mirror_tc_entry *mirror,
-                     bool ingress)
+                     bool ingress, struct netlink_ext_ack *extack)
 {
        struct qca8k_priv *priv = ds->priv;
        int monitor_port, ret;
index 3358e979342cc8d139047871e8f8ce45766e4c3a..b33841c6507ae89dcc80f220825ab22c5a318cdb 100644 (file)
@@ -2847,7 +2847,7 @@ static int sja1105_mirror_apply(struct sja1105_private *priv, int from, int to,
 
 static int sja1105_mirror_add(struct dsa_switch *ds, int port,
                              struct dsa_mall_mirror_tc_entry *mirror,
-                             bool ingress)
+                             bool ingress, struct netlink_ext_ack *extack)
 {
        return sja1105_mirror_apply(ds->priv, port, mirror->to_local_port,
                                    ingress, true);
index 06cdefd3b9ddf4d629d28c6147b1afcb13085f46..934958fda96281f37e63bacadf5fe6ede8d1d56b 100644 (file)
@@ -1028,7 +1028,7 @@ struct dsa_switch_ops {
                                    struct flow_cls_offload *cls, bool ingress);
        int     (*port_mirror_add)(struct dsa_switch *ds, int port,
                                   struct dsa_mall_mirror_tc_entry *mirror,
-                                  bool ingress);
+                                  bool ingress, struct netlink_ext_ack *extack);
        void    (*port_mirror_del)(struct dsa_switch *ds, int port,
                                   struct dsa_mall_mirror_tc_entry *mirror);
        int     (*port_policer_add)(struct dsa_switch *ds, int port,
index 54e5447c86a8ddf37d37f022192eb9125b9002ca..d1a3be158d8de25510274143bb386288ada03520 100644 (file)
@@ -1173,6 +1173,7 @@ dsa_slave_add_cls_matchall_mirred(struct net_device *dev,
                                  struct tc_cls_matchall_offload *cls,
                                  bool ingress)
 {
+       struct netlink_ext_ack *extack = cls->common.extack;
        struct dsa_port *dp = dsa_slave_to_port(dev);
        struct dsa_slave_priv *p = netdev_priv(dev);
        struct dsa_mall_mirror_tc_entry *mirror;
@@ -1210,7 +1211,7 @@ dsa_slave_add_cls_matchall_mirred(struct net_device *dev,
        mirror->to_local_port = to_dp->index;
        mirror->ingress = ingress;
 
-       err = ds->ops->port_mirror_add(ds, dp->index, mirror, ingress);
+       err = ds->ops->port_mirror_add(ds, dp->index, mirror, ingress, extack);
        if (err) {
                kfree(mall_tc_entry);
                return err;