Skip to contentSkip to conversation

mlxsw: Various small fixes

PATCH In review Jiri Pirko 2 participants 10 messages Jul 31, 2017

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

cover mlxsw: Various small fixes

From: Jiri Pirko <[email protected]>

This patch series is to contribute several fixes for nits that I noticed while working on mlxsw. The changes range from typo fixes to local improvements of the code and have little in common besides being small in scope.

Petr Machata (8):
mlxsw: spectrum_acl: Fix a typo
mlxsw: reg.h: Fix a typo
mlxsw: spectrum_router: Fix a typo
mlxsw: Update specification of reg_ritr_type
mlxsw: reg.h: Namespace IP2ME registers
mlxsw: spectrum_router: Simplify a piece of code
mlxsw: spectrum_router: Clarify a piece of code
mlxsw: spectrum_router: Simplify a piece of code

 drivers/net/ethernet/mellanox/mlxsw/reg.h             | 18 +++++++++---------
 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c    |  2 +-
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 12 +++++-------
 3 files changed, 15 insertions(+), 17 deletions(-)
Signature · 1 line
2.9.3
author
#1 lore raw

PATCH 1/8 mlxsw: spectrum_acl: Fix a typo

From: Petr Machata <[email protected]>

---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_acl.c +1 -1
index 01a1501..508b5fc 100644
@@ -369,7 +369,7 @@ int mlxsw_sp_acl_rulei_act_fwd(struct mlxsw_sp *mlxsw_sp,
 		local_port = mlxsw_sp_port->local_port;
 		in_port = false;
 	} else {
-		/* If out_dev is NULL, the called wants to
+		/* If out_dev is NULL, the caller wants to
 		 * set forward to ingress port.
 		 */
 		local_port = 0;
Signature · 1 line
2.9.3
author
#2 lore raw

PATCH 2/8 mlxsw: reg.h: Fix a typo

In reply to Jiri Pirko

From: Petr Machata <[email protected]>

---
 drivers/net/ethernet/mellanox/mlxsw/reg.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/reg.h +1 -1
index c6c50894..b4ea8cb 100644
@@ -4718,7 +4718,7 @@ MLXSW_ITEM32(reg, ralue, prefix_len, 0x08, 0, 8);
 /* reg_ralue_dip*
  * The prefix of the route or of the marker that the object of the LPM
  * is compared with. The most significant bits of the dip are the prefix.
- * The list significant bits must be '0' if the prefix_len is smaller
+ * The least significant bits must be '0' if the prefix_len is smaller
  * than 128 for IPv6 or smaller than 32 for IPv4.
  * IPv4 address uses bits dip[31:0] and bits dip[127:32] are reserved.
  * Access: Index
Signature · 1 line
2.9.3
author
#3 lore raw

PATCH 3/8 mlxsw: spectrum_router: Fix a typo

In reply to Jiri Pirko

From: Petr Machata <[email protected]>

---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +1 -1
index 8bf076d..b6df3c3 100644
@@ -1804,7 +1804,7 @@ static int mlxsw_sp_nexthop_neigh_init(struct mlxsw_sp *mlxsw_sp,
 		return 0;
 
 	/* Take a reference of neigh here ensuring that neigh would
-	 * not be detructed before the nexthop entry is finished.
+	 * not be destructed before the nexthop entry is finished.
 	 * The reference is taken either in neigh_lookup() or
 	 * in neigh_create() in case n is not found.
 	 */
Signature · 1 line
2.9.3
author
#4 lore raw

PATCH 4/8 mlxsw: Update specification of reg_ritr_type

In reply to Jiri Pirko

From: Petr Machata <[email protected]>

The comments really belong to the individual enumerators. The comment at the register should instead reference the enum.

---
 drivers/net/ethernet/mellanox/mlxsw/reg.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/reg.h +4 -4
index b4ea8cb..a671438 100644
@@ -3992,16 +3992,16 @@ MLXSW_ITEM32(reg, ritr, ipv4, 0x00, 29, 1);
 MLXSW_ITEM32(reg, ritr, ipv6, 0x00, 28, 1);
 
 enum mlxsw_reg_ritr_if_type {
+	/* VLAN interface. */
 	MLXSW_REG_RITR_VLAN_IF,
+	/* FID interface. */
 	MLXSW_REG_RITR_FID_IF,
+	/* Sub-port interface. */
 	MLXSW_REG_RITR_SP_IF,
 };
 
 /* reg_ritr_type
- * Router interface type.
- * 0 - VLAN interface.
- * 1 - FID interface.
- * 2 - Sub-port interface.
+ * Router interface type as per enum mlxsw_reg_ritr_if_type.
  * Access: RW
  */
 MLXSW_ITEM32(reg, ritr, type, 0x00, 23, 3);
Signature · 1 line
2.9.3
author
#5 lore raw

PATCH 5/8 mlxsw: reg.h: Namespace IP2ME registers

In reply to Jiri Pirko

From: Petr Machata <[email protected]>

This renames IP2ME-specific registers reg_ralue_v and reg_ralue_tunnel_ptr to reg_ralue_ip2me_*.

---
 drivers/net/ethernet/mellanox/mlxsw/reg.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/reg.h +4 -4
index a671438..7e8ba54 100644
@@ -4813,7 +4813,7 @@ MLXSW_ITEM32(reg, ralue, ecmp_size, 0x28, 0, 13);
  */
 MLXSW_ITEM32(reg, ralue, local_erif, 0x24, 0, 16);
 
-/* reg_ralue_v
+/* reg_ralue_ip2me_v
  * Valid bit for the tunnel_ptr field.
  * If valid = 0 then trap to CPU as IP2ME trap ID.
  * If valid = 1 and the packet format allows NVE or IPinIP tunnel
@@ -4823,15 +4823,15 @@ MLXSW_ITEM32(reg, ralue, local_erif, 0x24, 0, 16);
  * Only relevant in case of IP2ME action.
  * Access: RW
  */
-MLXSW_ITEM32(reg, ralue, v, 0x24, 31, 1);
+MLXSW_ITEM32(reg, ralue, ip2me_v, 0x24, 31, 1);
 
-/* reg_ralue_tunnel_ptr
+/* reg_ralue_ip2me_tunnel_ptr
  * Tunnel Pointer for NVE or IPinIP tunnel decapsulation.
  * For Spectrum, pointer to KVD Linear.
  * Only relevant in case of IP2ME action.
  * Access: RW
  */
-MLXSW_ITEM32(reg, ralue, tunnel_ptr, 0x24, 0, 24);
+MLXSW_ITEM32(reg, ralue, ip2me_tunnel_ptr, 0x24, 0, 24);
 
 static inline void mlxsw_reg_ralue_pack(char *payload,
 					enum mlxsw_reg_ralxx_protocol protocol,
Signature · 1 line
2.9.3
author
#6 lore raw

PATCH 6/8 mlxsw: spectrum_router: Simplify a piece of code

In reply to Jiri Pirko

From: Petr Machata <[email protected]>

---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +1 -3
index b6df3c3..600268c 100644
@@ -3124,9 +3124,7 @@ mlxsw_sp_rif_should_config(struct mlxsw_sp_rif *rif, struct net_device *dev,
 
 	switch (event) {
 	case NETDEV_UP:
-		if (!rif)
-			return true;
-		return false;
+		return rif == NULL;
 	case NETDEV_DOWN:
 		idev = __in_dev_get_rtnl(dev);
 		if (idev && idev->ifa_list)
Signature · 1 line
2.9.3
author
#7 lore raw

PATCH 7/8 mlxsw: spectrum_router: Clarify a piece of code

In reply to Jiri Pirko

From: Petr Machata <[email protected]>

Prefer logical operator that expresses the intent to bitwise one that happens to give the same result.

---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +1 -1
index 600268c..c69efbd 100644
@@ -1668,7 +1668,7 @@ mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp,
 	for (i = 0; i < nh_grp->count; i++) {
 		nh = &nh_grp->nexthops[i];
 
-		if (nh->should_offload ^ nh->offloaded) {
+		if (nh->should_offload != nh->offloaded) {
 			offload_change = true;
 			if (nh->should_offload)
 				nh->update = 1;
Signature · 1 line
2.9.3
author
#8 lore raw

PATCH 8/8 mlxsw: spectrum_router: Simplify a piece of code

In reply to Jiri Pirko

From: Petr Machata <[email protected]>

Express the same logic more succinctly.

---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +2 -2
index c69efbd..802f5b8 100644
@@ -1752,9 +1752,9 @@ mlxsw_sp_nexthop_group_refresh(struct mlxsw_sp *mlxsw_sp,
 static void __mlxsw_sp_nexthop_neigh_update(struct mlxsw_sp_nexthop *nh,
 					    bool removing)
 {
-	if (!removing && !nh->should_offload)
+	if (!removing)
 		nh->should_offload = 1;
-	else if (removing && nh->offloaded)
+	else if (nh->offloaded)
 		nh->should_offload = 0;
 	nh->update = 1;
 }
Signature · 1 line
2.9.3
maintainer
#9 lore raw
In reply to Jiri Pirko

From: Jiri Pirko <[email protected]>
Date: Mon, 31 Jul 2017 09:27:22 +0200

Quoted 3 lines

This patch series is to contribute several fixes for nits that I noticed while working on mlxsw. The changes range from typo fixes to local improvements of the code and have little in common besides being small in scope.

Series applied, thanks Jiri.