From: Jeff Chen <jeff.chen_1@nxp.com>
To: linux-wireless@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, johannes@sipsolutions.net,
francesco@dolcini.it, wyatt.hsu@nxp.com, s.hauer@pengutronix.de,
Jeff Chen <jeff.chen_1@nxp.com>
Subject: [PATCH v10 15/21] wifi: nxpwifi: add ethtool support for Wake-on-LAN
Date: Thu, 5 Mar 2026 22:39:33 +0800 [thread overview]
Message-ID: <20260305143939.3724868-16-jeff.chen_1@nxp.com> (raw)
In-Reply-To: <20260305143939.3724868-1-jeff.chen_1@nxp.com>
Add basic ethtool Wake-on-LAN support for the nxpwifi driver. Implement
the get_wol and set_wol ethtool operations and map the standard ethtool
WoL flags to the driver's host-sleep configuration.
Support WAKE_UCAST, WAKE_MCAST, WAKE_BCAST, and WAKE_PHY to allow users
to query and configure Wake-on-LAN behavior using standard ethtool
interfaces.
Signed-off-by: Jeff Chen <jeff.chen_1@nxp.com>
---
drivers/net/wireless/nxp/nxpwifi/ethtool.c | 58 ++++++++++++++++++++++
1 file changed, 58 insertions(+)
create mode 100644 drivers/net/wireless/nxp/nxpwifi/ethtool.c
diff --git a/drivers/net/wireless/nxp/nxpwifi/ethtool.c b/drivers/net/wireless/nxp/nxpwifi/ethtool.c
new file mode 100644
index 000000000000..aabb635afcf5
--- /dev/null
+++ b/drivers/net/wireless/nxp/nxpwifi/ethtool.c
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: GPL-2.0-only
+/*
+ * nxpwifi: ethtool
+ *
+ * Copyright 2011-2024 NXP
+ */
+
+#include "main.h"
+
+static void nxpwifi_ethtool_get_wol(struct net_device *dev,
+ struct ethtool_wolinfo *wol)
+{
+ struct nxpwifi_private *priv = nxpwifi_netdev_get_priv(dev);
+ u32 conditions = le32_to_cpu(priv->adapter->hs_cfg.conditions);
+
+ wol->supported = WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_PHY;
+
+ if (conditions == HS_CFG_COND_DEF)
+ return;
+
+ if (conditions & HS_CFG_COND_UNICAST_DATA)
+ wol->wolopts |= WAKE_UCAST;
+ if (conditions & HS_CFG_COND_MULTICAST_DATA)
+ wol->wolopts |= WAKE_MCAST;
+ if (conditions & HS_CFG_COND_BROADCAST_DATA)
+ wol->wolopts |= WAKE_BCAST;
+ if (conditions & HS_CFG_COND_MAC_EVENT)
+ wol->wolopts |= WAKE_PHY;
+}
+
+static int nxpwifi_ethtool_set_wol(struct net_device *dev,
+ struct ethtool_wolinfo *wol)
+{
+ struct nxpwifi_private *priv = nxpwifi_netdev_get_priv(dev);
+ u32 conditions = 0;
+
+ if (wol->wolopts & ~(WAKE_UCAST | WAKE_MCAST | WAKE_BCAST | WAKE_PHY))
+ return -EOPNOTSUPP;
+
+ if (wol->wolopts & WAKE_UCAST)
+ conditions |= HS_CFG_COND_UNICAST_DATA;
+ if (wol->wolopts & WAKE_MCAST)
+ conditions |= HS_CFG_COND_MULTICAST_DATA;
+ if (wol->wolopts & WAKE_BCAST)
+ conditions |= HS_CFG_COND_BROADCAST_DATA;
+ if (wol->wolopts & WAKE_PHY)
+ conditions |= HS_CFG_COND_MAC_EVENT;
+ if (wol->wolopts == 0)
+ conditions |= HS_CFG_COND_DEF;
+ priv->adapter->hs_cfg.conditions = cpu_to_le32(conditions);
+
+ return 0;
+}
+
+const struct ethtool_ops nxpwifi_ethtool_ops = {
+ .get_wol = nxpwifi_ethtool_get_wol,
+ .set_wol = nxpwifi_ethtool_set_wol,
+};
--
2.34.1
next prev parent reply other threads:[~2026-03-05 14:42 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-05 14:39 [PATCH v10 00/21] wifi: nxpwifi: create nxpwifi to support Jeff Chen
2026-03-05 14:39 ` [PATCH v10 01/21] wifi: nxpwifi: add 802.11n support for STA and AP modes Jeff Chen
2026-03-05 14:39 ` [PATCH v10 02/21] wifi: nxpwifi: add initial 802.11ac " Jeff Chen
2026-03-05 14:39 ` [PATCH v10 03/21] wifi: nxpwifi: add initial 802.11ax " Jeff Chen
2026-03-05 14:39 ` [PATCH v10 04/21] wifi: nxpwifi: add 802.11h DFS/TPC support for 5 GHz operation Jeff Chen
2026-03-05 14:39 ` [PATCH v10 05/21] wifi: nxpwifi: add WMM support for QoS-based traffic handling Jeff Chen
2026-03-05 14:39 ` [PATCH v10 06/21] wifi: nxpwifi: add scan support Jeff Chen
2026-03-05 14:39 ` [PATCH v10 07/21] wifi: nxpwifi: add join and association support Jeff Chen
2026-03-05 14:39 ` [PATCH v10 08/21] wifi: nxpwifi: add channel/frequency/power support Jeff Chen
2026-03-05 14:39 ` [PATCH v10 09/21] wifi: nxpwifi: add configuration support Jeff Chen
2026-03-05 14:39 ` [PATCH v10 10/21] wifi: nxpwifi: implement cfg80211 ops for STA and AP Jeff Chen
2026-03-05 14:39 ` [PATCH v10 11/21] wifi: nxpwifi: add firmware command and TLV definitions Jeff Chen
2026-03-05 14:39 ` [PATCH v10 12/21] wifi: nxpwifi: add command/event handling support Jeff Chen
2026-03-05 14:39 ` [PATCH v10 13/21] wifi: nxpwifi: add data path support for STA and AP modes Jeff Chen
2026-03-05 14:39 ` [PATCH v10 14/21] wifi: nxpwifi: add debugfs support Jeff Chen
2026-03-05 14:39 ` Jeff Chen [this message]
2026-03-05 14:39 ` [PATCH v10 16/21] wifi: nxpwifi: add utility and IE handling support Jeff Chen
2026-03-05 14:39 ` [PATCH v10 17/21] wifi: nxpwifi: add init and shutdown support Jeff Chen
2026-03-05 14:39 ` [PATCH v10 18/21] wifi: nxpwifi: add core driver implementation Jeff Chen
2026-03-05 14:39 ` [PATCH v10 19/21] wifi: nxpwifi: add initial SDIO bus driver support Jeff Chen
2026-03-05 14:39 ` [PATCH v10 20/21] wifi: nxpwifi: add Kconfig and Makefile entries Jeff Chen
2026-03-05 14:39 ` [PATCH v10 21/21] wifi: nxpwifi: add MAINTAINERS entry for nxpwifi driver Jeff Chen
2026-03-06 9:19 ` [PATCH v10 00/21] wifi: nxpwifi: create nxpwifi to support Johannes Berg
2026-03-11 3:30 ` Jeff Chen
2026-03-11 7:02 ` Johannes Berg
2026-03-12 8:56 ` Jeff Chen
2026-03-12 9:13 ` Johannes Berg
2026-03-25 13:45 ` Jeff Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260305143939.3724868-16-jeff.chen_1@nxp.com \
--to=jeff.chen_1@nxp.com \
--cc=francesco@dolcini.it \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=wyatt.hsu@nxp.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox