Skip to contentSkip to conversation

mlxsw: couple of fixes

PATCH In review Jiri Pirko 2 participants 4 messages Jan 10, 2018

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

cover mlxsw: couple of fixes

From: Jiri Pirko <[email protected]>

Couple of small fixes for mlxsw driver.

Jiri Pirko (1):
mlxsw: spectrum_qdisc: Don't use variable array in
mlxsw_sp_tclass_congestion_enable

Yuval Mintz (1):
mlxsw: pci: Wait after reset before accessing HW

 drivers/net/ethernet/mellanox/mlxsw/pci.c            | 7 ++++++-
 drivers/net/ethernet/mellanox/mlxsw/pci_hw.h         | 1 +
 drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c | 7 ++++---
 3 files changed, 11 insertions(+), 4 deletions(-)
Signature · 1 line
2.14.3
author
#1 lore raw

PATCH 1/2 mlxsw: pci: Wait after reset before accessing HW

From: Yuval Mintz <[email protected]>

After performing reset driver polls on HW indication until learning that the reset is done, but immediately after reset the device becomes unresponsive which might lead to completion timeout on the first read.

Wait for 100ms before starting the polling.

Fixes 233fa44bd67a ("mlxsw: pci: Implement reset done check")
---
 drivers/net/ethernet/mellanox/mlxsw/pci.c    | 7 ++++++-
 drivers/net/ethernet/mellanox/mlxsw/pci_hw.h | 1 +
 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/pci.c +6 -1
index 23f7d828cf67..6ef20e5cc77d 100644
@@ -1643,7 +1643,12 @@ static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci,
 		return 0;
 	}
 
-	wmb(); /* reset needs to be written before we read control register */
+	/* Reset needs to be written before we read control register, and
+	 * we must wait for the HW to become responsive once again
+	 */
+	wmb();
+	msleep(MLXSW_PCI_SW_RESET_WAIT_MSECS);
+
 	end = jiffies + msecs_to_jiffies(MLXSW_PCI_SW_RESET_TIMEOUT_MSECS);
 	do {
 		u32 val = mlxsw_pci_read32(mlxsw_pci, FW_READY);
drivers/net/ethernet/mellanox/mlxsw/pci_hw.h +1 -0
index a6441208e9d9..fb082ad21b00 100644
@@ -59,6 +59,7 @@
 #define MLXSW_PCI_SW_RESET			0xF0010
 #define MLXSW_PCI_SW_RESET_RST_BIT		BIT(0)
 #define MLXSW_PCI_SW_RESET_TIMEOUT_MSECS	5000
+#define MLXSW_PCI_SW_RESET_WAIT_MSECS		100
 #define MLXSW_PCI_FW_READY			0xA1844
 #define MLXSW_PCI_FW_READY_MASK			0xFFFF
 #define MLXSW_PCI_FW_READY_MAGIC		0x5E
Signature · 1 line
2.14.3
author
#2 lore raw

PATCH 2/2 mlxsw: spectrum_qdisc: Don't use variable array in mlxsw_sp_tclass_congestion_enable

In reply to Jiri Pirko

From: Jiri Pirko <[email protected]>

Resolve the sparse warning:
"sparse: Variable length array is used."
Use 2 arrays for 2 PRM register accesses.

Fixes 96f17e0776c2 ("mlxsw: spectrum: Support RED qdisc offload")
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_qdisc.c +4 -3
index c33beac5def0..b5397da94d7f 100644
@@ -46,7 +46,8 @@ mlxsw_sp_tclass_congestion_enable(struct mlxsw_sp_port *mlxsw_sp_port,
 				  int tclass_num, u32 min, u32 max,
 				  u32 probability, bool is_ecn)
 {
-	char cwtp_cmd[max_t(u8, MLXSW_REG_CWTP_LEN, MLXSW_REG_CWTPM_LEN)];
+	char cwtpm_cmd[MLXSW_REG_CWTPM_LEN];
+	char cwtp_cmd[MLXSW_REG_CWTP_LEN];
 	struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
 	int err;
 
@@ -60,10 +61,10 @@ mlxsw_sp_tclass_congestion_enable(struct mlxsw_sp_port *mlxsw_sp_port,
 	if (err)
 		return err;
 
-	mlxsw_reg_cwtpm_pack(cwtp_cmd, mlxsw_sp_port->local_port, tclass_num,
+	mlxsw_reg_cwtpm_pack(cwtpm_cmd, mlxsw_sp_port->local_port, tclass_num,
 			     MLXSW_REG_CWTP_DEFAULT_PROFILE, true, is_ecn);
 
-	return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(cwtpm), cwtp_cmd);
+	return mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(cwtpm), cwtpm_cmd);
 }
 
 static int
Signature · 1 line
2.14.3