Skip to contentSkip to conversation

mlxsw: spectrum: Add "spectrum" prefix macro

PATCH In review Jiri Pirko 3 participants 4 messages Dec 17, 2017 – Dec 19, 2017

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

PATCH 1/1 mlxsw: spectrum: Add "spectrum" prefix macro

From: Arkadi Sharshevsky <[email protected]>

Add "spectrum" string prefix macro for error strings.

---
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c | 23 ++++++++++-------------
 drivers/net/ethernet/mellanox/mlxsw/spectrum.h |  2 ++
 2 files changed, 12 insertions(+), 13 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +10 -13
index d373df7..57e5ab4 100644
@@ -4168,13 +4168,11 @@ mlxsw_sp_master_lag_check(struct mlxsw_sp *mlxsw_sp,
 	u16 lag_id;
 
 	if (mlxsw_sp_lag_index_get(mlxsw_sp, lag_dev, &lag_id) != 0) {
-		NL_SET_ERR_MSG(extack,
-			       "spectrum: Exceeded number of supported LAG devices");
+		NL_SET_ERR_MSG(extack, MLXSW_SP_PREFIX "Exceeded number of supported LAG devices");
 		return false;
 	}
 	if (lag_upper_info->tx_type != NETDEV_LAG_TX_TYPE_HASH) {
-		NL_SET_ERR_MSG(extack,
-			       "spectrum: LAG device using unsupported Tx type");
+		NL_SET_ERR_MSG(extack, MLXSW_SP_PREFIX "LAG device using unsupported Tx type");
 		return false;
 	}
 	return true;
@@ -4416,15 +4414,14 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev,
 		    !netif_is_lag_master(upper_dev) &&
 		    !netif_is_bridge_master(upper_dev) &&
 		    !netif_is_ovs_master(upper_dev)) {
-			NL_SET_ERR_MSG(extack,
-				       "spectrum: Unknown upper device type");
+			NL_SET_ERR_MSG(extack, MLXSW_SP_PREFIX "Unknown upper device type");
 			return -EINVAL;
 		}
 		if (!info->linking)
 			break;
 		if (netdev_has_any_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");
+				       MLXSW_SP_PREFIX "Enslaving a port to a device that already has an upper device is not supported");
 			return -EINVAL;
 		}
 		if (netif_is_lag_master(upper_dev) &&
@@ -4433,23 +4430,23 @@ static int mlxsw_sp_netdevice_port_upper_event(struct net_device *lower_dev,
 			return -EINVAL;
 		if (netif_is_lag_master(upper_dev) && vlan_uses_dev(dev)) {
 			NL_SET_ERR_MSG(extack,
-				       "spectrum: Master device is a LAG master and this device has a VLAN");
+				       MLXSW_SP_PREFIX "Master device is a LAG master and this device has a VLAN");
 			return -EINVAL;
 		}
 		if (netif_is_lag_port(dev) && is_vlan_dev(upper_dev) &&
 		    !netif_is_lag_master(vlan_dev_real_dev(upper_dev))) {
 			NL_SET_ERR_MSG(extack,
-				       "spectrum: Can not put a VLAN on a LAG port");
+				       MLXSW_SP_PREFIX "Can not put a VLAN on a LAG port");
 			return -EINVAL;
 		}
 		if (netif_is_ovs_master(upper_dev) && vlan_uses_dev(dev)) {
 			NL_SET_ERR_MSG(extack,
-				       "spectrum: Master device is an OVS master and this device has a VLAN");
+				       MLXSW_SP_PREFIX "Master device is an OVS master and this device has a VLAN");
 			return -EINVAL;
 		}
 		if (netif_is_ovs_port(dev) && is_vlan_dev(upper_dev)) {
 			NL_SET_ERR_MSG(extack,
-				       "spectrum: Can not put a VLAN on an OVS port");
+				       MLXSW_SP_PREFIX "Can not put a VLAN on an OVS port");
 			return -EINVAL;
 		}
 		break;
@@ -4561,13 +4558,13 @@ static int mlxsw_sp_netdevice_port_vlan_event(struct net_device *vlan_dev,
 	case NETDEV_PRECHANGEUPPER:
 		upper_dev = info->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(extack, MLXSW_SP_PREFIX "VLAN devices only support bridge and VRF uppers");
 			return -EINVAL;
 		}
 		if (!info->linking)
 			break;
 		if (netdev_has_any_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(extack, MLXSW_SP_PREFIX "Enslaving a port to a device that already has an upper device is not supported");
 			return -EINVAL;
 		}
 		break;
drivers/net/ethernet/mellanox/mlxsw/spectrum.h +2 -0
index a0adcd8..36a0335 100644
@@ -66,6 +66,8 @@
 #define MLXSW_SP_KVD_LINEAR_SIZE 98304 /* entries */
 #define MLXSW_SP_KVD_GRANULARITY 128
 
+#define MLXSW_SP_PREFIX "spectrum: "
+
 struct mlxsw_sp_port;
 struct mlxsw_sp_rif;
 
Signature · 1 line
2.9.5
#1 lore raw
Quoted 3 lines · Jiri Pirko

From: Arkadi Sharshevsky <[email protected]>

Add "spectrum" string prefix macro for error strings.

[]

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Quoted 1 line
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +0 -0

[]

drivers/net/ethernet/mellanox/mlxsw/spectrum.c mlxsw_sp_master_lag_check(struct mlxsw_sp *mlxsw_sp, · line 4171

Quoted 7 lines
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +1 -2
@@ -4168,13 +4168,11 @@ mlxsw_sp_master_lag_check(struct mlxsw_sp *mlxsw_sp,
 	u16 lag_id;
 
 	if (mlxsw_sp_lag_index_get(mlxsw_sp, lag_dev, &lag_id) != 0) {
-		NL_SET_ERR_MSG(extack,
-			       "spectrum: Exceeded number of supported LAG devices");
+		NL_SET_ERR_MSG(extack, MLXSW_SP_PREFIX "Exceeded number of supported LAG devices");

Perhaps use NL_SET_ERR_MSG_MOD instead.

etc...

maintainer
#2 lore raw

From: Joe Perches <[email protected]>
Date: Sun, 17 Dec 2017 08:25:00 -0800

Quoted 10 lines · Jiri Pirko
Quoted 3 lines

From: Arkadi Sharshevsky <[email protected]>

Add "spectrum" string prefix macro for error strings.

[]

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Quoted 1 line
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +0 -0

[]

Quoted 3 lines
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +0 -0
@@ -4168,13 +4168,11 @@ mlxsw_sp_master_lag_check(struct mlxsw_sp *mlxsw_sp,
 	u16 lag_id;
 
Quoted 6 lines

drivers/net/ethernet/mellanox/mlxsw/spectrum.c mlxsw_sp_master_lag_check(struct mlxsw_sp *mlxsw_sp, · line 4171

Quoted 4 lines
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +1 -2
 	if (mlxsw_sp_lag_index_get(mlxsw_sp, lag_dev, &lag_id) != 0) {
-		NL_SET_ERR_MSG(extack,
-			       "spectrum: Exceeded number of supported LAG devices");
+		NL_SET_ERR_MSG(extack, MLXSW_SP_PREFIX "Exceeded number of supported LAG devices");

Perhaps use NL_SET_ERR_MSG_MOD instead.

Yeah that probably makes sense.

author
#3 lore raw
Quoted 13 lines · Tue, Dec 19, 2017 at 05:09:06PM CET, [email protected] wrote:

From: Joe Perches <[email protected]>
Date: Sun, 17 Dec 2017 08:25:00 -0800

Quoted 10 lines · Jiri Pirko
Quoted 3 lines

From: Arkadi Sharshevsky <[email protected]>

Add "spectrum" string prefix macro for error strings.

[]

drivers/net/ethernet/mellanox/mlxsw/spectrum.c

Quoted 1 line
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +0 -0

[]

Quoted 3 lines
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +0 -0
@@ -4168,13 +4168,11 @@ mlxsw_sp_master_lag_check(struct mlxsw_sp *mlxsw_sp,
 	u16 lag_id;
 
Quoted 8 lines
Quoted 6 lines

drivers/net/ethernet/mellanox/mlxsw/spectrum.c mlxsw_sp_master_lag_check(struct mlxsw_sp *mlxsw_sp, · line 4171

Quoted 4 lines
drivers/net/ethernet/mellanox/mlxsw/spectrum.c +1 -2
 	if (mlxsw_sp_lag_index_get(mlxsw_sp, lag_dev, &lag_id) != 0) {
-		NL_SET_ERR_MSG(extack,
-			       "spectrum: Exceeded number of supported LAG devices");
+		NL_SET_ERR_MSG(extack, MLXSW_SP_PREFIX "Exceeded number of supported LAG devices");

Perhaps use NL_SET_ERR_MSG_MOD instead.

Yeah that probably makes sense.

Yes. Thanks