* [RFC PATCH] wifi: ath10k: support flush_sta method
@ 2025-08-06 7:00 Zhi-Jun You
2025-08-06 14:23 ` Jeff Johnson
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Zhi-Jun You @ 2025-08-06 7:00 UTC (permalink / raw)
To: jjohnson; +Cc: linux-wireless, ath10k, Zhi-Jun You
When a STA is marked as no longer authorized, if the driver doesn't
implement flush_sta(), mac80211 calls ieee80211_flush_queues() to
flush hardware queues to avoid sending unencrypted frames.
This has became a problem for ath10k because ieee80211_flush_queues()
will stop all traffic and call ath10k_flush, which waits until the
whole HW queue is empty. In a busy environment this will trigger a
timeout warning and stalls other STAs.
Fix this by implementing flush_sta method using WMI command to flush
frames of a specific STA.
Flushed frames will be marked as discard in tx complete indication.
ops->flush_sta will be set to NULL if htt.disable_tx_comp is set to
true.
Tested-on: QCA9984 hw1.0 PCI 10.4-3.9.0.2-00157
Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
---
drivers/net/wireless/ath/ath10k/mac.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
index 24dd794e31ea..6959f20334a7 100644
--- a/drivers/net/wireless/ath/ath10k/mac.c
+++ b/drivers/net/wireless/ath/ath10k/mac.c
@@ -8135,6 +8135,20 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
mutex_unlock(&ar->conf_mutex);
}
+static void ath10k_mac_op_flush_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
+ struct ieee80211_sta *sta)
+{
+ struct ath10k_vif *arvif = (void *)vif->drv_priv;
+ struct ath10k *ar = hw->priv;
+ u32 bitmap = 0xFFFFFFFF;
+ int ret = 0;
+
+ ret = ath10k_wmi_peer_flush(ar, arvif->vdev_id, sta->addr, bitmap);
+ if (ret)
+ ath10k_warn(ar, "failed to flush sta (sta %pM)\n",
+ sta->addr);
+}
+
/* TODO: Implement this function properly
* For now it is needed to reply to Probe Requests in IBSS mode.
* Probably we need this information from FW.
@@ -9487,6 +9501,7 @@ static const struct ieee80211_ops ath10k_ops = {
.set_rts_threshold = ath10k_set_rts_threshold,
.set_frag_threshold = ath10k_mac_op_set_frag_threshold,
.flush = ath10k_flush,
+ .flush_sta = ath10k_mac_op_flush_sta,
.tx_last_beacon = ath10k_tx_last_beacon,
.set_antenna = ath10k_set_antenna,
.get_antenna = ath10k_get_antenna,
@@ -10294,6 +10309,9 @@ int ath10k_mac_register(struct ath10k *ar)
if (!ar->hw_params.hw_ops->set_coverage_class)
ar->ops->set_coverage_class = NULL;
+ if (ar->htt.disable_tx_comp)
+ ar->ops->flush_sta = NULL;
+
ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
ath10k_reg_notifier);
if (ret) {
--
2.50.1
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [RFC PATCH] wifi: ath10k: support flush_sta method
2025-08-06 7:00 [RFC PATCH] wifi: ath10k: support flush_sta method Zhi-Jun You
@ 2025-08-06 14:23 ` Jeff Johnson
2025-08-06 15:51 ` Zhi-Jun You
2025-08-06 14:42 ` Nicolas Escande
2025-08-12 14:02 ` Maurer, Florian
2 siblings, 1 reply; 7+ messages in thread
From: Jeff Johnson @ 2025-08-06 14:23 UTC (permalink / raw)
To: Zhi-Jun You, jjohnson, Remi Pommarel; +Cc: linux-wireless, ath10k, Loic Poulain
On 8/6/2025 12:00 AM, Zhi-Jun You wrote:
> When a STA is marked as no longer authorized, if the driver doesn't
> implement flush_sta(), mac80211 calls ieee80211_flush_queues() to
> flush hardware queues to avoid sending unencrypted frames.
>
> This has became a problem for ath10k because ieee80211_flush_queues()
> will stop all traffic and call ath10k_flush, which waits until the
> whole HW queue is empty. In a busy environment this will trigger a
> timeout warning and stalls other STAs.
>
> Fix this by implementing flush_sta method using WMI command to flush
> frames of a specific STA.
> Flushed frames will be marked as discard in tx complete indication.
>
> ops->flush_sta will be set to NULL if htt.disable_tx_comp is set to
> true.
>
> Tested-on: QCA9984 hw1.0 PCI 10.4-3.9.0.2-00157
>
> Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
> ---
There is already a patch from Remi pending for this, see:
https://msgid.link/cover.1732293922.git.repk@triplefau.lt
Please see if that series addresses your needs.
First Kalle, and then I, held this back due to lack of internal validation
across supported platforms, but it is actually still on my TODO list:
https://patchwork.kernel.org/project/linux-wireless/list/?series=911851
Let me make one more validation request internally since I know there is at
least one ath10k-based project with active development.
/jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH] wifi: ath10k: support flush_sta method
2025-08-06 7:00 [RFC PATCH] wifi: ath10k: support flush_sta method Zhi-Jun You
2025-08-06 14:23 ` Jeff Johnson
@ 2025-08-06 14:42 ` Nicolas Escande
2025-08-06 16:27 ` Zhi-Jun You
2025-08-12 14:02 ` Maurer, Florian
2 siblings, 1 reply; 7+ messages in thread
From: Nicolas Escande @ 2025-08-06 14:42 UTC (permalink / raw)
To: Zhi-Jun You, jjohnson; +Cc: linux-wireless, ath10k
On Wed Aug 6, 2025 at 9:00 AM CEST, Zhi-Jun You wrote:
> When a STA is marked as no longer authorized, if the driver doesn't
> implement flush_sta(), mac80211 calls ieee80211_flush_queues() to
> flush hardware queues to avoid sending unencrypted frames.
>
> This has became a problem for ath10k because ieee80211_flush_queues()
> will stop all traffic and call ath10k_flush, which waits until the
> whole HW queue is empty. In a busy environment this will trigger a
> timeout warning and stalls other STAs.
>
> Fix this by implementing flush_sta method using WMI command to flush
> frames of a specific STA.
> Flushed frames will be marked as discard in tx complete indication.
>
> ops->flush_sta will be set to NULL if htt.disable_tx_comp is set to
> true.
>
> Tested-on: QCA9984 hw1.0 PCI 10.4-3.9.0.2-00157
>
> Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
> ---
> drivers/net/wireless/ath/ath10k/mac.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
> index 24dd794e31ea..6959f20334a7 100644
> --- a/drivers/net/wireless/ath/ath10k/mac.c
> +++ b/drivers/net/wireless/ath/ath10k/mac.c
> @@ -8135,6 +8135,20 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> mutex_unlock(&ar->conf_mutex);
> }
>
> +static void ath10k_mac_op_flush_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> + struct ieee80211_sta *sta)
> +{
> + struct ath10k_vif *arvif = (void *)vif->drv_priv;
> + struct ath10k *ar = hw->priv;
> + u32 bitmap = 0xFFFFFFFF;
> + int ret = 0;
> +
> + ret = ath10k_wmi_peer_flush(ar, arvif->vdev_id, sta->addr, bitmap);
> + if (ret)
> + ath10k_warn(ar, "failed to flush sta (sta %pM)\n",
> + sta->addr);
Hello,
Just to be sure, you have seen real improvements from this ?
Because I remember trying this exact WMI command two years ago and I couldn't be
sure it was actually doing something. That's one of the reasons why we ended up
doing the per peer frame accounting as posted by remi here
https://lore.kernel.org/linux-wireless/17d26d6a3e80ff03939ee7935fdc07f979b61a4f.1732293922.git.repk@triplefau.lt/
Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH] wifi: ath10k: support flush_sta method
2025-08-06 14:23 ` Jeff Johnson
@ 2025-08-06 15:51 ` Zhi-Jun You
2025-08-06 19:18 ` Nicolas Escande
0 siblings, 1 reply; 7+ messages in thread
From: Zhi-Jun You @ 2025-08-06 15:51 UTC (permalink / raw)
To: Jeff Johnson
Cc: jjohnson, Remi Pommarel, linux-wireless, ath10k, Loic Poulain
On Wed, Aug 6, 2025 at 10:23 PM Jeff Johnson
<jeff.johnson@oss.qualcomm.com> wrote:
>
> On 8/6/2025 12:00 AM, Zhi-Jun You wrote:
> > When a STA is marked as no longer authorized, if the driver doesn't
> > implement flush_sta(), mac80211 calls ieee80211_flush_queues() to
> > flush hardware queues to avoid sending unencrypted frames.
> >
> > This has became a problem for ath10k because ieee80211_flush_queues()
> > will stop all traffic and call ath10k_flush, which waits until the
> > whole HW queue is empty. In a busy environment this will trigger a
> > timeout warning and stalls other STAs.
> >
> > Fix this by implementing flush_sta method using WMI command to flush
> > frames of a specific STA.
> > Flushed frames will be marked as discard in tx complete indication.
> >
> > ops->flush_sta will be set to NULL if htt.disable_tx_comp is set to
> > true.
> >
> > Tested-on: QCA9984 hw1.0 PCI 10.4-3.9.0.2-00157
> >
> > Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
> > ---
>
> There is already a patch from Remi pending for this, see:
> https://msgid.link/cover.1732293922.git.repk@triplefau.lt
>
> Please see if that series addresses your needs.
>
> First Kalle, and then I, held this back due to lack of internal validation
> across supported platforms, but it is actually still on my TODO list:
> https://patchwork.kernel.org/project/linux-wireless/list/?series=911851
>
> Let me make one more validation request internally since I know there is at
> least one ath10k-based project with active development.
>
> /jeff
Hi Jeff,
I am aware of the series and glad to know it's still on the list.
I did test with it but the warning can still be triggered easily with
the instructions in Remi's series.
And according to other people's reports it can still block sometimes. [0]
drv_flush_sta() is called before clearing the keys and Remi's approach
still waits for the frames to be sent which imo isn't enough in this
situation.
[0]: https://github.com/openwrt/openwrt/pull/19427#issuecomment-3102794793
Best regards,
Zhi-Jun You
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH] wifi: ath10k: support flush_sta method
2025-08-06 14:42 ` Nicolas Escande
@ 2025-08-06 16:27 ` Zhi-Jun You
0 siblings, 0 replies; 7+ messages in thread
From: Zhi-Jun You @ 2025-08-06 16:27 UTC (permalink / raw)
To: Nicolas Escande; +Cc: jjohnson, linux-wireless, ath10k
Hi Nicolas,
AFAIK there's no easy way to tell if it works.
According to another commit [0] after sending the command it still
needs to go through tx completion->ath10k_txrx_tx_unref.
Best you can do is the debug message.(ATH10K_DBG_WMI, ATH10K_DBG_HTT)
[0]: https://lore.kernel.org/linux-wireless/20200415233730.10581-1-wgong@codeaurora.org/
Best regards,
Zhi-Jun You
On Wed, Aug 6, 2025 at 10:42 PM Nicolas Escande <nico.escande@gmail.com> wrote:
>
> On Wed Aug 6, 2025 at 9:00 AM CEST, Zhi-Jun You wrote:
> > When a STA is marked as no longer authorized, if the driver doesn't
> > implement flush_sta(), mac80211 calls ieee80211_flush_queues() to
> > flush hardware queues to avoid sending unencrypted frames.
> >
> > This has became a problem for ath10k because ieee80211_flush_queues()
> > will stop all traffic and call ath10k_flush, which waits until the
> > whole HW queue is empty. In a busy environment this will trigger a
> > timeout warning and stalls other STAs.
> >
> > Fix this by implementing flush_sta method using WMI command to flush
> > frames of a specific STA.
> > Flushed frames will be marked as discard in tx complete indication.
> >
> > ops->flush_sta will be set to NULL if htt.disable_tx_comp is set to
> > true.
> >
> > Tested-on: QCA9984 hw1.0 PCI 10.4-3.9.0.2-00157
> >
> > Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
> > ---
> > drivers/net/wireless/ath/ath10k/mac.c | 18 ++++++++++++++++++
> > 1 file changed, 18 insertions(+)
> >
> > diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
> > index 24dd794e31ea..6959f20334a7 100644
> > --- a/drivers/net/wireless/ath/ath10k/mac.c
> > +++ b/drivers/net/wireless/ath/ath10k/mac.c
> > @@ -8135,6 +8135,20 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> > mutex_unlock(&ar->conf_mutex);
> > }
> >
> > +static void ath10k_mac_op_flush_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> > + struct ieee80211_sta *sta)
> > +{
> > + struct ath10k_vif *arvif = (void *)vif->drv_priv;
> > + struct ath10k *ar = hw->priv;
> > + u32 bitmap = 0xFFFFFFFF;
> > + int ret = 0;
> > +
> > + ret = ath10k_wmi_peer_flush(ar, arvif->vdev_id, sta->addr, bitmap);
> > + if (ret)
> > + ath10k_warn(ar, "failed to flush sta (sta %pM)\n",
> > + sta->addr);
>
> Hello,
>
> Just to be sure, you have seen real improvements from this ?
> Because I remember trying this exact WMI command two years ago and I couldn't be
> sure it was actually doing something. That's one of the reasons why we ended up
> doing the per peer frame accounting as posted by remi here
> https://lore.kernel.org/linux-wireless/17d26d6a3e80ff03939ee7935fdc07f979b61a4f.1732293922.git.repk@triplefau.lt/
>
> Thanks
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH] wifi: ath10k: support flush_sta method
2025-08-06 15:51 ` Zhi-Jun You
@ 2025-08-06 19:18 ` Nicolas Escande
0 siblings, 0 replies; 7+ messages in thread
From: Nicolas Escande @ 2025-08-06 19:18 UTC (permalink / raw)
To: Zhi-Jun You, Jeff Johnson
Cc: jjohnson, Remi Pommarel, linux-wireless, ath10k, Loic Poulain
On Wed Aug 6, 2025 at 5:51 PM CEST, Zhi-Jun You wrote:
> On Wed, Aug 6, 2025 at 10:23 PM Jeff Johnson
> <jeff.johnson@oss.qualcomm.com> wrote:
>>
>> On 8/6/2025 12:00 AM, Zhi-Jun You wrote:
>> > When a STA is marked as no longer authorized, if the driver doesn't
>> > implement flush_sta(), mac80211 calls ieee80211_flush_queues() to
>> > flush hardware queues to avoid sending unencrypted frames.
>> >
>> > This has became a problem for ath10k because ieee80211_flush_queues()
>> > will stop all traffic and call ath10k_flush, which waits until the
>> > whole HW queue is empty. In a busy environment this will trigger a
>> > timeout warning and stalls other STAs.
>> >
>> > Fix this by implementing flush_sta method using WMI command to flush
>> > frames of a specific STA.
>> > Flushed frames will be marked as discard in tx complete indication.
>> >
>> > ops->flush_sta will be set to NULL if htt.disable_tx_comp is set to
>> > true.
>> >
>> > Tested-on: QCA9984 hw1.0 PCI 10.4-3.9.0.2-00157
>> >
>> > Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
>> > ---
>>
>> There is already a patch from Remi pending for this, see:
>> https://msgid.link/cover.1732293922.git.repk@triplefau.lt
>>
>> Please see if that series addresses your needs.
>>
>> First Kalle, and then I, held this back due to lack of internal validation
>> across supported platforms, but it is actually still on my TODO list:
>> https://patchwork.kernel.org/project/linux-wireless/list/?series=911851
>>
>> Let me make one more validation request internally since I know there is at
>> least one ath10k-based project with active development.
>>
>> /jeff
>
> Hi Jeff,
>
> I am aware of the series and glad to know it's still on the list.
> I did test with it but the warning can still be triggered easily with
> the instructions in Remi's series.
> And according to other people's reports it can still block sometimes. [0]
Well that's to be expected with this implementation and the use case described
by remi. You have a station that is out of range or powered down without telling
the ap, and you wait for the firmware to tell you that it did managed to
transmit to the sta or that it has given up transmitting. So clearly you will
have the warning.
The goal was to not block trafic pending for other STA when that happens.
What I recall, and sorry if this is vague it was quite a few years ago, is
that when issuing the WMI command to the firmware to drop all frames for the STA
it just did not, and it was still trying to transmit them (checked with ota
capture at that time). But I do not recall if the firmware tried to send frames
encrypted or not (as we would remove the key right after the wmi command and
before the firmware had given up on transmitting the frames) which was one of
the reason .flush_sta() was added in the first place I believe.
>
> drv_flush_sta() is called before clearing the keys and Remi's approach
> still waits for the frames to be sent which imo isn't enough in this
> situation.
>
> [0]: https://github.com/openwrt/openwrt/pull/19427#issuecomment-3102794793
>
> Best regards,
> Zhi-Jun You
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [RFC PATCH] wifi: ath10k: support flush_sta method
2025-08-06 7:00 [RFC PATCH] wifi: ath10k: support flush_sta method Zhi-Jun You
2025-08-06 14:23 ` Jeff Johnson
2025-08-06 14:42 ` Nicolas Escande
@ 2025-08-12 14:02 ` Maurer, Florian
2 siblings, 0 replies; 7+ messages in thread
From: Maurer, Florian @ 2025-08-12 14:02 UTC (permalink / raw)
To: jjohnson@kernel.org, hujy652@gmail.com
Cc: linux-wireless@vger.kernel.org, ath10k@lists.infradead.org
[-- Attachment #1: Type: text/plain, Size: 3733 bytes --]
Hi everyone,
we tested this patch at Freifunk Aachen using Gluon/OpenWrt.
We had the issue that the Extreme Networks WS-AP3825i did have a high
load in a busy environment, making the node unresponsive.
This issue is resolved with this patch, improving the wifi stability
noticeably, similar to
https://patchwork.kernel.org/project/linux-wireless/list/?series=911851
Restarting Wifi (using wifi) still logs
kern.warn kernel: [98526.968626] ath10k_warn: 617 callbacks suppressed
kern.warn kernel: [98526.968651] ath10k_pci a000:03:00.0: could not get
mac80211 beacon
kern.warn kernel: [98527.071045] ath10k_pci a000:03:00.0: could not get
mac80211 beacon
kern.warn kernel: [98532.104123] ath10k_pci a000:03:00.0: failed to
flush transmit queue (skip 0 ar-state 1): 0
Just like it was with the other patch.
We did also not see any "failed to flush sta" message in dmesg.
Thanks,
Florian Maurer
Tested-by: Florian Maurer <maurer@fh-aachen.de>
On Wed, 2025-08-06 at 15:00 +0800, Zhi-Jun You wrote:
> When a STA is marked as no longer authorized, if the driver doesn't
> implement flush_sta(), mac80211 calls ieee80211_flush_queues() to
> flush hardware queues to avoid sending unencrypted frames.
>
> This has became a problem for ath10k because ieee80211_flush_queues()
> will stop all traffic and call ath10k_flush, which waits until the
> whole HW queue is empty. In a busy environment this will trigger a
> timeout warning and stalls other STAs.
>
> Fix this by implementing flush_sta method using WMI command to flush
> frames of a specific STA.
> Flushed frames will be marked as discard in tx complete indication.
>
> ops->flush_sta will be set to NULL if htt.disable_tx_comp is set to
> true.
>
> Tested-on: QCA9984 hw1.0 PCI 10.4-3.9.0.2-00157
>
> Signed-off-by: Zhi-Jun You <hujy652@gmail.com>
> ---
> drivers/net/wireless/ath/ath10k/mac.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/net/wireless/ath/ath10k/mac.c b/drivers/net/wireless/ath/ath10k/mac.c
> index 24dd794e31ea..6959f20334a7 100644
> --- a/drivers/net/wireless/ath/ath10k/mac.c
> +++ b/drivers/net/wireless/ath/ath10k/mac.c
> @@ -8135,6 +8135,20 @@ static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> mutex_unlock(&ar->conf_mutex);
> }
>
> +static void ath10k_mac_op_flush_sta(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
> + struct ieee80211_sta *sta)
> +{
> + struct ath10k_vif *arvif = (void *)vif->drv_priv;
> + struct ath10k *ar = hw->priv;
> + u32 bitmap = 0xFFFFFFFF;
> + int ret = 0;
> +
> + ret = ath10k_wmi_peer_flush(ar, arvif->vdev_id, sta->addr, bitmap);
> + if (ret)
> + ath10k_warn(ar, "failed to flush sta (sta %pM)\n",
> + sta->addr);
> +}
> +
> /* TODO: Implement this function properly
> * For now it is needed to reply to Probe Requests in IBSS mode.
> * Probably we need this information from FW.
> @@ -9487,6 +9501,7 @@ static const struct ieee80211_ops ath10k_ops = {
> .set_rts_threshold = ath10k_set_rts_threshold,
> .set_frag_threshold = ath10k_mac_op_set_frag_threshold,
> .flush = ath10k_flush,
> + .flush_sta = ath10k_mac_op_flush_sta,
> .tx_last_beacon = ath10k_tx_last_beacon,
> .set_antenna = ath10k_set_antenna,
> .get_antenna = ath10k_get_antenna,
> @@ -10294,6 +10309,9 @@ int ath10k_mac_register(struct ath10k *ar)
> if (!ar->hw_params.hw_ops->set_coverage_class)
> ar->ops->set_coverage_class = NULL;
>
> + if (ar->htt.disable_tx_comp)
> + ar->ops->flush_sta = NULL;
> +
> ret = ath_regd_init(&ar->ath_common.regulatory, ar->hw->wiphy,
> ath10k_reg_notifier);
> if (ret) {
[-- Attachment #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 6551 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-08-12 14:03 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-06 7:00 [RFC PATCH] wifi: ath10k: support flush_sta method Zhi-Jun You
2025-08-06 14:23 ` Jeff Johnson
2025-08-06 15:51 ` Zhi-Jun You
2025-08-06 19:18 ` Nicolas Escande
2025-08-06 14:42 ` Nicolas Escande
2025-08-06 16:27 ` Zhi-Jun You
2025-08-12 14:02 ` Maurer, Florian
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox