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. 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>
This commit is contained in:
committed by
David S. Miller
parent
b0aae0bde2
commit
4c08c586ff
@@ -695,7 +695,8 @@ err_port_stp_set:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int prestera_port_obj_attr_set(struct net_device *dev,
|
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);
|
struct prestera_port *port = netdev_priv(dev);
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|||||||
@@ -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,
|
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);
|
struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
|
||||||
int err;
|
int err;
|
||||||
|
|||||||
@@ -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,
|
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_port_private *priv = netdev_priv(dev);
|
||||||
struct ocelot *ocelot = priv->port.ocelot;
|
struct ocelot *ocelot = priv->port.ocelot;
|
||||||
|
|||||||
@@ -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,
|
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);
|
struct am65_cpsw_port *port = am65_ndev_to_port(ndev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|||||||
@@ -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,
|
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);
|
struct cpsw_priv *priv = netdev_priv(ndev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|||||||
@@ -281,7 +281,8 @@ int switchdev_handle_port_attr_set(struct net_device *dev,
|
|||||||
struct switchdev_notifier_port_attr_info *port_attr_info,
|
struct switchdev_notifier_port_attr_info *port_attr_info,
|
||||||
bool (*check_cb)(const struct net_device *dev),
|
bool (*check_cb)(const struct net_device *dev),
|
||||||
int (*set_cb)(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
|
#else
|
||||||
|
|
||||||
static inline void switchdev_deferred_process(void)
|
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,
|
struct switchdev_notifier_port_attr_info *port_attr_info,
|
||||||
bool (*check_cb)(const struct net_device *dev),
|
bool (*check_cb)(const struct net_device *dev),
|
||||||
int (*set_cb)(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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,
|
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);
|
struct dsa_port *dp = dsa_slave_to_port(dev);
|
||||||
int ret;
|
int ret;
|
||||||
|
|||||||
@@ -488,14 +488,18 @@ static int __switchdev_handle_port_attr_set(struct net_device *dev,
|
|||||||
struct switchdev_notifier_port_attr_info *port_attr_info,
|
struct switchdev_notifier_port_attr_info *port_attr_info,
|
||||||
bool (*check_cb)(const struct net_device *dev),
|
bool (*check_cb)(const struct net_device *dev),
|
||||||
int (*set_cb)(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 net_device *lower_dev;
|
||||||
struct list_head *iter;
|
struct list_head *iter;
|
||||||
int err = -EOPNOTSUPP;
|
int err = -EOPNOTSUPP;
|
||||||
|
|
||||||
|
extack = switchdev_notifier_info_to_extack(&port_attr_info->info);
|
||||||
|
|
||||||
if (check_cb(dev)) {
|
if (check_cb(dev)) {
|
||||||
err = set_cb(dev, port_attr_info->attr);
|
err = set_cb(dev, port_attr_info->attr, extack);
|
||||||
if (err != -EOPNOTSUPP)
|
if (err != -EOPNOTSUPP)
|
||||||
port_attr_info->handled = true;
|
port_attr_info->handled = true;
|
||||||
return err;
|
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,
|
struct switchdev_notifier_port_attr_info *port_attr_info,
|
||||||
bool (*check_cb)(const struct net_device *dev),
|
bool (*check_cb)(const struct net_device *dev),
|
||||||
int (*set_cb)(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;
|
int err;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user