Skip to contentSkip to conversation

mlxsw: Couple of fixes

PATCH In review Jiri Pirko 2 participants 6 messages Oct 20, 2016

Subsystems (3)
lore
Share & tools
lore

Jiri Pirko

author
#0 lore raw

cover mlxsw: Couple of fixes

From: Jiri Pirko <[email protected]>

Elad Raz (1):
mlxsw: switchx2: Fix ethernet port initialization

Jiri Pirko (3):
mlxsw: spectrum_router: Use correct tree index for binding
mlxsw: spectrum_router: Make mlxsw_sp_router_fib4_del return void and
remove warn
mlxsw: pci: Fix reset wait for SwitchX2

 drivers/net/ethernet/mellanox/mlxsw/pci.c             | 10 ++++++++--
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 16 +++++++---------
 drivers/net/ethernet/mellanox/mlxsw/switchx2.c        |  1 +
 3 files changed, 16 insertions(+), 11 deletions(-)
Signature · 1 line
2.5.5
author
#1 lore raw

PATCH 1/4 mlxsw: spectrum_router: Use correct tree index for binding

From: Jiri Pirko <[email protected]>

By a mistake, there is tree index 0 passed to RALTB. Should be MLXSW_SP_LPM_TREE_MIN.

Fixes b45f64d16d45 ("mlxsw: spectrum_router: Use FIB notifications instead of switchdev calls")
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +2 -1
index 78fc557d..1b3a2cb 100644
@@ -1862,7 +1862,8 @@ static int mlxsw_sp_router_set_abort_trap(struct mlxsw_sp *mlxsw_sp)
 	if (err)
 		return err;
 
-	mlxsw_reg_raltb_pack(raltb_pl, 0, MLXSW_REG_RALXX_PROTOCOL_IPV4, 0);
+	mlxsw_reg_raltb_pack(raltb_pl, 0, MLXSW_REG_RALXX_PROTOCOL_IPV4,
+			     MLXSW_SP_LPM_TREE_MIN);
 	err = mlxsw_reg_write(mlxsw_sp->core, MLXSW_REG(raltb), raltb_pl);
 	if (err)
 		return err;
Signature · 1 line
2.5.5
author
#2 lore raw

PATCH 2/4 mlxsw: spectrum_router: Make mlxsw_sp_router_fib4_del return void and remove warn

In reply to Jiri Pirko

From: Jiri Pirko <[email protected]>

The function return value is not checked anywhere. Also, the warning causes huge slowdown when removing large number of FIB entries which were not offloaded, because of ordering issue. Ido's preparing a patchset to fix the ordering issue, but that is definitelly not net tree material.

Fixes b45f64d16d45 ("mlxsw: spectrum_router: Use FIB notifications instead of switchdev calls")
---
 drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_router.c +5 -8
index 1b3a2cb..f3d50d3 100644
@@ -1820,19 +1820,17 @@ static int mlxsw_sp_router_fib4_add(struct mlxsw_sp *mlxsw_sp,
 	return err;
 }
 
-static int mlxsw_sp_router_fib4_del(struct mlxsw_sp *mlxsw_sp,
-				    struct fib_entry_notifier_info *fen_info)
+static void mlxsw_sp_router_fib4_del(struct mlxsw_sp *mlxsw_sp,
+				     struct fib_entry_notifier_info *fen_info)
 {
 	struct mlxsw_sp_fib_entry *fib_entry;
 
 	if (mlxsw_sp->router.aborted)
-		return 0;
+		return;
 
 	fib_entry = mlxsw_sp_fib_entry_find(mlxsw_sp, fen_info);
-	if (!fib_entry) {
-		dev_warn(mlxsw_sp->bus_info->dev, "Failed to find FIB4 entry being removed.\n");
-		return -ENOENT;
-	}
+	if (!fib_entry)
+		return;
 
 	if (fib_entry->ref_count == 1) {
 		mlxsw_sp_fib_entry_del(mlxsw_sp, fib_entry);
@@ -1840,7 +1838,6 @@ static int mlxsw_sp_router_fib4_del(struct mlxsw_sp *mlxsw_sp,
 	}
 
 	mlxsw_sp_fib_entry_put(mlxsw_sp, fib_entry);
-	return 0;
 }
 
 static int mlxsw_sp_router_set_abort_trap(struct mlxsw_sp *mlxsw_sp)
Signature · 1 line
2.5.5
author
#3 lore raw

PATCH 3/4 mlxsw: switchx2: Fix ethernet port initialization

In reply to Jiri Pirko

From: Elad Raz <[email protected]>

When creating an ethernet port fails, we must move the port to disable, otherwise putting the port in switch partition 0 (ETH) or 1 (IB) will always fails.

Fixes 31557f0f9755 ("mlxsw: Introduce Mellanox SwitchX-2 ASIC support")
---
 drivers/net/ethernet/mellanox/mlxsw/switchx2.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlxsw/switchx2.c +1 -0
index c0c23e2..92bda87 100644
@@ -1088,6 +1088,7 @@ static int mlxsw_sx_port_create(struct mlxsw_sx *mlxsw_sx, u8 local_port)
 err_port_admin_status_set:
 err_port_mtu_set:
 err_port_speed_set:
+	mlxsw_sx_port_swid_set(mlxsw_sx_port, MLXSW_PORT_SWID_DISABLED_PORT);
 err_port_swid_set:
 err_port_system_port_mapping_set:
 port_not_usable:
Signature · 1 line
2.5.5
author
#4 lore raw

PATCH 4/4 mlxsw: pci: Fix reset wait for SwitchX2

In reply to Jiri Pirko

From: Jiri Pirko <[email protected]>

SwitchX2 firmware does not implement reset done yet. Moreover, when busy-polled for ready magic, that slows down firmware and reset takes longer than the defined timeout, causing initialization to fail. So restore the previous behaviour and just sleep in this case.

Fixes 233fa44bd67a ("mlxsw: pci: Implement reset done check")
---
 drivers/net/ethernet/mellanox/mlxsw/pci.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/pci.c +8 -2
index e742bd4..912f71f 100644
@@ -1838,11 +1838,17 @@ static const struct mlxsw_bus mlxsw_pci_bus = {
 	.cmd_exec		= mlxsw_pci_cmd_exec,
 };
 
-static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci)
+static int mlxsw_pci_sw_reset(struct mlxsw_pci *mlxsw_pci,
+			      const struct pci_device_id *id)
 {
 	unsigned long end;
 
 	mlxsw_pci_write32(mlxsw_pci, SW_RESET, MLXSW_PCI_SW_RESET_RST_BIT);
+	if (id->device == PCI_DEVICE_ID_MELLANOX_SWITCHX2) {
+		msleep(MLXSW_PCI_SW_RESET_TIMEOUT_MSECS);
+		return 0;
+	}
+
 	wmb(); /* reset needs to be written before we read control register */
 	end = jiffies + msecs_to_jiffies(MLXSW_PCI_SW_RESET_TIMEOUT_MSECS);
 	do {
@@ -1909,7 +1915,7 @@ static int mlxsw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	mlxsw_pci->pdev = pdev;
 	pci_set_drvdata(pdev, mlxsw_pci);
 
-	err = mlxsw_pci_sw_reset(mlxsw_pci);
+	err = mlxsw_pci_sw_reset(mlxsw_pci, id);
 	if (err) {
 		dev_err(&pdev->dev, "Software reset failed\n");
 		goto err_sw_reset;
Signature · 1 line
2.5.5