wifi: ath12k: fix WARN_ON during ath12k_mac_update_vif_chan
authorManish Dharanenthiran <quic_mdharane@quicinc.com>
Tue, 5 Sep 2023 13:29:41 +0000 (16:29 +0300)
committerKalle Valo <quic_kvalo@quicinc.com>
Wed, 20 Sep 2023 13:14:40 +0000 (16:14 +0300)
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 <quic_mdharane@quicinc.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20230802085852.19821-2-quic_mdharane@quicinc.com
drivers/net/wireless/ath/ath12k/mac.c

index 88346e66bb753e93e2cd85905386d09a2b866b9f..092081d69626c6ff9d7752c928d1d4c8a7a8336f 100644 (file)
@@ -6039,13 +6039,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;
                }