net: switchdev: propagate extack to port attributes
authorVladimir Oltean <vladimir.oltean@nxp.com>
Fri, 12 Feb 2021 15:15:51 +0000 (17:15 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 13 Feb 2021 01:08:04 +0000 (17:08 -0800)
When a struct switchdev_attr is notified through switchdev, there is no
way to report informational messages, unlike for struct switchdev_obj.

Signed-off-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Reviewed-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Reviewed-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/marvell/prestera/prestera_switchdev.c
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
drivers/net/ethernet/mscc/ocelot_net.c
drivers/net/ethernet/ti/am65-cpsw-switchdev.c
drivers/net/ethernet/ti/cpsw_switchdev.c
include/net/switchdev.h
net/dsa/slave.c
net/switchdev/switchdev.c

index 8c2b03151736c8a1850b6f1ec34608df48f6d22f..2c1619715a4b443a559eed172803b4de6681931b 100644 (file)
@@ -695,7 +695,8 @@ err_port_stp_set:
 }
 
 static int prestera_port_obj_attr_set(struct net_device *dev,
-                                     const struct switchdev_attr *attr)
+                                     const struct switchdev_attr *attr,
+                                     struct netlink_ext_ack *extack)
 {
        struct prestera_port *port = netdev_priv(dev);
        int err = 0;
index 20c4f3c2cf23fb6f21e9d26703113bba55c04afc..18e4f1cd5587d96b22f7820016dea37bba63586a 100644 (file)
@@ -887,7 +887,8 @@ mlxsw_sp_port_attr_br_mrouter_set(struct mlxsw_sp_port *mlxsw_sp_port,
 }
 
 static int mlxsw_sp_port_attr_set(struct net_device *dev,
-                                 const struct switchdev_attr *attr)
+                                 const struct switchdev_attr *attr,
+                                 struct netlink_ext_ack *extack)
 {
        struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
        int err;
index 8f12fa45b1b526ba7565b6da7890ab17f39e8592..f9da4aa394447f5cd12ba4768b690b6cb020b426 100644 (file)
@@ -1005,7 +1005,8 @@ static void ocelot_port_attr_mc_set(struct ocelot *ocelot, int port, bool mc)
 }
 
 static int ocelot_port_attr_set(struct net_device *dev,
-                               const struct switchdev_attr *attr)
+                               const struct switchdev_attr *attr,
+                               struct netlink_ext_ack *extack)
 {
        struct ocelot_port_private *priv = netdev_priv(dev);
        struct ocelot *ocelot = priv->port.ocelot;
index 1067e7772dbf9d597c63ac3b61a1aab3b24969f0..314825acf0a0972914c9519e6f6eb128ccb90fe4 100644 (file)
@@ -81,7 +81,8 @@ static int am65_cpsw_port_attr_br_flags_pre_set(struct net_device *netdev,
 }
 
 static int am65_cpsw_port_attr_set(struct net_device *ndev,
-                                  const struct switchdev_attr *attr)
+                                  const struct switchdev_attr *attr,
+                                  struct netlink_ext_ack *extack)
 {
        struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
        int ret;
index 9967cf985728d921265385221b957df6a245f5d7..13524cbaa8b6a872df44a7987c42b1db39dc6972 100644 (file)
@@ -83,7 +83,8 @@ static int cpsw_port_attr_br_flags_pre_set(struct net_device *netdev,
 }
 
 static int cpsw_port_attr_set(struct net_device *ndev,
-                             const struct switchdev_attr *attr)
+                             const struct switchdev_attr *attr,
+                             struct netlink_ext_ack *extack)
 {
        struct cpsw_priv *priv = netdev_priv(ndev);
        int ret;
index 6dcfc4c51a6e7fe0f95fc22a9ce4119ed22a5c87..9279d4245babee6510be34c25e22a3ec6f175685 100644 (file)
@@ -281,7 +281,8 @@ int switchdev_handle_port_attr_set(struct net_device *dev,
                        struct switchdev_notifier_port_attr_info *port_attr_info,
                        bool (*check_cb)(const struct net_device *dev),
                        int (*set_cb)(struct net_device *dev,
-                                     const struct switchdev_attr *attr));
+                                     const struct switchdev_attr *attr,
+                                     struct netlink_ext_ack *extack));
 #else
 
 static inline void switchdev_deferred_process(void)
@@ -372,7 +373,8 @@ switchdev_handle_port_attr_set(struct net_device *dev,
                        struct switchdev_notifier_port_attr_info *port_attr_info,
                        bool (*check_cb)(const struct net_device *dev),
                        int (*set_cb)(struct net_device *dev,
-                                     const struct switchdev_attr *attr))
+                                     const struct switchdev_attr *attr,
+                                     struct netlink_ext_ack *extack))
 {
        return 0;
 }
index a95e78d5974024263bb88ca04653b7290fc91f14..be29008477d319c545091f26807e6b6e01b5732e 100644 (file)
@@ -272,7 +272,8 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
 }
 
 static int dsa_slave_port_attr_set(struct net_device *dev,
-                                  const struct switchdev_attr *attr)
+                                  const struct switchdev_attr *attr,
+                                  struct netlink_ext_ack *extack)
 {
        struct dsa_port *dp = dsa_slave_to_port(dev);
        int ret;
index 94113ca29dcf372dba8c239c44fa8e458de322f1..0b84f076591e52a6449e538f33e7a761127c4d8f 100644 (file)
@@ -488,14 +488,18 @@ static int __switchdev_handle_port_attr_set(struct net_device *dev,
                        struct switchdev_notifier_port_attr_info *port_attr_info,
                        bool (*check_cb)(const struct net_device *dev),
                        int (*set_cb)(struct net_device *dev,
-                                     const struct switchdev_attr *attr))
+                                     const struct switchdev_attr *attr,
+                                     struct netlink_ext_ack *extack))
 {
+       struct netlink_ext_ack *extack;
        struct net_device *lower_dev;
        struct list_head *iter;
        int err = -EOPNOTSUPP;
 
+       extack = switchdev_notifier_info_to_extack(&port_attr_info->info);
+
        if (check_cb(dev)) {
-               err = set_cb(dev, port_attr_info->attr);
+               err = set_cb(dev, port_attr_info->attr, extack);
                if (err != -EOPNOTSUPP)
                        port_attr_info->handled = true;
                return err;
@@ -525,7 +529,8 @@ int switchdev_handle_port_attr_set(struct net_device *dev,
                        struct switchdev_notifier_port_attr_info *port_attr_info,
                        bool (*check_cb)(const struct net_device *dev),
                        int (*set_cb)(struct net_device *dev,
-                                     const struct switchdev_attr *attr))
+                                     const struct switchdev_attr *attr,
+                                     struct netlink_ext_ack *extack))
 {
        int err;