Skip to contentSkip to conversation

Aquantia atlantic critical fixes 04/2018

PATCH In review Igor Russkikh 2 participants 4 messages Apr 11, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover Aquantia atlantic critical fixes 04/2018

Two regressions on latest 4.16 driver reported by users

Some of old FW (1.5.44) had a link management logic which prevents driver to make clean reset. Driver of 4.16 has a full hardware reset implemented and that broke the link and traffic on such a cards.

Second is oops on shutdown callback in case interface is already closed or was never opened.

Igor Russkikh (2):
net: aquantia: Regression on reset with 1.x firmware
net: aquantia: oops when shutdown on already stopped device

 drivers/net/ethernet/aquantia/atlantic/aq_nic.c          |  8 +++++---
 .../net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | 16 ++++++++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 net: aquantia: Regression on reset with 1.x firmware

On ASUS XG-C100C with 1.5.44 firmware a special mode called "dirty wake" is active. With this mode when motherboard gets powered (but no poweron happens yet), NIC automatically enables powersave link and watches for WOL packet.
This normally allows to powerup the PC after AC power failures.

Not all motherboards or bios settings gives power to PCI slots, so this mode is not enabled on all the hardware.

4.16 linux driver introduced full hardware reset sequence This is required since before that we had no NIC hardware reset implemented and there were side effects of "not clean start".

But this full reset is incompatible with "dirty wake" WOL feature it keeps the PHY link in a special mode forever. As a consequence, driver sees no link and no traffic.

To fix this we forcibly change FW state to idle state before doing the full reset. This makes FW to restore link state.

Fixes c8c82eb net: aquantia: Introduce global AQC hardware reset sequence
---
 .../net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c +16 -0
index 84d7f4d..e652d86 100644
@@ -48,6 +48,8 @@
 #define FORCE_FLASHLESS 0
 
 static int hw_atl_utils_ver_match(u32 ver_expected, u32 ver_actual);
+static int hw_atl_utils_mpi_set_state(struct aq_hw_s *self,
+				      enum hal_atl_utils_fw_state_e state);
 
 int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)
 {
@@ -247,6 +249,20 @@ int hw_atl_utils_soft_reset(struct aq_hw_s *self)
 
 	self->rbl_enabled = (boot_exit_code != 0);
 
+	/* FW 1.x may bootup in an invalid POWER state (WOL feature).
+	 * We should work around this by forcing its state back to DEINIT
+	 */
+	if (!hw_atl_utils_ver_match(HW_ATL_FW_VER_1X,
+				    aq_hw_read_reg(self,
+						   HW_ATL_MPI_FW_VERSION))) {
+		int err = 0;
+
+		hw_atl_utils_mpi_set_state(self, MPI_DEINIT);
+		AQ_HW_WAIT_FOR((aq_hw_read_reg(self, HW_ATL_MPI_STATE_ADR) &
+			       HW_ATL_MPI_STATE_MSK) == MPI_DEINIT,
+			       10, 1000U);
+	}
+
 	if (self->rbl_enabled)
 		return hw_atl_utils_soft_reset_rbl(self);
 	else
Signature · 1 line
2.7.4
#2 lore raw

PATCH 2/2 net: aquantia: oops when shutdown on already stopped device

In reply to Igor Russkikh

In case netdev is closed at the moment of pci shutdown, aq_nic_stop gets called second time. napi_disable in that case hangs indefinitely. In other case, if device was never opened at all, we get oops because of null pointer access.

We should invoke aq_nic_stop conditionally, only if device is running at the moment of shutdown.

Fixes 90869ddfefeb ("net: aquantia: Implement pci shutdown callback")
---
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c +5 -3
index c96a921..32f6d2e 100644
@@ -951,9 +951,11 @@ void aq_nic_shutdown(struct aq_nic_s *self)
 
 	netif_device_detach(self->ndev);
 
-	err = aq_nic_stop(self);
-	if (err < 0)
-		goto err_exit;
+	if (netif_running(self->ndev)) {
+		err = aq_nic_stop(self);
+		if (err < 0)
+			goto err_exit;
+	}
 	aq_nic_deinit(self);
 
 err_exit:
Signature · 1 line
2.7.4
maintainer
#3 lore raw
In reply to Igor Russkikh

From: Igor Russkikh <[email protected]>
Date: Wed, 11 Apr 2018 15:23:23 +0300

Quoted 8 lines

Two regressions on latest 4.16 driver reported by users

Some of old FW (1.5.44) had a link management logic which prevents driver to make clean reset. Driver of 4.16 has a full hardware reset implemented and that broke the link and traffic on such a cards.

Second is oops on shutdown callback in case interface is already closed or was never opened.

Series applied, thank you.