[PATCH v2 2/2][SRU][Bionic] UBUNTU: SAUCE: alx: add enable_wol paramenter
AceLan Kao
acelan.kao at canonical.com
Thu May 24 05:41:21 UTC 2018
BugLink: BugLink: https://launchpad.net/bugs/1772610
The WoL feature was reported broken and will lead to the system resumes
immediately after suspended. This symptom is not happening on every
system, and we don't have any machines can reproduce this issue.
To avoid regression, adding enable_wol option and disable
WoL feature by default to prevent the issue from happening.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=61651
Signed-off-by: AceLan Kao <acelan.kao at canonical.com>
---
drivers/net/ethernet/atheros/alx/ethtool.c | 7 ++++++-
drivers/net/ethernet/atheros/alx/main.c | 5 +++++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/atheros/alx/ethtool.c b/drivers/net/ethernet/atheros/alx/ethtool.c
index 859e27236ce4..5ae9afba1c85 100644
--- a/drivers/net/ethernet/atheros/alx/ethtool.c
+++ b/drivers/net/ethernet/atheros/alx/ethtool.c
@@ -46,6 +46,8 @@
#include "reg.h"
#include "hw.h"
+extern const bool enable_wol;
+
/* The order of these strings must match the order of the fields in
* struct alx_hw_stats
* See hw.h
@@ -315,6 +317,9 @@ static void alx_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
struct alx_priv *alx = netdev_priv(netdev);
struct alx_hw *hw = &alx->hw;
+ if (!enable_wol)
+ return;
+
wol->supported = WAKE_MAGIC | WAKE_PHY;
wol->wolopts = 0;
@@ -329,7 +334,7 @@ static int alx_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
struct alx_priv *alx = netdev_priv(netdev);
struct alx_hw *hw = &alx->hw;
- if (wol->wolopts & ~(WAKE_MAGIC | WAKE_PHY))
+ if (!enable_wol || (wol->wolopts & ~(WAKE_MAGIC | WAKE_PHY)))
return -EOPNOTSUPP;
hw->sleep_ctrl = 0;
diff --git a/drivers/net/ethernet/atheros/alx/main.c b/drivers/net/ethernet/atheros/alx/main.c
index c0e2bb22ce24..674270b320fe 100644
--- a/drivers/net/ethernet/atheros/alx/main.c
+++ b/drivers/net/ethernet/atheros/alx/main.c
@@ -51,6 +51,11 @@
const char alx_drv_name[] = "alx";
+/* disable WoL by default */
+bool enable_wol;
+module_param(enable_wol, bool, 0644);
+MODULE_PARM_DESC(enable_wol, "Enable Wake on Lan feature");
+
static void alx_free_txbuf(struct alx_tx_queue *txq, int entry)
{
struct alx_buffer *txb = &txq->bufs[entry];
--
2.17.0
More information about the kernel-team
mailing list