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
695}695}
696 696
697static int prestera_port_obj_attr_set(struct net_device *dev,697static 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)
699{700{
700 struct prestera_port *port = netdev_priv(dev);701 struct prestera_port *port = netdev_priv(dev);
701 int err = 0;702 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
887}887}
888 888
889static int mlxsw_sp_port_attr_set(struct net_device *dev,889static 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)
891{892{
892 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);893 struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
893 int err;894 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
1005}1005}
1006 1006
1007static int ocelot_port_attr_set(struct net_device *dev,1007static 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)
1009{1010{
1010 struct ocelot_port_private *priv = netdev_priv(dev);1011 struct ocelot_port_private *priv = netdev_priv(dev);
1011 struct ocelot *ocelot = priv->port.ocelot;1012 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
81}81}
82 82
83static int am65_cpsw_port_attr_set(struct net_device *ndev,83static 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)
85{86{
86 struct am65_cpsw_port *port = am65_ndev_to_port(ndev);87 struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
87 int ret;88 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
83}83}
84 84
85static int cpsw_port_attr_set(struct net_device *ndev,85static 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)
87{88{
88 struct cpsw_priv *priv = netdev_priv(ndev);89 struct cpsw_priv *priv = netdev_priv(ndev);
89 int ret;90 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
281 struct switchdev_notifier_port_attr_info *port_attr_info,281 struct switchdev_notifier_port_attr_info *port_attr_info,
282 bool (*check_cb)(const struct net_device *dev),282 bool (*check_cb)(const struct net_device *dev),
283 int (*set_cb)(struct net_device *dev,283 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));
285#else286#else
286 287
287static inline void switchdev_deferred_process(void)288static inline void switchdev_deferred_process(void)
@@ -372,7 +373,8 @@ switchdev_handle_port_attr_set(struct net_device *dev, · 84 unmodified lines
372 struct switchdev_notifier_port_attr_info *port_attr_info,373 struct switchdev_notifier_port_attr_info *port_attr_info,
373 bool (*check_cb)(const struct net_device *dev),374 bool (*check_cb)(const struct net_device *dev),
374 int (*set_cb)(struct net_device *dev,375 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))
376{378{
377 return 0;379 return 0;
378}380}
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
272}272}
273 273
274static int dsa_slave_port_attr_set(struct net_device *dev,274static 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)
276{277{
277 struct dsa_port *dp = dsa_slave_to_port(dev);278 struct dsa_port *dp = dsa_slave_to_port(dev);
278 int ret;279 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
488 struct switchdev_notifier_port_attr_info *port_attr_info,488 struct switchdev_notifier_port_attr_info *port_attr_info,
489 bool (*check_cb)(const struct net_device *dev),489 bool (*check_cb)(const struct net_device *dev),
490 int (*set_cb)(struct net_device *dev,490 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))
492{493{
494 struct netlink_ext_ack *extack;
493 struct net_device *lower_dev;495 struct net_device *lower_dev;
494 struct list_head *iter;496 struct list_head *iter;
495 int err = -EOPNOTSUPP;497 int err = -EOPNOTSUPP;
496 498
499 extack = switchdev_notifier_info_to_extack(&port_attr_info->info);
500
497 if (check_cb(dev)) {501 if (check_cb(dev)) {
498 err = set_cb(dev, port_attr_info->attr);502 err = set_cb(dev, port_attr_info->attr, extack);
499 if (err != -EOPNOTSUPP)503 if (err != -EOPNOTSUPP)
500 port_attr_info->handled = true;504 port_attr_info->handled = true;
501 return err;505 return err;
@@ -525,7 +529,8 @@ int switchdev_handle_port_attr_set(struct net_device *dev, · 23 unmodified lines
525 struct switchdev_notifier_port_attr_info *port_attr_info,529 struct switchdev_notifier_port_attr_info *port_attr_info,
526 bool (*check_cb)(const struct net_device *dev),530 bool (*check_cb)(const struct net_device *dev),
527 int (*set_cb)(struct net_device *dev,531 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))
529{534{
530 int err;535 int err;
531 536

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