2023-08-02 09:18:17

by Manish Dharanenthiran

[permalink] [raw]
Subject: [PATCH 1/2] wifi: ath12k: fix WARN_ON during ath12k_mac_update_vif_chan

Fix WARN_ON() from ath12k_mac_update_vif_chan() if vdev is not up.
Since change_chanctx can be called even before vdev_up.

Do vdev stop followed by a vdev start in case of vdev is down.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0-02903-QCAHKSWPL_SILICONZ-1

Signed-off-by: Manish Dharanenthiran <[email protected]>
---
drivers/net/wireless/ath/ath12k/mac.c | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
index 1bb9802ef569..0ab95e138d1d 100644
--- a/drivers/net/wireless/ath/ath12k/mac.c
+++ b/drivers/net/wireless/ath/ath12k/mac.c
@@ -5698,13 +5698,28 @@ ath12k_mac_update_vif_chan(struct ath12k *ar,
if (WARN_ON(!arvif->is_started))
continue;

- if (WARN_ON(!arvif->is_up))
- continue;
+ /* Firmware expect vdev_restart only if vdev is up.
+ * If vdev is down then it expect vdev_stop->vdev_start.
+ */
+ if (arvif->is_up) {
+ ret = ath12k_mac_vdev_restart(arvif, &vifs[i].new_ctx->def);
+ if (ret) {
+ ath12k_warn(ab, "failed to restart vdev %d: %d\n",
+ arvif->vdev_id, ret);
+ continue;
+ }
+ } else {
+ ret = ath12k_mac_vdev_stop(arvif);
+ if (ret) {
+ ath12k_warn(ab, "failed to stop vdev %d: %d\n",
+ arvif->vdev_id, ret);
+ continue;
+ }

- ret = ath12k_mac_vdev_restart(arvif, &vifs[i].new_ctx->def);
- if (ret) {
- ath12k_warn(ab, "failed to restart vdev %d: %d\n",
- arvif->vdev_id, ret);
+ ret = ath12k_mac_vdev_start(arvif, &vifs[i].new_ctx->def);
+ if (ret)
+ ath12k_warn(ab, "failed to start vdev %d: %d\n",
+ arvif->vdev_id, ret);
continue;
}

--
2.17.1



2023-08-02 15:14:12

by Jeff Johnson

[permalink] [raw]
Subject: Re: [PATCH 1/2] wifi: ath12k: fix WARN_ON during ath12k_mac_update_vif_chan

On 8/2/2023 1:58 AM, Manish Dharanenthiran wrote:
> Fix WARN_ON() from ath12k_mac_update_vif_chan() if vdev is not up.
> Since change_chanctx can be called even before vdev_up.
>
> Do vdev stop followed by a vdev start in case of vdev is down.
>
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0-02903-QCAHKSWPL_SILICONZ-1

Has this been tested on WCN7850? My understanding is that firmware may
expect vdev down and then vdev restart

>
> Signed-off-by: Manish Dharanenthiran <[email protected]>
> ---
> drivers/net/wireless/ath/ath12k/mac.c | 27 +++++++++++++++++++++------
> 1 file changed, 21 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c
> index 1bb9802ef569..0ab95e138d1d 100644
> --- a/drivers/net/wireless/ath/ath12k/mac.c
> +++ b/drivers/net/wireless/ath/ath12k/mac.c
> @@ -5698,13 +5698,28 @@ ath12k_mac_update_vif_chan(struct ath12k *ar,
> if (WARN_ON(!arvif->is_started))
> continue;
>
> - if (WARN_ON(!arvif->is_up))
> - continue;
> + /* Firmware expect vdev_restart only if vdev is up.
> + * If vdev is down then it expect vdev_stop->vdev_start.
> + */
> + if (arvif->is_up) {
> + ret = ath12k_mac_vdev_restart(arvif, &vifs[i].new_ctx->def);
> + if (ret) {
> + ath12k_warn(ab, "failed to restart vdev %d: %d\n",
> + arvif->vdev_id, ret);
> + continue;
> + }
> + } else {
> + ret = ath12k_mac_vdev_stop(arvif);
> + if (ret) {
> + ath12k_warn(ab, "failed to stop vdev %d: %d\n",
> + arvif->vdev_id, ret);
> + continue;
> + }
>
> - ret = ath12k_mac_vdev_restart(arvif, &vifs[i].new_ctx->def);
> - if (ret) {
> - ath12k_warn(ab, "failed to restart vdev %d: %d\n",
> - arvif->vdev_id, ret);
> + ret = ath12k_mac_vdev_start(arvif, &vifs[i].new_ctx->def);
> + if (ret)
> + ath12k_warn(ab, "failed to start vdev %d: %d\n",
> + arvif->vdev_id, ret);
> continue;
> }
>


2023-08-03 11:50:37

by Manish Dharanenthiran

[permalink] [raw]
Subject: Re: [PATCH 1/2] wifi: ath12k: fix WARN_ON during ath12k_mac_update_vif_chan



On 8/2/2023 8:29 PM, Jeff Johnson wrote:
> On 8/2/2023 1:58 AM, Manish Dharanenthiran wrote:
>> Fix WARN_ON() from ath12k_mac_update_vif_chan() if vdev is not up.
>> Since change_chanctx can be called even before vdev_up.
>>
>> Do vdev stop followed by a vdev start in case of vdev is down.
>>
>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0-02903-QCAHKSWPL_SILICONZ-1
>
> Has this been tested on WCN7850? My understanding is that firmware may
> expect vdev down and then vdev restart
Hi Jeff,

No, not tested with WCN7850 chip-set. But, we will be sending vdev_down
before starting the restart sequence. Let me get help from MCC team to
test this patch and update the changes, if needed.
>
>>
>> Signed-off-by: Manish Dharanenthiran <[email protected]>
>> ---
>>   drivers/net/wireless/ath/ath12k/mac.c | 27 +++++++++++++++++++++------
>>   1 file changed, 21 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/wireless/ath/ath12k/mac.c
>> b/drivers/net/wireless/ath/ath12k/mac.c
>> index 1bb9802ef569..0ab95e138d1d 100644
>> --- a/drivers/net/wireless/ath/ath12k/mac.c
>> +++ b/drivers/net/wireless/ath/ath12k/mac.c
>> @@ -5698,13 +5698,28 @@ ath12k_mac_update_vif_chan(struct ath12k *ar,
>>           if (WARN_ON(!arvif->is_started))
>>               continue;
>> -        if (WARN_ON(!arvif->is_up))
>> -            continue;
>> +        /* Firmware expect vdev_restart only if vdev is up.
>> +         * If vdev is down then it expect vdev_stop->vdev_start.
>> +         */
>> +        if (arvif->is_up) {
>> +            ret = ath12k_mac_vdev_restart(arvif, &vifs[i].new_ctx->def);
>> +            if (ret) {
>> +                ath12k_warn(ab, "failed to restart vdev %d: %d\n",
>> +                        arvif->vdev_id, ret);
>> +                continue;
>> +            }
>> +        } else {
>> +            ret = ath12k_mac_vdev_stop(arvif);
>> +            if (ret) {
>> +                ath12k_warn(ab, "failed to stop vdev %d: %d\n",
>> +                        arvif->vdev_id, ret);
>> +                continue;
>> +            }
>> -        ret = ath12k_mac_vdev_restart(arvif, &vifs[i].new_ctx->def);
>> -        if (ret) {
>> -            ath12k_warn(ab, "failed to restart vdev %d: %d\n",
>> -                    arvif->vdev_id, ret);
>> +            ret = ath12k_mac_vdev_start(arvif, &vifs[i].new_ctx->def);
>> +            if (ret)
>> +                ath12k_warn(ab, "failed to start vdev %d: %d\n",
>> +                        arvif->vdev_id, ret);
>>               continue;
>>           }
>

2023-08-08 20:32:01

by Wen Gong

[permalink] [raw]
Subject: Re: [PATCH 1/2] wifi: ath12k: fix WARN_ON during ath12k_mac_update_vif_chan

On 8/2/2023 10:59 PM, Jeff Johnson wrote:
> On 8/2/2023 1:58 AM, Manish Dharanenthiran wrote:
>> Fix WARN_ON() from ath12k_mac_update_vif_chan() if vdev is not up.
>> Since change_chanctx can be called even before vdev_up.
>>
>> Do vdev stop followed by a vdev start in case of vdev is down.
>>
>> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0-02903-QCAHKSWPL_SILICONZ-1
>
> Has this been tested on WCN7850? My understanding is that firmware may
> expect vdev down and then vdev restart
>
For WCN7850, firmware do not expect vdev down for station vdev type here.

And this patch only take effect when arvif->is_up is not set,

it is hard to happen that for MCC station mode.

Because this function is entered for channel switch for MCC station mode,

it means station is connected to the AP, then arvif->is_up is set, then
this patch not take effect.

[...]

>

2023-09-20 13:37:52

by Kalle Valo

[permalink] [raw]
Subject: Re: [PATCH 1/2] wifi: ath12k: fix WARN_ON during ath12k_mac_update_vif_chan

Manish Dharanenthiran <[email protected]> wrote:

> Fix WARN_ON() from ath12k_mac_update_vif_chan() if vdev is not up.
> Since change_chanctx can be called even before vdev_up.
>
> Do vdev stop followed by a vdev start in case of vdev is down.
>
> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0-02903-QCAHKSWPL_SILICONZ-1
>
> Signed-off-by: Manish Dharanenthiran <[email protected]>
> Signed-off-by: Kalle Valo <[email protected]>

2 patches applied to ath-next branch of ath.git, thanks.

8b8b990fe495 wifi: ath12k: fix WARN_ON during ath12k_mac_update_vif_chan
3f53624f74f4 wifi: ath12k: fix radar detection in 160 MHz

--
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches