qcacld-3.0: Fix invalid tx power in iw dev

Host driver rate limits successive get_txpower
calls within 3 seconds, and sends cached stats
from the hdd_stats. However, max_tx_power is
not updated in the hdd_stats. Therefore,
the cached tx power is always 0 dBm.

Also, the hdd_stats would be only updated when
CP stats are received from the firmware for
get_station/dump_station calls. get_station is not
periodically queried for SAP interface from the
framework. Therefore, tx power for SAP interface will
always be 0 even if hdd_stats gets updated.

To fix this, instead of hdd_stats, return the
max tx power from the pdev stats cached on the pdev.

Change-Id: I0c8d8baab790c7344bd8913158f8eda63736474e
CRs-Fixed: 3230649
This commit is contained in:
Sai Pavan Akhil Remella 2022-07-06 16:05:46 +05:30 committed by Madan Koyyalamudi
parent 3c11d374e0
commit d92113623a
2 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,6 @@
/*
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
* Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@ -385,6 +386,12 @@ QDF_STATUS ucfg_send_big_data_stats_request(struct wlan_objmgr_vdev *vdev,
{
return QDF_STATUS_SUCCESS;
}
static inline void
ucfg_mc_cp_stats_get_tx_power(struct wlan_objmgr_vdev *vdev,
int *dbm)
{}
#endif /* QCA_SUPPORT_CP_STATS */
#endif /* __WLAN_CP_STATS_MC_UCFG_API_H__ */

View File

@ -88,6 +88,7 @@
#include "wlan_hdd_object_manager.h"
#include <linux/igmp.h>
#include "qdf_types.h"
#include <wlan_cp_stats_mc_ucfg_api.h>
/* Preprocessor definitions and constants */
#ifdef QCA_WIFI_NAPIER_EMULATION
#define HDD_SSR_BRING_UP_TIME 3000000
@ -2916,6 +2917,7 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
int status;
struct hdd_station_ctx *sta_ctx;
static bool is_rate_limited;
struct wlan_objmgr_vdev *vdev;
hdd_enter_dev(ndev);
@ -2967,7 +2969,13 @@ static int __wlan_hdd_cfg80211_get_txpower(struct wiphy *wiphy,
is_rate_limited) {
hdd_debug("Modules not enabled/rate limited, use cached stats");
/* Send cached data to upperlayer*/
*dbm = adapter->hdd_stats.class_a_stat.max_pwr;
vdev = hdd_objmgr_get_vdev(adapter);
if (!vdev) {
hdd_err("vdev is NULL");
return -EINVAL;
}
ucfg_mc_cp_stats_get_tx_power(vdev, dbm);
hdd_objmgr_put_vdev(vdev);
return 0;
}