Commit 6c677750 authored by Arkadi Sharshevsky's avatar Arkadi Sharshevsky Committed by David S. Miller

mlxsw: spectrum: Use NL_SET_ERR_MSG_MOD

Use NL_SET_ERR_MSG_MOD helper which adds the module name instead
of specifying the prefix each time.
Signed-off-by: default avatarArkadi Sharshevsky <arkadis@mellanox.com>
Signed-off-by: default avatarJiri Pirko <jiri@mellanox.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d520d581
...@@ -4236,13 +4236,11 @@ mlxsw_sp_master_lag_check(struct mlxsw_sp *mlxsw_sp, ...@@ -4236,13 +4236,11 @@ mlxsw_sp_master_lag_check(struct mlxsw_sp *mlxsw_sp,
u16 lag_id; u16 lag_id;
if (mlxsw_sp_lag_index_get(mlxsw_sp, lag_dev, &lag_id) != 0) { if (mlxsw_sp_lag_index_get(mlxsw_sp, lag_dev, &lag_id) != 0) {
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG_MOD(extack, "Exceeded number of supported LAG devices");
"spectrum: Exceeded number of supported LAG devices");
return false; return false;
} }
if (lag_upper_info->tx_type != NETDEV_LAG_TX_TYPE_HASH) { if (lag_upper_info->tx_type != NETDEV_LAG_TX_TYPE_HASH) {
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG_MOD(extack, "LAG device using unsupported Tx type");
"spectrum: LAG device using unsupported Tx type");
return false; return false;
} }
return true; return true;
...@@ -4484,8 +4482,7 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev, ...@@ -4484,8 +4482,7 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev,
!netif_is_lag_master(upper_dev) && !netif_is_lag_master(upper_dev) &&
!netif_is_bridge_master(upper_dev) && !netif_is_bridge_master(upper_dev) &&
!netif_is_ovs_master(upper_dev)) { !netif_is_ovs_master(upper_dev)) {
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG_MOD(extack, "Unknown upper device type");
"spectrum: Unknown upper device type");
return -EINVAL; return -EINVAL;
} }
if (!info->linking) if (!info->linking)
...@@ -4494,8 +4491,7 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev, ...@@ -4494,8 +4491,7 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev,
(!netif_is_bridge_master(upper_dev) || (!netif_is_bridge_master(upper_dev) ||
!mlxsw_sp_bridge_device_is_offloaded(mlxsw_sp, !mlxsw_sp_bridge_device_is_offloaded(mlxsw_sp,
upper_dev))) { upper_dev))) {
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG_MOD(extack, "Enslaving a port to a device that already has an upper device is not supported");
"spectrum: Enslaving a port to a device that already has an upper device is not supported");
return -EINVAL; return -EINVAL;
} }
if (netif_is_lag_master(upper_dev) && if (netif_is_lag_master(upper_dev) &&
...@@ -4503,24 +4499,20 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev, ...@@ -4503,24 +4499,20 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev,
info->upper_info, extack)) info->upper_info, extack))
return -EINVAL; return -EINVAL;
if (netif_is_lag_master(upper_dev) && vlan_uses_dev(dev)) { if (netif_is_lag_master(upper_dev) && vlan_uses_dev(dev)) {
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG_MOD(extack, "Master device is a LAG master and this device has a VLAN");
"spectrum: Master device is a LAG master and this device has a VLAN");
return -EINVAL; return -EINVAL;
} }
if (netif_is_lag_port(dev) && is_vlan_dev(upper_dev) && if (netif_is_lag_port(dev) && is_vlan_dev(upper_dev) &&
!netif_is_lag_master(vlan_dev_real_dev(upper_dev))) { !netif_is_lag_master(vlan_dev_real_dev(upper_dev))) {
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG_MOD(extack, "Can not put a VLAN on a LAG port");
"spectrum: Can not put a VLAN on a LAG port");
return -EINVAL; return -EINVAL;
} }
if (netif_is_ovs_master(upper_dev) && vlan_uses_dev(dev)) { if (netif_is_ovs_master(upper_dev) && vlan_uses_dev(dev)) {
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG_MOD(extack, "Master device is an OVS master and this device has a VLAN");
"spectrum: Master device is an OVS master and this device has a VLAN");
return -EINVAL; return -EINVAL;
} }
if (netif_is_ovs_port(dev) && is_vlan_dev(upper_dev)) { if (netif_is_ovs_port(dev) && is_vlan_dev(upper_dev)) {
NL_SET_ERR_MSG(extack, NL_SET_ERR_MSG_MOD(extack, "Can not put a VLAN on an OVS port");
"spectrum: Can not put a VLAN on an OVS port");
return -EINVAL; return -EINVAL;
} }
break; break;
...@@ -4633,7 +4625,7 @@ static int mlxsw_sp_netdevice_port_vlan_event(struct net_device *vlan_dev, ...@@ -4633,7 +4625,7 @@ static int mlxsw_sp_netdevice_port_vlan_event(struct net_device *vlan_dev,
case NETDEV_PRECHANGEUPPER: case NETDEV_PRECHANGEUPPER:
upper_dev = info->upper_dev; upper_dev = info->upper_dev;
if (!netif_is_bridge_master(upper_dev)) { if (!netif_is_bridge_master(upper_dev)) {
NL_SET_ERR_MSG(extack, "spectrum: VLAN devices only support bridge and VRF uppers"); NL_SET_ERR_MSG_MOD(extack, "VLAN devices only support bridge and VRF uppers");
return -EINVAL; return -EINVAL;
} }
if (!info->linking) if (!info->linking)
...@@ -4642,7 +4634,7 @@ static int mlxsw_sp_netdevice_port_vlan_event(struct net_device *vlan_dev, ...@@ -4642,7 +4634,7 @@ static int mlxsw_sp_netdevice_port_vlan_event(struct net_device *vlan_dev,
(!netif_is_bridge_master(upper_dev) || (!netif_is_bridge_master(upper_dev) ||
!mlxsw_sp_bridge_device_is_offloaded(mlxsw_sp, !mlxsw_sp_bridge_device_is_offloaded(mlxsw_sp,
upper_dev))) { upper_dev))) {
NL_SET_ERR_MSG(extack, "spectrum: Enslaving a port to a device that already has an upper device is not supported"); NL_SET_ERR_MSG_MOD(extack, "Enslaving a port to a device that already has an upper device is not supported");
return -EINVAL; return -EINVAL;
} }
break; break;
......
...@@ -793,7 +793,7 @@ static struct mlxsw_sp_vr *mlxsw_sp_vr_create(struct mlxsw_sp *mlxsw_sp, ...@@ -793,7 +793,7 @@ static struct mlxsw_sp_vr *mlxsw_sp_vr_create(struct mlxsw_sp *mlxsw_sp,
vr = mlxsw_sp_vr_find_unused(mlxsw_sp); vr = mlxsw_sp_vr_find_unused(mlxsw_sp);
if (!vr) { if (!vr) {
NL_SET_ERR_MSG(extack, "spectrum: Exceeded number of supported virtual routers"); NL_SET_ERR_MSG_MOD(extack, "Exceeded number of supported virtual routers");
return ERR_PTR(-EBUSY); return ERR_PTR(-EBUSY);
} }
vr->fib4 = mlxsw_sp_fib_create(mlxsw_sp, vr, MLXSW_SP_L3_PROTO_IPV4); vr->fib4 = mlxsw_sp_fib_create(mlxsw_sp, vr, MLXSW_SP_L3_PROTO_IPV4);
...@@ -5796,7 +5796,7 @@ static int mlxsw_sp_router_fib_rule_event(unsigned long event, ...@@ -5796,7 +5796,7 @@ static int mlxsw_sp_router_fib_rule_event(unsigned long event,
} }
if (err < 0) if (err < 0)
NL_SET_ERR_MSG(extack, "spectrum: FIB rules not supported. Aborting offload"); NL_SET_ERR_MSG_MOD(extack, "FIB rules not supported. Aborting offload");
return err; return err;
} }
...@@ -6035,7 +6035,7 @@ mlxsw_sp_rif_create(struct mlxsw_sp *mlxsw_sp, ...@@ -6035,7 +6035,7 @@ mlxsw_sp_rif_create(struct mlxsw_sp *mlxsw_sp,
err = mlxsw_sp_rif_index_alloc(mlxsw_sp, &rif_index); err = mlxsw_sp_rif_index_alloc(mlxsw_sp, &rif_index);
if (err) { if (err) {
NL_SET_ERR_MSG(extack, "spectrum: Exceeded number of supported router interfaces"); NL_SET_ERR_MSG_MOD(extack, "Exceeded number of supported router interfaces");
goto err_rif_index_alloc; goto err_rif_index_alloc;
} }
......
...@@ -1819,7 +1819,7 @@ mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device, ...@@ -1819,7 +1819,7 @@ mlxsw_sp_bridge_8021q_port_join(struct mlxsw_sp_bridge_device *bridge_device,
struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan; struct mlxsw_sp_port_vlan *mlxsw_sp_port_vlan;
if (is_vlan_dev(bridge_port->dev)) { if (is_vlan_dev(bridge_port->dev)) {
NL_SET_ERR_MSG(extack, "spectrum: Can not enslave a VLAN device to a VLAN-aware bridge"); NL_SET_ERR_MSG_MOD(extack, "Can not enslave a VLAN device to a VLAN-aware bridge");
return -EINVAL; return -EINVAL;
} }
...@@ -1885,7 +1885,7 @@ mlxsw_sp_bridge_8021d_port_join(struct mlxsw_sp_bridge_device *bridge_device, ...@@ -1885,7 +1885,7 @@ mlxsw_sp_bridge_8021d_port_join(struct mlxsw_sp_bridge_device *bridge_device,
u16 vid; u16 vid;
if (!is_vlan_dev(bridge_port->dev)) { if (!is_vlan_dev(bridge_port->dev)) {
NL_SET_ERR_MSG(extack, "spectrum: Only VLAN devices can be enslaved to a VLAN-unaware bridge"); NL_SET_ERR_MSG_MOD(extack, "Only VLAN devices can be enslaved to a VLAN-unaware bridge");
return -EINVAL; return -EINVAL;
} }
vid = vlan_dev_vlan_id(bridge_port->dev); vid = vlan_dev_vlan_id(bridge_port->dev);
...@@ -1895,7 +1895,7 @@ mlxsw_sp_bridge_8021d_port_join(struct mlxsw_sp_bridge_device *bridge_device, ...@@ -1895,7 +1895,7 @@ mlxsw_sp_bridge_8021d_port_join(struct mlxsw_sp_bridge_device *bridge_device,
return -EINVAL; return -EINVAL;
if (mlxsw_sp_port_is_br_member(mlxsw_sp_port, bridge_device->dev)) { if (mlxsw_sp_port_is_br_member(mlxsw_sp_port, bridge_device->dev)) {
NL_SET_ERR_MSG(extack, "spectrum: Can not bridge VLAN uppers of the same port"); NL_SET_ERR_MSG_MOD(extack, "Can not bridge VLAN uppers of the same port");
return -EINVAL; return -EINVAL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment