Skip to contentSkip to conversation

wifi: ath10k: avoid unnecessary wait for service ready message

PATCH Applied Baochen Qiang 5 participants 9 messages Aug 11, 2025 – Oct 22, 2025

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

PATCH 1/1 wifi: ath10k: avoid unnecessary wait for service ready message

Commit e57b7d62a1b2 ("wifi: ath10k: poll service ready message before failing") works around the failure in waiting for the service ready message by active polling. Note the polling is triggered after initial wait timeout, which means that the wait-till-timeout can not be avoided even the message is ready.

A possible fix is to do polling once before wait as well, however this can not handle the race that the message arrives right after polling. So the solution is to do periodic polling until timeout.

Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00309-QCARMSWPZ-1

Fixes e57b7d62a1b2 ("wifi: ath10k: poll service ready message before failing")
---
 drivers/net/wireless/ath/ath10k/wmi.c | 39 +++++++++++++++++------------------
 1 file changed, 19 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +19 -20
index cb8ae751eb312109f74985580065c3b9d3806d51..e595b0979a56d3110ce0acf534e718a4a1f36a0b 100644
@@ -1764,33 +1764,32 @@ void ath10k_wmi_put_wmi_channel(struct ath10k *ar, struct wmi_channel *ch,
 
 int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
 {
+	unsigned long timeout = jiffies + WMI_SERVICE_READY_TIMEOUT_HZ;
 	unsigned long time_left, i;
 
-	time_left = wait_for_completion_timeout(&ar->wmi.service_ready,
-						WMI_SERVICE_READY_TIMEOUT_HZ);
-	if (!time_left) {
-		/* Sometimes the PCI HIF doesn't receive interrupt
-		 * for the service ready message even if the buffer
-		 * was completed. PCIe sniffer shows that it's
-		 * because the corresponding CE ring doesn't fires
-		 * it. Workaround here by polling CE rings once.
-		 */
-		ath10k_warn(ar, "failed to receive service ready completion, polling..\n");
-
+	/* Sometimes the PCI HIF doesn't receive interrupt
+	 * for the service ready message even if the buffer
+	 * was completed. PCIe sniffer shows that it's
+	 * because the corresponding CE ring doesn't fires
+	 * it. Workaround here by polling CE rings. Since
+	 * the message could arrive at any time, continue
+	 * polling until timeout.
+	 */
+	do {
 		for (i = 0; i < CE_COUNT; i++)
 			ath10k_hif_send_complete_check(ar, i, 1);
 
+		/* The 100 ms granularity is a tradeoff considering scheduler
+		 * overhead and response latency
+		 */
 		time_left = wait_for_completion_timeout(&ar->wmi.service_ready,
-							WMI_SERVICE_READY_TIMEOUT_HZ);
-		if (!time_left) {
-			ath10k_warn(ar, "polling timed out\n");
-			return -ETIMEDOUT;
-		}
-
-		ath10k_warn(ar, "service ready completion received, continuing normally\n");
-	}
+							msecs_to_jiffies(100));
+		if (time_left)
+			return 0;
+	} while (time_before(jiffies, timeout));
 
-	return 0;
+	ath10k_warn(ar, "failed to receive service ready completion\n");
+	return -ETIMEDOUT;
 }
 
 int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar)

---
base-commit: 0f79768f8d665b43b77967d38b5df6ccebe8cb57
change-id: 20250730-ath10k-avoid-unnecessary-wait-a9d48136490f

Best regards,

Signature · 1 line
Baochen Qiang <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Baochen Qiang

Commit e57b7d62a1b2 ("wifi: ath10k: poll service ready message before failing") works around the failure in waiting for the service ready message by active polling. Note the polling is triggered after initial wait timeout, which means that the wait-till-timeout can not be avoided even the message is ready.

A possible fix is to do polling once before wait as well, however this can not handle the race that the message arrives right after polling. So the solution is to do periodic polling until timeout.

Quoted 6 lines

Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00309-QCARMSWPZ-1

Fixes e57b7d62a1b2 ("wifi: ath10k: poll service ready message before failing")
Applied
#2 lore raw
In reply to Baochen Qiang
Quoted 11 lines · Baochen Qiang

Commit e57b7d62a1b2 ("wifi: ath10k: poll service ready message before failing") works around the failure in waiting for the service ready message by active polling. Note the polling is triggered after initial wait timeout, which means that the wait-till-timeout can not be avoided even the message is ready.

A possible fix is to do polling once before wait as well, however this can not handle the race that the message arrives right after polling. So the solution is to do periodic polling until timeout.

[...]

Applied, thanks!

[1/1] wifi: ath10k: avoid unnecessary wait for service ready message

      commit: 51a73f1b2e56b0324b4a3bb8cebc4221b5be4c7a

Best regards,

Signature · 1 line
Jeff Johnson <[email protected]>
#3 lore raw

[REGRESSION] ath10k fails initialization, bisected to "wifi: ath10k: avoid unnecessary wait for service ready message"

Quoted 12 lines · Jeff Johnson
Quoted 10 lines · Baochen Qiang

Commit e57b7d62a1b2 ("wifi: ath10k: poll service ready message before failing") works around the failure in waiting for the service ready message by active polling. Note the polling is triggered after initial wait timeout, which means that the wait-till-timeout can not be avoided even the message is ready.

A possible fix is to do polling once before wait as well, however this can not handle the race that the message arrives right after polling. So the solution is to do periodic polling until timeout.

Quoted 8 lines
Quoted 1 line

[...]

Applied, thanks!

[1/1] wifi: ath10k: avoid unnecessary wait for service ready message
      commit: 51a73f1b2e56b0324b4a3bb8cebc4221b5be4c7a

Best regards,

Unfortunately, this particular commit completely breaks the ath10k driver in my setup.

Hardware:
- Turris Omnia (arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts)
- Wifi card (output from lspci): Network controller: Qualcomm Atheros QCA986x/988x 802.11ac Wireless Network Adapter

dmesg output after loading ath10k_pci

[    5.895939] ath10k_pci 0000:02:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
[    6.152971] ath10k_pci 0000:02:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043202ff sub 0000:0000
[    6.152994] ath10k_pci 0000:02:00.0: kconfig debug 0 debugfs 0 tracing 0 dfs 1 testmode 0
[    6.154343] ath10k_pci 0000:02:00.0: firmware ver 10.2.4-1.0-00047 api 5 features no-p2p,raw-mode,mfp,allows-mesh-bcast crc32 35bd9258
[    6.214165] ath10k_pci 0000:02:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08

So far so good, but then come the problematic error messages:

[   12.509390] ath10k_pci 0000:02:00.0: wmi unified ready event not received
[   12.580885] ath10k_pci 0000:02:00.0: could not init core (-110)
[   12.586891] ath10k_pci 0000:02:00.0: could not probe fw (-110)

And the corresponding netdevice does not appear at all.

---

If I revert said commit (on top of current mainline), all is good again:

[    6.112174] ath10k_pci 0000:02:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
[    6.264184] ath10k_pci 0000:02:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043202ff sub 0000:0000
[    6.264199] ath10k_pci 0000:02:00.0: kconfig debug 0 debugfs 0 tracing 0 dfs 1 testmode 0
[    6.265591] ath10k_pci 0000:02:00.0: firmware ver 10.2.4-1.0-00047 api 5 features no-p2p,raw-mode,mfp,allows-mesh-bcast crc32 35bd9258
[    6.298955] ath10k_pci 0000:02:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08
[    7.458285] ath10k_pci 0000:02:00.0: htt-ver 2.1 wmi-op 5 htt-op 2 cal otp max-sta 128 raw 0 hwcrypto 1
[    8.910074] ath10k_pci 0000:02:00.0: pdev param 0 not supported by firmware
[    8.934074] ath10k_pci 0000:02:00.0 wlan1: entered allmulticast mode
[    8.934187] ath10k_pci 0000:02:00.0 wlan1: entered promiscuous mode

Best regards, Klaus

#regzbot introduced: 51a73f1b2e56b0324b4a3bb8cebc4221b5be4c7a ("wifi: ath10k: avoid unnecessary wait for service ready message")

#4 lore raw

Re: [REGRESSION] ath10k fails initialization, bisected to "wifi: ath10k: avoid unnecessary wait for service ready message"

Quoted 23 lines · Klaus Kudielka
Quoted 12 lines · Jeff Johnson
Quoted 10 lines · Baochen Qiang

Commit e57b7d62a1b2 ("wifi: ath10k: poll service ready message before failing") works around the failure in waiting for the service ready message by active polling. Note the polling is triggered after initial wait timeout, which means that the wait-till-timeout can not be avoided even the message is ready.

A possible fix is to do polling once before wait as well, however this can not handle the race that the message arrives right after polling. So the solution is to do periodic polling until timeout.

Quoted 8 lines
Quoted 1 line

[...]

Applied, thanks!

[1/1] wifi: ath10k: avoid unnecessary wait for service ready message
      commit: 51a73f1b2e56b0324b4a3bb8cebc4221b5be4c7a

Best regards,

Quoted 6 lines

Unfortunately, this particular commit completely breaks the ath10k driver in my setup.

Hardware:
- Turris Omnia (arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts)
- Wifi card (output from lspci): Network controller: Qualcomm Atheros QCA986x/988x 802.11ac Wireless Network Adapter

This issue was previously reported with that particular chipset. This is currently being tracked at:
https://bugzilla.kernel.org/show_bug.cgi?id=220671

It may be useful to supply your information as a separate record to that bug.

/jeff

#5 lore raw

Re: [REGRESSION] ath10k fails initialization, bisected to "wifi: ath10k: avoid unnecessary wait for service ready message"

Quoted 8 lines · Jeff Johnson
Quoted 6 lines · Klaus Kudielka

Unfortunately, this particular commit completely breaks the ath10k driver in my setup.

Hardware:
- Turris Omnia (arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts)
- Wifi card (output from lspci): Network controller: Qualcomm Atheros QCA986x/988x 802.11ac Wireless Network Adapter

Quoted 7 lines

This issue was previously reported with that particular chipset. This is currently being tracked at:
https://bugzilla.kernel.org/show_bug.cgi?id=220671

It may be useful to supply your information as a separate record to that bug.

/jeff

Some more observations on that topic with the hardware shown above.

ath10k_core_start() calls ath10k_wmi_wait_for_service_ready(), and later ath10k_wmi_wait_for_unified_ready().

The now *unconditional* call to ath10k_hif_send_complete_check() inside ath10k_wmi_wait_for_service_ready() makes the later call to ath10k_wmi_wait_for_unified_ready() fail.

If I call and handle wait_for_completion_timeout() first (as it was before the patch), ath10k_hif_send_complete_check() is *not* called, and both ath10k_wmi_wait_for_service_ready() and ath10k_wmi_wait_for_unified_ready() succeed. Everything is back to normal.

Side note:
ath10k_wmi_wait_for_service_ready() succeeds in both cases with time_left == WMI_SERVICE_READY_TIMEOUT_HZ.

#regzbot monitor: https://bugzilla.kernel.org/show_bug.cgi?id=220671

#6 lore raw

Re: [REGRESSION] ath10k fails initialization, bisected to "wifi: ath10k: avoid unnecessary wait for service ready message"

Quoted 28 lines · Klaus Kudielka
Quoted 8 lines · Jeff Johnson
Quoted 6 lines · Klaus Kudielka

Unfortunately, this particular commit completely breaks the ath10k driver in my setup.

Hardware:
- Turris Omnia (arch/arm/boot/dts/marvell/armada-385-turris-omnia.dts)
- Wifi card (output from lspci): Network controller: Qualcomm Atheros QCA986x/988x 802.11ac Wireless Network Adapter

Quoted 7 lines

This issue was previously reported with that particular chipset. This is currently being tracked at:
https://bugzilla.kernel.org/show_bug.cgi?id=220671

It may be useful to supply your information as a separate record to that bug.

/jeff

Some more observations on that topic with the hardware shown above.

ath10k_core_start() calls ath10k_wmi_wait_for_service_ready(), and later ath10k_wmi_wait_for_unified_ready().

The now *unconditional* call to ath10k_hif_send_complete_check() inside ath10k_wmi_wait_for_service_ready() makes the later call to ath10k_wmi_wait_for_unified_ready() fail.

If I call and handle wait_for_completion_timeout() first (as it was before the patch), ath10k_hif_send_complete_check() is *not* called, and both ath10k_wmi_wait_for_service_ready() and ath10k_wmi_wait_for_unified_ready() succeed. Everything is back to normal.

Quoted 5 lines

Side note:
ath10k_wmi_wait_for_service_ready() succeeds in both cases with time_left == WMI_SERVICE_READY_TIMEOUT_HZ.

#regzbot monitor: https://bugzilla.kernel.org/show_bug.cgi?id=220671

Thank you Klaus, can you please try if below diff can fix this regression?

drivers/net/wireless/ath/ath10k/ce.c +0 -0
index 7bbda46cfd93..1a981d333b5c 100644
@@ -1256,6 +1256,19 @@ void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int

ce_id)
}
EXPORT_SYMBOL(ath10k_ce_per_engine_service);

+void ath10k_ce_per_engine_check(struct ath10k *ar, unsigned int ce_id) +{
+ struct ath10k_ce *ce = ath10k_ce_priv(ar);
+ struct ath10k_ce_pipe *ce_state = &ce->ce_states[ce_id];
+
+ if (ce_state->recv_cb)
+ ce_state->recv_cb(ce_state);
+
+ if (ce_state->send_cb)
+ ce_state->send_cb(ce_state);
+}
+EXPORT_SYMBOL(ath10k_ce_per_engine_check);
+
/*
* Handler for per-engine interrupts on ALL active CEs.
* This is used in cases where the system is sharing a

drivers/net/wireless/ath/ath10k/ce.h +1 -0
index 27367bd64e95..9923530e51eb 100644
@@ -255,6 +255,7 @@ int ath10k_ce_cancel_send_next(struct ath10k_ce_pipe *ce_state,
 /*==================CE Interrupt Handlers====================*/
 void ath10k_ce_per_engine_service_any(struct ath10k *ar);
 void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id);
+void ath10k_ce_per_engine_check(struct ath10k *ar, unsigned int ce_id);
 void ath10k_ce_disable_interrupt(struct ath10k *ar, int ce_id);
 void ath10k_ce_disable_interrupts(struct ath10k *ar);
 void ath10k_ce_enable_interrupt(struct ath10k *ar, int ce_id);
drivers/net/wireless/ath/ath10k/pci.c +1 -1
index 97b49bf4ad80..ce8e0c2fb975 100644
@@ -1812,7 +1812,7 @@ void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
                if (resources > (ar_pci->attr[pipe].src_nentries >> 1))
                        return;
        }
-       ath10k_ce_per_engine_service(ar, pipe);
+       ath10k_ce_per_engine_check(ar, pipe);
 }
 
 static void ath10k_pci_rx_retry_sync(struct ath10k *ar)
#7 lore raw

Re: [REGRESSION] ath10k fails initialization, bisected to "wifi: ath10k: avoid unnecessary wait for service ready message"

Quoted 46 lines · Baochen Qiang

Thank you Klaus, can you please try if below diff can fix this regression?

drivers/net/wireless/ath/ath10k/ce.c +13 -0
index 7bbda46cfd93..1a981d333b5c 100644
@@ -1256,6 +1256,19 @@ void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int
 ce_id)
  }
  EXPORT_SYMBOL(ath10k_ce_per_engine_service);
 
+void ath10k_ce_per_engine_check(struct ath10k *ar, unsigned int ce_id)
+{
+       struct ath10k_ce *ce = ath10k_ce_priv(ar);
+       struct ath10k_ce_pipe *ce_state = &ce->ce_states[ce_id];
+
+       if (ce_state->recv_cb)
+               ce_state->recv_cb(ce_state);
+
+       if (ce_state->send_cb)
+               ce_state->send_cb(ce_state);
+}
+EXPORT_SYMBOL(ath10k_ce_per_engine_check);
+
  /*
   * Handler for per-engine interrupts on ALL active CEs.

  * This is used in cases where the system is sharing a

drivers/net/wireless/ath/ath10k/ce.h +1 -0
index 27367bd64e95..9923530e51eb 100644
@@ -255,6 +255,7 @@ int ath10k_ce_cancel_send_next(struct ath10k_ce_pipe *ce_state,
  /*==================CE Interrupt Handlers====================*/
  void ath10k_ce_per_engine_service_any(struct ath10k *ar);
  void ath10k_ce_per_engine_service(struct ath10k *ar, unsigned int ce_id);
+void ath10k_ce_per_engine_check(struct ath10k *ar, unsigned int ce_id);
  void ath10k_ce_disable_interrupt(struct ath10k *ar, int ce_id);
  void ath10k_ce_disable_interrupts(struct ath10k *ar);
  void ath10k_ce_enable_interrupt(struct ath10k *ar, int ce_id);
drivers/net/wireless/ath/ath10k/pci.c +0 -0
index 97b49bf4ad80..ce8e0c2fb975 100644

drivers/net/wireless/ath/ath10k/pci.c void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe, · line 1818

Quoted 8 lines
drivers/net/wireless/ath/ath10k/pci.c +1 -1
@@ -1812,7 +1812,7 @@ void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe,
                 if (resources > (ar_pci->attr[pipe].src_nentries >> 1))
                         return;
         }
-       ath10k_ce_per_engine_service(ar, pipe);
+       ath10k_ce_per_engine_check(ar, pipe);
  }
 
  static void ath10k_pci_rx_retry_sync(struct ath10k *ar)

Thanks for looking into this.
I applied that patch on top of current mainline, but unfortunately the result is still the same:

[    6.094149] ath10k_pci 0000:02:00.0: pci irq msi oper_irq_mode 2 irq_mode 0 reset_mode 0
[    6.241457] ath10k_pci 0000:02:00.0: qca988x hw2.0 target 0x4100016c chip_id 0x043202ff sub 0000:0000
[    6.241476] ath10k_pci 0000:02:00.0: kconfig debug 0 debugfs 0 tracing 0 dfs 1 testmode 0
[    6.242901] ath10k_pci 0000:02:00.0: firmware ver 10.2.4-1.0-00047 api 5 features no-p2p,raw-mode,mfp,allows-mesh-bcast crc32 35bd9258
[    6.309202] ath10k_pci 0000:02:00.0: board_file api 1 bmi_id N/A crc32 bebc7c08
[   12.509266] ath10k_pci 0000:02:00.0: wmi unified ready event not received
[   12.581057] ath10k_pci 0000:02:00.0: could not init core (-110)
[   12.587057] ath10k_pci 0000:02:00.0: could not probe fw (-110)
Reviewed-by on v1 1/1
#8 lore raw
In reply to Baochen Qiang

Dear Baochen,

Thank you for your patch, and sorry for the late reply.

Am 11.08.25 um 11:26 schrieb Baochen Qiang:

Quoted 39 lines

Commit e57b7d62a1b2 ("wifi: ath10k: poll service ready message before failing") works around the failure in waiting for the service ready message by active polling. Note the polling is triggered after initial wait timeout, which means that the wait-till-timeout can not be avoided even the message is ready.

A possible fix is to do polling once before wait as well, however this can not handle the race that the message arrives right after polling. So the solution is to do periodic polling until timeout.

Tested-on: QCA6174 hw3.2 PCI WLAN.RM.4.4.1-00309-QCARMSWPZ-1

Fixes e57b7d62a1b2 ("wifi: ath10k: poll service ready message before failing")
---
  drivers/net/wireless/ath/ath10k/wmi.c | 39 +++++++++++++++++------------------
  1 file changed, 19 insertions(+), 20 deletions(-)
drivers/net/wireless/ath/ath10k/wmi.c +1 -8
index cb8ae751eb312109f74985580065c3b9d3806d51..e595b0979a56d3110ce0acf534e718a4a1f36a0b 100644
@@ -1764,33 +1764,32 @@ void ath10k_wmi_put_wmi_channel(struct ath10k *ar, struct wmi_channel *ch,
 
  int ath10k_wmi_wait_for_service_ready(struct ath10k *ar)
  {
+	unsigned long timeout = jiffies + WMI_SERVICE_READY_TIMEOUT_HZ;
  	unsigned long time_left, i;
 
-	time_left = wait_for_completion_timeout(&ar->wmi.service_ready,
-						WMI_SERVICE_READY_TIMEOUT_HZ);
-	if (!time_left) {
-		/* Sometimes the PCI HIF doesn't receive interrupt
-		 * for the service ready message even if the buffer
-		 * was completed. PCIe sniffer shows that it's
-		 * because the corresponding CE ring doesn't fires
-		 * it. Workaround here by polling CE rings once.

drivers/net/wireless/ath/ath10k/wmi.c void ath10k_wmi_put_wmi_channel(struct ath10k *ar, struct wmi_channel *ch, · line 1776

Quoted 10 lines
drivers/net/wireless/ath/ath10k/wmi.c +7 -3
-		 */
-		ath10k_warn(ar, "failed to receive service ready completion, polling..\n");
-
+	/* Sometimes the PCI HIF doesn't receive interrupt
+	 * for the service ready message even if the buffer
+	 * was completed. PCIe sniffer shows that it's
+	 * because the corresponding CE ring doesn't fires
+	 * it. Workaround here by polling CE rings. Since
+	 * the message could arrive at any time, continue
+	 * polling until timeout.

I would have also re-flowed the comment to make it take up less lines.

Quoted 18 lines
drivers/net/wireless/ath/ath10k/wmi.c +6 -8
+	 */
+	do {
  		for (i = 0; i < CE_COUNT; i++)
  			ath10k_hif_send_complete_check(ar, i, 1);
 
+		/* The 100 ms granularity is a tradeoff considering scheduler
+		 * overhead and response latency
+		 */
  		time_left = wait_for_completion_timeout(&ar->wmi.service_ready,
-							WMI_SERVICE_READY_TIMEOUT_HZ);
-		if (!time_left) {
-			ath10k_warn(ar, "polling timed out\n");
-			return -ETIMEDOUT;
-		}
-
-		ath10k_warn(ar, "service ready completion received, continuing normally\n");
-	}
+							msecs_to_jiffies(100));

drivers/net/wireless/ath/ath10k/wmi.c void ath10k_wmi_put_wmi_channel(struct ath10k *ar, struct wmi_channel *ch, · line 1795

Quoted 10 lines
drivers/net/wireless/ath/ath10k/wmi.c +5 -1
+		if (time_left)
+			return 0;
+	} while (time_before(jiffies, timeout));
 
-	return 0;
+	ath10k_warn(ar, "failed to receive service ready completion\n");
+	return -ETIMEDOUT;
  }
 
  int ath10k_wmi_wait_for_unified_ready(struct ath10k *ar)

Great to have this improved upstream!

Kind regards,

Paul