History

net: switchdev: propagate extack to port attributes

When a struct switchdev_attr is notified through switchdev, there is no way to report informational messages, unlike for struct switchdev_obj.

Vladimir Oltean committed 5 years ago

Commit 4c08c581 parent b0aae0b8 files · +24 −11Browse files

Unified · Split

8 files
  1. drivers/net/ethernet/marvell/prestera/prestera_switchdev.c +2 −1
  2. drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +2 −1
  3. drivers/net/ethernet/mscc/ocelot_net.c +2 −1
  4. drivers/net/ethernet/ti/am65-cpsw-switchdev.c +2 −1
  5. drivers/net/ethernet/ti/cpsw_switchdev.c +2 −1
  6. include/net/switchdev.h +4 −2
  7. net/dsa/slave.c +2 −1
  8. net/switchdev/switchdev.c +8 −3
drivers/net/ethernet/marvell/prestera/prestera_switchdev.c+2−1
@@ -695,7 +695,8 @@ err_port_stp_set: · 694 unmodified lines
695695 }
696696
697697 static int prestera_port_obj_attr_set(struct net_device *dev,
698− const struct switchdev_attr *attr)
698+ const struct switchdev_attr *attr,
699+ struct netlink_ext_ack *extack)
699700 {
700701 struct prestera_port *port = netdev_priv(dev);
701702 int err = 0;
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c+2−1
@@ -887,7 +887,8 @@ mlxsw_sp_port_attr_br_mrouter_set(struct mlxsw_sp_port *mlxsw_sp_port, · 886 unmodified lines
887887 }
888888
889889 static int mlxsw_sp_port_attr_set(struct net_device *dev,
890− const struct switchdev_attr *attr)
890+ const struct switchdev_attr *attr,
891+ struct netlink_ext_ack *extack)
891892 {
892893 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
893894 int err;
drivers/net/ethernet/mscc/ocelot_net.c+2−1
@@ -1005,7 +1005,8 @@ static void ocelot_port_attr_mc_set(struct ocelot *ocelot, int port, bool mc) · 1004 unmodified lines
10051005 }
10061006
10071007 static int ocelot_port_attr_set(struct net_device *dev,
1008− const struct switchdev_attr *attr)
1008+ const struct switchdev_attr *attr,
1009+ struct netlink_ext_ack *extack)
10091010 {
10101011 struct ocelot_port_private *priv = netdev_priv(dev);
10111012 struct ocelot *ocelot = priv->port.ocelot;
drivers/net/ethernet/ti/am65-cpsw-switchdev.c+2−1
@@ -81,7 +81,8 @@ static int am65_cpsw_port_attr_br_flags_pre_set(struct net_device *netdev, · 80 unmodified lines
8181 }
8282
8383 static int am65_cpsw_port_attr_set(struct net_device *ndev,
84− const struct switchdev_attr *attr)
84+ const struct switchdev_attr *attr,
85+ struct netlink_ext_ack *extack)
8586 {
8687 struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
8788 int ret;
drivers/net/ethernet/ti/cpsw_switchdev.c+2−1
@@ -83,7 +83,8 @@ static int cpsw_port_attr_br_flags_pre_set(struct net_device *netdev, · 82 unmodified lines
8383 }
8484
8585 static int cpsw_port_attr_set(struct net_device *ndev,
86− const struct switchdev_attr *attr)
86+ const struct switchdev_attr *attr,
87+ struct netlink_ext_ack *extack)
8788 {
8889 struct cpsw_priv *priv = netdev_priv(ndev);
8990 int ret;
include/net/switchdev.h+4−2
@@ -281,7 +281,8 @@ int switchdev_handle_port_attr_set(struct net_device *dev, · 280 unmodified lines
281281 struct switchdev_notifier_port_attr_info *port_attr_info,
282282 bool (*check_cb)(const struct net_device *dev),
283283 int (*set_cb)(struct net_device *dev,
284− const struct switchdev_attr *attr));
284+ const struct switchdev_attr *attr,
285+ struct netlink_ext_ack *extack));
285286 #else
286287
287288 static inline void switchdev_deferred_process(void)
@@ -372,7 +373,8 @@ switchdev_handle_port_attr_set(struct net_device *dev, · 84 unmodified lines
372373 struct switchdev_notifier_port_attr_info *port_attr_info,
373374 bool (*check_cb)(const struct net_device *dev),
374375 int (*set_cb)(struct net_device *dev,
375− const struct switchdev_attr *attr))
376+ const struct switchdev_attr *attr,
377+ struct netlink_ext_ack *extack))
376378 {
377379 return 0;
378380 }
net/dsa/slave.c+2−1
@@ -272,7 +272,8 @@ static int dsa_slave_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) · 271 unmodified lines
272272 }
273273
274274 static int dsa_slave_port_attr_set(struct net_device *dev,
275− const struct switchdev_attr *attr)
275+ const struct switchdev_attr *attr,
276+ struct netlink_ext_ack *extack)
276277 {
277278 struct dsa_port *dp = dsa_slave_to_port(dev);
278279 int ret;
net/switchdev/switchdev.c+8−3
@@ -488,14 +488,18 @@ static int __switchdev_handle_port_attr_set(struct net_device *dev, · 487 unmodified lines
488488 struct switchdev_notifier_port_attr_info *port_attr_info,
489489 bool (*check_cb)(const struct net_device *dev),
490490 int (*set_cb)(struct net_device *dev,
491− const struct switchdev_attr *attr))
491+ const struct switchdev_attr *attr,
492+ struct netlink_ext_ack *extack))
492493 {
494+ struct netlink_ext_ack *extack;
493495 struct net_device *lower_dev;
494496 struct list_head *iter;
495497 int err = -EOPNOTSUPP;
496498
499+ extack = switchdev_notifier_info_to_extack(&port_attr_info->info);
500+
497501 if (check_cb(dev)) {
498− err = set_cb(dev, port_attr_info->attr);
502+ err = set_cb(dev, port_attr_info->attr, extack);
499503 if (err != -EOPNOTSUPP)
500504 port_attr_info->handled = true;
501505 return err;
@@ -525,7 +529,8 @@ int switchdev_handle_port_attr_set(struct net_device *dev, · 23 unmodified lines
525529 struct switchdev_notifier_port_attr_info *port_attr_info,
526530 bool (*check_cb)(const struct net_device *dev),
527531 int (*set_cb)(struct net_device *dev,
528− const struct switchdev_attr *attr))
532+ const struct switchdev_attr *attr,
533+ struct netlink_ext_ack *extack))
529534 {
530535 int err;
531536

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t