mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] wifi: ath10k: Fix WoW wakeups on WCN3990
@ 2026-11-20 20:26 Michael Auer
  2026-11-20 20:26 ` [PATCH 1/2] wifi: ath10k: configure the WoW action frame wakeup filter Michael Auer
  2026-11-20 20:26 ` [PATCH 2/2] wifi: ath10k: report WoW wakeups to the PM core Michael Auer
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Auer @ 2026-11-20 20:26 UTC (permalink / raw)
  To: Jeff Johnson, Loic Poulain
  Cc: linux-wireless, ath10k, linux-kernel, Michael Auer

With WoWLAN enabled, WCN3990 firmware wakes the host on action frames
right after every WoW entry, so the system hardly stays suspended. And
when the firmware does wake the host for a real reason, user space
cannot see that it was a network wakeup.

Patch 1 sets the action frame wakeup filter that Qualcomm's own host
drivers set. Patch 2 reports WoW wakeups to the PM core.

Both are in daily use on a OnePlus 6 (sdm845) since late September,
with an sdm845-mainline 7.1-rc1 based kernel. On ath-next they were
only build tested (W=1). I could not test QCA6174 or QCA9377.
qcacld-2.0, the vendor driver for QCA6174, sends the same command, so
I expect their firmware to know it.

Tool use: the analysis, the code and the commit messages were
written with an LLM coding assistant (Claude Code). I reviewed all
of it and tested it on my phone as described above.

Michael Auer (2):
  wifi: ath10k: configure the WoW action frame wakeup filter
  wifi: ath10k: report WoW wakeups to the PM core

 drivers/net/wireless/ath/ath10k/wmi-ops.h | 19 +++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 47 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 32 +++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c     |  8 +++-
 drivers/net/wireless/ath/ath10k/wmi.h     | 23 +++++++++++
 drivers/net/wireless/ath/ath10k/wow.c     | 10 +++++
 6 files changed, 137 insertions(+), 2 deletions(-)


base-commit: 1983b40acfcb3c3464b291c85977290a785bcfdc
-- 
2.43.0


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

* [PATCH 1/2] wifi: ath10k: configure the WoW action frame wakeup filter
  2026-11-20 20:26 [PATCH 0/2] wifi: ath10k: Fix WoW wakeups on WCN3990 Michael Auer
@ 2026-11-20 20:26 ` Michael Auer
  2026-11-20 20:26 ` [PATCH 2/2] wifi: ath10k: report WoW wakeups to the PM core Michael Auer
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Auer @ 2026-11-20 20:26 UTC (permalink / raw)
  To: Jeff Johnson, Loic Poulain
  Cc: linux-wireless, ath10k, linux-kernel, Michael Auer

On WCN3990 almost every system suspend with WoWLAN enabled ends within
a second. The firmware wakes the host with wake reason 38, which is
WOW_REASON_ACTION_FRAME_RECV in Qualcomm's fw-api. ath10k's wake reason
enum stops at 27, so the debug log shows "wow wakeup host reason (null)".

Qualcomm's own host drivers (qcacld-2.0 and qcacld-3.0) send
WMI_WOW_SET_ACTION_WAKE_UP_CMDID, which sets the action frame
categories that may wake the host. ath10k never sends it, so the
firmware default applies.

Send it for station vdevs in ath10k_vif_wow_set_wakeups() with the
values of qcacld-3.0: allow spectrum management, QoS, public, SA query,
protected dual of public, WNM, WME, FST and VHT action frames, and
ignore spectrum management Measurement and TPC Requests. A failure is
logged and does not abort the suspend.

Also add wake reasons 28 to 38 and print the reason number, so unknown
reasons are visible.

On a OnePlus 6, 3 of 3 WoW suspends were woken within 1 s with reason
38 before this change. With it, suspends last until a real wakeup
(magic packet, pattern match or RTC). In a one hour idle test with a
push connection the phone was suspended 87.6 % of the time.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0.c8-00050-QCAHLSWMTPLZ-1

Signed-off-by: Michael Auer <mick@yoxcu.de>
---
The per-category array has 32 words, like the 2018 qcacld-3.0 for
sdm845. qcacld-2.0 and newer qcacld-3.0 send 256. The fw-api defines
it as a variable length array, and all allowed categories are below
32. I only tested 32.

 drivers/net/wireless/ath/ath10k/wmi-ops.h | 19 +++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.c | 47 +++++++++++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi-tlv.h | 32 +++++++++++++++
 drivers/net/wireless/ath/ath10k/wmi.c     |  4 +-
 drivers/net/wireless/ath/ath10k/wmi.h     | 23 +++++++++++
 drivers/net/wireless/ath/ath10k/wow.c     | 10 +++++
 6 files changed, 133 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/ath/ath10k/wmi-ops.h b/drivers/net/wireless/ath/ath10k/wmi-ops.h
index f3f6b5954b27..780c2947cc5f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-ops.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-ops.h
@@ -179,6 +179,8 @@ struct wmi_ops {
 						    enum wmi_wow_wakeup_event event,
 						    u32 enable);
 	struct sk_buff *(*gen_wow_host_wakeup_ind)(struct ath10k *ar);
+	struct sk_buff *(*gen_wow_set_action_wake_up)(struct ath10k *ar,
+						      u32 vdev_id);
 	struct sk_buff *(*gen_wow_add_pattern)(struct ath10k *ar, u32 vdev_id,
 					       u32 pattern_id,
 					       const u8 *pattern,
@@ -1422,6 +1424,23 @@ ath10k_wmi_wow_host_wakeup_ind(struct ath10k *ar)
 	return ath10k_wmi_cmd_send(ar, skb, cmd_id);
 }
 
+static inline int
+ath10k_wmi_wow_set_action_wake_up(struct ath10k *ar, u32 vdev_id)
+{
+	struct sk_buff *skb;
+	u32 cmd_id;
+
+	if (!ar->wmi.ops->gen_wow_set_action_wake_up)
+		return -EOPNOTSUPP;
+
+	skb = ar->wmi.ops->gen_wow_set_action_wake_up(ar, vdev_id);
+	if (IS_ERR(skb))
+		return PTR_ERR(skb);
+
+	cmd_id = ar->wmi.cmd->wow_set_action_wake_up_cmdid;
+	return ath10k_wmi_cmd_send(ar, skb, cmd_id);
+}
+
 static inline int
 ath10k_wmi_wow_add_pattern(struct ath10k *ar, u32 vdev_id, u32 pattern_id,
 			   const u8 *pattern, const u8 *mask,
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.c b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
index 01f2d1fa9d7d..2a3b2bc2a478 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.c
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.c
@@ -3713,6 +3713,51 @@ ath10k_wmi_tlv_op_gen_wow_add_wakeup_event(struct ath10k *ar,
 	return skb;
 }
 
+static struct sk_buff *
+ath10k_wmi_tlv_op_gen_wow_set_action_wake_up(struct ath10k *ar, u32 vdev_id)
+{
+	struct wmi_tlv_wow_set_action_wake_up_cmd *cmd;
+	struct wmi_tlv *tlv;
+	struct sk_buff *skb;
+	__le32 *bitmaps;
+	void *ptr;
+	size_t len;
+
+	len = sizeof(*tlv) + sizeof(*cmd) +
+	      sizeof(*tlv) +
+	      WMI_TLV_WOW_ACTION_WAKE_UP_NUM_CATEGORIES * sizeof(__le32);
+	skb = ath10k_wmi_alloc_skb(ar, len);
+	if (!skb)
+		return ERR_PTR(-ENOMEM);
+
+	ptr = (void *)skb->data;
+	tlv = ptr;
+	tlv->tag = __cpu_to_le16(WMI_TLV_TAG_STRUCT_WOW_SET_ACTION_WAKE_UP_CMD);
+	tlv->len = __cpu_to_le16(sizeof(*cmd));
+	cmd = (void *)tlv->value;
+
+	cmd->vdev_id = __cpu_to_le32(vdev_id);
+	cmd->operation = __cpu_to_le32(WMI_TLV_WOW_ACTION_WAKE_UP_OP_SET);
+	cmd->action_category_map[0] =
+		__cpu_to_le32(WMI_TLV_WOW_ACTION_WAKE_UP_CATEGORY_MAP0);
+
+	ptr += sizeof(*tlv);
+	ptr += sizeof(*cmd);
+
+	tlv = ptr;
+	tlv->tag = __cpu_to_le16(WMI_TLV_TAG_ARRAY_UINT32);
+	tlv->len = __cpu_to_le16(WMI_TLV_WOW_ACTION_WAKE_UP_NUM_CATEGORIES *
+				 sizeof(__le32));
+	bitmaps = (void *)tlv->value;
+	bitmaps[WLAN_CATEGORY_SPECTRUM_MGMT] =
+		__cpu_to_le32(WMI_TLV_WOW_ACTION_WAKE_UP_SPECTRUM_MGMT_IGNORE);
+
+	ath10k_dbg(ar, ATH10K_DBG_WMI,
+		   "wmi tlv wow set action wake up vdev_id %d category map 0x%08x\n",
+		   vdev_id, WMI_TLV_WOW_ACTION_WAKE_UP_CATEGORY_MAP0);
+	return skb;
+}
+
 static struct sk_buff *
 ath10k_wmi_tlv_gen_wow_host_wakeup_ind(struct ath10k *ar)
 {
@@ -4272,6 +4317,7 @@ static struct wmi_cmd_map wmi_tlv_cmd_map = {
 	.wow_enable_cmdid = WMI_TLV_WOW_ENABLE_CMDID,
 	.wow_hostwakeup_from_sleep_cmdid =
 				WMI_TLV_WOW_HOSTWAKEUP_FROM_SLEEP_CMDID,
+	.wow_set_action_wake_up_cmdid = WMI_TLV_WOW_SET_ACTION_WAKE_UP_CMDID,
 	.rtt_measreq_cmdid = WMI_TLV_RTT_MEASREQ_CMDID,
 	.rtt_tsf_cmdid = WMI_TLV_RTT_TSF_CMDID,
 	.vdev_spectral_scan_configure_cmdid = WMI_TLV_SPECTRAL_SCAN_CONF_CMDID,
@@ -4604,6 +4650,7 @@ static const struct wmi_ops wmi_tlv_ops = {
 	.gen_wow_enable = ath10k_wmi_tlv_op_gen_wow_enable,
 	.gen_wow_add_wakeup_event = ath10k_wmi_tlv_op_gen_wow_add_wakeup_event,
 	.gen_wow_host_wakeup_ind = ath10k_wmi_tlv_gen_wow_host_wakeup_ind,
+	.gen_wow_set_action_wake_up = ath10k_wmi_tlv_op_gen_wow_set_action_wake_up,
 	.gen_wow_add_pattern = ath10k_wmi_tlv_op_gen_wow_add_pattern,
 	.gen_wow_del_pattern = ath10k_wmi_tlv_op_gen_wow_del_pattern,
 	.gen_wow_config_pno = ath10k_wmi_tlv_op_gen_config_pno,
diff --git a/drivers/net/wireless/ath/ath10k/wmi-tlv.h b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
index ea18ed8939db..2af7c9df4260 100644
--- a/drivers/net/wireless/ath/ath10k/wmi-tlv.h
+++ b/drivers/net/wireless/ath/ath10k/wmi-tlv.h
@@ -189,6 +189,10 @@ enum wmi_tlv_cmd_id {
 	WMI_TLV_EXTWOW_ENABLE_CMDID,
 	WMI_TLV_EXTWOW_SET_APP_TYPE1_PARAMS_CMDID,
 	WMI_TLV_EXTWOW_SET_APP_TYPE2_PARAMS_CMDID,
+	WMI_TLV_WOW_ENABLE_ICMPV6_NA_FLT_CMDID,
+	WMI_TLV_WOW_UDP_SVC_OFLD_CMDID,
+	WMI_TLV_WOW_HOSTWAKEUP_GPIO_PIN_PATTERN_CONFIG_CMDID,
+	WMI_TLV_WOW_SET_ACTION_WAKE_UP_CMDID,
 	WMI_TLV_RTT_MEASREQ_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_RTT),
 	WMI_TLV_RTT_TSF_CMDID,
 	WMI_TLV_SPECTRAL_SCAN_CONF_CMDID = WMI_TLV_CMD(WMI_TLV_GRP_SPECTRAL),
@@ -2202,6 +2206,34 @@ struct wmi_tlv_wow_add_del_event_cmd {
 	__le32 event_bitmap;
 } __packed;
 
+/* Action frame categories that may wake the host from WoW, as in
+ * qcacld-3.0: spectrum management (0), QoS (1), public (4), SA query (8),
+ * protected dual of public (9), WNM (10), WME (17), FST (18), VHT (21).
+ */
+#define WMI_TLV_WOW_ACTION_WAKE_UP_CATEGORY_MAP0	0x00260713
+
+/* Per-category bitmaps of action codes to ignore (1 = ignore). Like
+ * qcacld-3.0, ignore Measurement Request (0) and TPC Request (2).
+ */
+#define WMI_TLV_WOW_ACTION_WAKE_UP_NUM_CATEGORIES	32
+#define WMI_TLV_WOW_ACTION_WAKE_UP_SPECTRUM_MGMT_IGNORE	(BIT(0) | BIT(2))
+
+enum wmi_tlv_wow_action_wake_up_op {
+	WMI_TLV_WOW_ACTION_WAKE_UP_OP_RESET = 0,
+	WMI_TLV_WOW_ACTION_WAKE_UP_OP_SET = 1,
+	WMI_TLV_WOW_ACTION_WAKE_UP_OP_ADD_SET = 2,
+	WMI_TLV_WOW_ACTION_WAKE_UP_OP_DELETE_SET = 3,
+};
+
+/* WMI_WOW_SET_ACTION_WAKE_UP_CMD_fixed_param, followed by a
+ * WMI_TLV_TAG_ARRAY_UINT32 of per-category action code bitmaps.
+ */
+struct wmi_tlv_wow_set_action_wake_up_cmd {
+	__le32 vdev_id;
+	__le32 operation;
+	__le32 action_category_map[8];
+} __packed;
+
 struct wmi_tlv_request_peer_stats_info {
 	__le32 request_type;
 	__le32 vdev_id;
diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index e57588c19c80..eca6bb189577 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4673,8 +4673,8 @@ void ath10k_wmi_event_wow_wakeup_host(struct ath10k *ar, struct sk_buff *skb)
 		return;
 	}
 
-	ath10k_dbg(ar, ATH10K_DBG_WMI, "wow wakeup host reason %s\n",
-		   wow_reason(ev.wake_reason));
+	ath10k_dbg(ar, ATH10K_DBG_WMI, "wow wakeup host reason %d %s\n",
+		   ev.wake_reason, wow_reason(ev.wake_reason));
 }
 
 void ath10k_wmi_event_dcs_interference(struct ath10k *ar, struct sk_buff *skb)
diff --git a/drivers/net/wireless/ath/ath10k/wmi.h b/drivers/net/wireless/ath/ath10k/wmi.h
index 7f50a1de6b97..f1a560fb3447 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.h
+++ b/drivers/net/wireless/ath/ath10k/wmi.h
@@ -944,6 +944,7 @@ struct wmi_cmd_map {
 	u32 wow_enable_disable_wake_event_cmdid;
 	u32 wow_enable_cmdid;
 	u32 wow_hostwakeup_from_sleep_cmdid;
+	u32 wow_set_action_wake_up_cmdid;
 	u32 rtt_measreq_cmdid;
 	u32 rtt_tsf_cmdid;
 	u32 vdev_spectral_scan_configure_cmdid;
@@ -7060,6 +7061,17 @@ enum wmi_wow_wake_reason {
 	WOW_REASON_DFS_PHYERR_RADADR_EVENT,
 	WOW_REASON_BEACON_RECV,
 	WOW_REASON_CLIENT_KICKOUT_EVENT,
+	WOW_REASON_NAN_EVENT,
+	WOW_REASON_EXTSCAN,
+	WOW_REASON_RSSI_BREACH_EVENT,
+	WOW_REASON_IOAC_REV_KA_FAIL_EVENT,
+	WOW_REASON_IOAC_SOCK_EVENT,
+	WOW_REASON_NLO_SCAN_COMPLETE,
+	WOW_REASON_PACKET_FILTER_MATCH,
+	WOW_REASON_ASSOC_RES_RECV,
+	WOW_REASON_REASSOC_REQ_RECV,
+	WOW_REASON_REASSOC_RES_RECV,
+	WOW_REASON_ACTION_FRAME_RECV,
 	WOW_REASON_DEBUG_TEST = 0xFF,
 };
 
@@ -7095,6 +7107,17 @@ static inline const char *wow_reason(enum wmi_wow_wake_reason reason)
 	C2S(WOW_REASON_DFS_PHYERR_RADADR_EVENT);
 	C2S(WOW_REASON_BEACON_RECV);
 	C2S(WOW_REASON_CLIENT_KICKOUT_EVENT);
+	C2S(WOW_REASON_NAN_EVENT);
+	C2S(WOW_REASON_EXTSCAN);
+	C2S(WOW_REASON_RSSI_BREACH_EVENT);
+	C2S(WOW_REASON_IOAC_REV_KA_FAIL_EVENT);
+	C2S(WOW_REASON_IOAC_SOCK_EVENT);
+	C2S(WOW_REASON_NLO_SCAN_COMPLETE);
+	C2S(WOW_REASON_PACKET_FILTER_MATCH);
+	C2S(WOW_REASON_ASSOC_RES_RECV);
+	C2S(WOW_REASON_REASSOC_REQ_RECV);
+	C2S(WOW_REASON_REASSOC_RES_RECV);
+	C2S(WOW_REASON_ACTION_FRAME_RECV);
 	C2S(WOW_REASON_DEBUG_TEST);
 	default:
 		return NULL;
diff --git a/drivers/net/wireless/ath/ath10k/wow.c b/drivers/net/wireless/ath/ath10k/wow.c
index 92af8bc63362..5fc68e6cdeb6 100644
--- a/drivers/net/wireless/ath/ath10k/wow.c
+++ b/drivers/net/wireless/ath/ath10k/wow.c
@@ -380,6 +380,16 @@ static int ath10k_vif_wow_set_wakeups(struct ath10k_vif *arvif,
 		}
 	}
 
+	if (arvif->vdev_type == WMI_VDEV_TYPE_STA) {
+		/* Without this filter WCN3990 wakes the host on action
+		 * frames right after WoW is enabled.
+		 */
+		ret = ath10k_wmi_wow_set_action_wake_up(ar, arvif->vdev_id);
+		if (ret && ret != -EOPNOTSUPP)
+			ath10k_warn(ar, "failed to set action frame wakeup filter on vdev %i: %d\n",
+				    arvif->vdev_id, ret);
+	}
+
 	return 0;
 }
 
-- 
2.43.0


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

* [PATCH 2/2] wifi: ath10k: report WoW wakeups to the PM core
  2026-11-20 20:26 [PATCH 0/2] wifi: ath10k: Fix WoW wakeups on WCN3990 Michael Auer
  2026-11-20 20:26 ` [PATCH 1/2] wifi: ath10k: configure the WoW action frame wakeup filter Michael Auer
@ 2026-11-20 20:26 ` Michael Auer
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Auer @ 2026-11-20 20:26 UTC (permalink / raw)
  To: Jeff Johnson, Loic Poulain
  Cc: linux-wireless, ath10k, linux-kernel, Michael Auer

ath10k does not report a WoW wakeup to the PM core, so the wakeup
source of the device never counts it, and user space cannot tell a
network wakeup from other resumes. Plasma's powerdevil, for example,
checks the wakeup_count of each wakeup source after resume. It keeps
the display off after a network wakeup and turns it on otherwise.

Call pm_wakeup_event() when the firmware reports a wake reason other
than WOW_REASON_UNSPECIFIED, which it uses when the host resumed for
another reason. iwlwifi does the same since commit 06ae2ad413d2
("iwlwifi: mvm: report wakeup for wowlan").

On a OnePlus 6 the wakeup source of the WLAN device now counts WoW
wakeups, and powerdevil keeps the display off for them.

Tested-on: WCN3990 hw1.0 SNOC WLAN.HL.2.0.c8-00050-QCAHLSWMTPLZ-1

Signed-off-by: Michael Auer <mick@yoxcu.de>
---
 drivers/net/wireless/ath/ath10k/wmi.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/wmi.c b/drivers/net/wireless/ath/ath10k/wmi.c
index eca6bb189577..c171cd96ac6f 100644
--- a/drivers/net/wireless/ath/ath10k/wmi.c
+++ b/drivers/net/wireless/ath/ath10k/wmi.c
@@ -4675,6 +4675,10 @@ void ath10k_wmi_event_wow_wakeup_host(struct ath10k *ar, struct sk_buff *skb)
 
 	ath10k_dbg(ar, ATH10K_DBG_WMI, "wow wakeup host reason %d %s\n",
 		   ev.wake_reason, wow_reason(ev.wake_reason));
+
+	/* UNSPECIFIED: the host resumed for another reason */
+	if (ev.wake_reason != WOW_REASON_UNSPECIFIED)
+		pm_wakeup_event(ar->dev, 0);
 }
 
 void ath10k_wmi_event_dcs_interference(struct ath10k *ar, struct sk_buff *skb)
-- 
2.43.0


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

end of thread, other threads:[~2026-11-20 20:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-20 20:26 [PATCH 0/2] wifi: ath10k: Fix WoW wakeups on WCN3990 Michael Auer
2026-11-20 20:26 ` [PATCH 1/2] wifi: ath10k: configure the WoW action frame wakeup filter Michael Auer
2026-11-20 20:26 ` [PATCH 2/2] wifi: ath10k: report WoW wakeups to the PM core Michael Auer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®