Skip to content

Commit 29e2adf

Browse files
Baochen QiangJeff Johnson
authored andcommitted
wifi: ath11k: consistently use ath11k_mac_get_fw_stats()
Currently to get firmware stats, ath11k_mac_op_get_txpower() calls ath11k_fw_stats_request() and ath11k_mac_op_sta_statistics() calls ath11k_mac_get_fw_stats(). Those two helpers are basically doing the same, except for: 1. ath11k_mac_get_fw_stats() verifies ar->state inside itself. 2. ath11k_mac_get_fw_stats() calls ath11k_mac_fw_stats_request() which then calls ath11k_mac_fw_stats_reset() to free pdev/vdev stats whereas only pdev stats are freed by ath11k_fw_stats_request(). 3. ath11k_mac_get_fw_stats() waits for ar->fw_stats_complete and ar->fw_stats_done, whereas ath11k_fw_stats_request() only waits for ar->fw_stats_complete. Change to call ath11k_mac_get_fw_stats() in ath11k_mac_op_get_txpower(). This is valid because: 1. ath11k_mac_op_get_txpower() also has the same request on ar->state. 2. it is harmless to call ath11k_fw_stats_vdevs_free() since ar->fw_stats.vdevs should be empty and there should be no one expecting it at that time. 3. ath11k_mac_op_get_txpower() only needs pdev stats. For pdev stats, ar->fw_stats_done is set to true whenever ar->fw_stats_complete is set to true in ath11k_update_stats_event(). So additional wait on ar->fw_stats_done does not wast any time. Tested-on: WCN6855 hw2.0 PCI WLAN.HSP.1.1-03125-QCAHSPSWPL_V1_V2_SILICONZ_LITE-3.6510.37 Signed-off-by: Baochen Qiang <[email protected]> Reviewed-by: Vasanthakumar Thiagarajan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jeff Johnson <[email protected]>
1 parent c5b92a2 commit 29e2adf

File tree

1 file changed

+2
-42
lines changed
  • drivers/net/wireless/ath/ath11k

1 file changed

+2
-42
lines changed

drivers/net/wireless/ath/ath11k/mac.c

Lines changed: 2 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -9457,48 +9457,13 @@ static int ath11k_mac_op_remain_on_channel(struct ieee80211_hw *hw,
94579457
return ret;
94589458
}
94599459

9460-
static int ath11k_fw_stats_request(struct ath11k *ar,
9461-
struct stats_request_params *req_param)
9462-
{
9463-
struct ath11k_base *ab = ar->ab;
9464-
unsigned long time_left;
9465-
int ret;
9466-
9467-
lockdep_assert_held(&ar->conf_mutex);
9468-
9469-
spin_lock_bh(&ar->data_lock);
9470-
ath11k_fw_stats_pdevs_free(&ar->fw_stats.pdevs);
9471-
ar->fw_stats.num_vdev_recvd = 0;
9472-
ar->fw_stats.num_bcn_recvd = 0;
9473-
spin_unlock_bh(&ar->data_lock);
9474-
9475-
reinit_completion(&ar->fw_stats_complete);
9476-
reinit_completion(&ar->fw_stats_done);
9477-
9478-
ret = ath11k_wmi_send_stats_request_cmd(ar, req_param);
9479-
if (ret) {
9480-
ath11k_warn(ab, "could not request fw stats (%d)\n",
9481-
ret);
9482-
return ret;
9483-
}
9484-
9485-
time_left = wait_for_completion_timeout(&ar->fw_stats_complete,
9486-
1 * HZ);
9487-
9488-
if (!time_left)
9489-
return -ETIMEDOUT;
9490-
9491-
return 0;
9492-
}
9493-
94949460
static int ath11k_mac_op_get_txpower(struct ieee80211_hw *hw,
94959461
struct ieee80211_vif *vif,
94969462
unsigned int link_id,
94979463
int *dbm)
94989464
{
94999465
struct ath11k *ar = hw->priv;
95009466
struct ath11k_base *ab = ar->ab;
9501-
struct stats_request_params req_param = {0};
95029467
struct ath11k_fw_stats_pdev *pdev;
95039468
int ret;
95049469

@@ -9510,9 +9475,6 @@ static int ath11k_mac_op_get_txpower(struct ieee80211_hw *hw,
95109475
*/
95119476
mutex_lock(&ar->conf_mutex);
95129477

9513-
if (ar->state != ATH11K_STATE_ON)
9514-
goto err_fallback;
9515-
95169478
/* Firmware doesn't provide Tx power during CAC hence no need to fetch
95179479
* the stats.
95189480
*/
@@ -9521,10 +9483,8 @@ static int ath11k_mac_op_get_txpower(struct ieee80211_hw *hw,
95219483
return -EAGAIN;
95229484
}
95239485

9524-
req_param.pdev_id = ar->pdev->pdev_id;
9525-
req_param.stats_id = WMI_REQUEST_PDEV_STAT;
9526-
9527-
ret = ath11k_fw_stats_request(ar, &req_param);
9486+
ret = ath11k_mac_get_fw_stats(ar, ar->pdev->pdev_id, 0,
9487+
WMI_REQUEST_PDEV_STAT);
95289488
if (ret) {
95299489
ath11k_warn(ab, "failed to request fw pdev stats: %d\n", ret);
95309490
goto err_fallback;

0 commit comments

Comments
 (0)