netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 0/2] Aquantia atlantic critical fixes 04/2018
@ 2018-04-11 12:23 Igor Russkikh
  2018-04-11 12:23 ` [PATCH net 1/2] net: aquantia: Regression on reset with 1.x firmware Igor Russkikh
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Igor Russkikh @ 2018-04-11 12:23 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh

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(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH net 1/2] net: aquantia: Regression on reset with 1.x firmware
  2018-04-11 12:23 [PATCH net 0/2] Aquantia atlantic critical fixes 04/2018 Igor Russkikh
@ 2018-04-11 12:23 ` Igor Russkikh
  2018-04-11 12:23 ` [PATCH net 2/2] net: aquantia: oops when shutdown on already stopped device Igor Russkikh
  2018-04-11 14:41 ` [PATCH net 0/2] Aquantia atlantic critical fixes 04/2018 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Igor Russkikh @ 2018-04-11 12:23 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, Igor Russkikh

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
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 .../net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index 84d7f4d..e652d86 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -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
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH net 2/2] net: aquantia: oops when shutdown on already stopped device
  2018-04-11 12:23 [PATCH net 0/2] Aquantia atlantic critical fixes 04/2018 Igor Russkikh
  2018-04-11 12:23 ` [PATCH net 1/2] net: aquantia: Regression on reset with 1.x firmware Igor Russkikh
@ 2018-04-11 12:23 ` Igor Russkikh
  2018-04-11 14:41 ` [PATCH net 0/2] Aquantia atlantic critical fixes 04/2018 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Igor Russkikh @ 2018-04-11 12:23 UTC (permalink / raw)
  To: David S . Miller; +Cc: netdev, David Arcari, Pavel Belous, 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.

Reported-by: David Arcari <darcari@redhat.com>
Fixes: 90869ddfefeb ("net: aquantia: Implement pci shutdown callback")
Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
---
 drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
index c96a921..32f6d2e 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
@@ -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:
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net 0/2] Aquantia atlantic critical fixes 04/2018
  2018-04-11 12:23 [PATCH net 0/2] Aquantia atlantic critical fixes 04/2018 Igor Russkikh
  2018-04-11 12:23 ` [PATCH net 1/2] net: aquantia: Regression on reset with 1.x firmware Igor Russkikh
  2018-04-11 12:23 ` [PATCH net 2/2] net: aquantia: oops when shutdown on already stopped device Igor Russkikh
@ 2018-04-11 14:41 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-04-11 14:41 UTC (permalink / raw)
  To: igor.russkikh; +Cc: netdev, darcari, pavel.belous

From: Igor Russkikh <igor.russkikh@aquantia.com>
Date: Wed, 11 Apr 2018 15:23:23 +0300

> 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.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-11 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-11 12:23 [PATCH net 0/2] Aquantia atlantic critical fixes 04/2018 Igor Russkikh
2018-04-11 12:23 ` [PATCH net 1/2] net: aquantia: Regression on reset with 1.x firmware Igor Russkikh
2018-04-11 12:23 ` [PATCH net 2/2] net: aquantia: oops when shutdown on already stopped device Igor Russkikh
2018-04-11 14:41 ` [PATCH net 0/2] Aquantia atlantic critical fixes 04/2018 David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).