Skip to content

Commit ac7b8ff

Browse files
Baochen Qiangjeff-t-johnson
authored andcommitted
wifi: ath12k: don't use static variables in ath12k_wmi_fw_stats_process()
Currently ath12k_wmi_fw_stats_process() is using static variables to count firmware stat events. Taking num_vdev as an example, if for whatever reason (say ar->num_started_vdevs is 0 or firmware bug etc.) the following condition (++num_vdev) == total_vdevs_started is not met, is_end is not set thus num_vdev won't be cleared. Next time when firmware stats is requested again, even if everything is working fine, failure is expected due to the condition above will never be satisfied. The same applies to num_bcn as well. Change to use non-static counters and reset them each time before firmware stats is requested. Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c5-00284.1-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 Tested-on: QCN9274 hw2.0 WLAN.WBE.1.5-01651-QCAHKSWPL_SILICONZ-1 Fixes: e367c92 ("wifi: ath12k: Request vdev stats from firmware") Signed-off-by: Baochen Qiang <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]>
1 parent 9a353a4 commit ac7b8ff

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

drivers/net/wireless/ath/ath12k/core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,8 @@ void ath12k_fw_stats_reset(struct ath12k *ar)
12301230
{
12311231
spin_lock_bh(&ar->data_lock);
12321232
ath12k_fw_stats_free(&ar->fw_stats);
1233+
ar->fw_stats.num_vdev_recvd = 0;
1234+
ar->fw_stats.num_bcn_recvd = 0;
12331235
spin_unlock_bh(&ar->data_lock);
12341236
}
12351237

drivers/net/wireless/ath/ath12k/core.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,8 @@ struct ath12k_fw_stats {
632632
struct list_head pdevs;
633633
struct list_head vdevs;
634634
struct list_head bcn;
635+
u32 num_vdev_recvd;
636+
u32 num_bcn_recvd;
635637
};
636638

637639
struct ath12k_dbg_htt_stats {

drivers/net/wireless/ath/ath12k/wmi.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8166,7 +8166,6 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar,
81668166
struct ath12k_base *ab = ar->ab;
81678167
struct ath12k_pdev *pdev;
81688168
bool is_end;
8169-
static unsigned int num_vdev, num_bcn;
81708169
size_t total_vdevs_started = 0;
81718170
int i;
81728171

@@ -8186,15 +8185,14 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar,
81868185
}
81878186
rcu_read_unlock();
81888187

8189-
is_end = ((++num_vdev) == total_vdevs_started);
8188+
is_end = ((++ar->fw_stats.num_vdev_recvd) == total_vdevs_started);
81908189

81918190
list_splice_tail_init(&stats->vdevs,
81928191
&ar->fw_stats.vdevs);
81938192

8194-
if (is_end) {
8193+
if (is_end)
81958194
complete(&ar->fw_stats_done);
8196-
num_vdev = 0;
8197-
}
8195+
81988196
return;
81998197
}
82008198

@@ -8206,15 +8204,13 @@ static void ath12k_wmi_fw_stats_process(struct ath12k *ar,
82068204
/* Mark end until we reached the count of all started VDEVs
82078205
* within the PDEV
82088206
*/
8209-
is_end = ((++num_bcn) == ar->num_started_vdevs);
8207+
is_end = ((++ar->fw_stats.num_bcn_recvd) == ar->num_started_vdevs);
82108208

82118209
list_splice_tail_init(&stats->bcn,
82128210
&ar->fw_stats.bcn);
82138211

8214-
if (is_end) {
8212+
if (is_end)
82158213
complete(&ar->fw_stats_done);
8216-
num_bcn = 0;
8217-
}
82188214
}
82198215
}
82208216

0 commit comments

Comments
 (0)