From d92113623a2414f750d572f432a2a341f5ef615b Mon Sep 17 00:00:00 2001 From: Sai Pavan Akhil Remella Date: Wed, 6 Jul 2022 16:05:46 +0530 Subject: [PATCH] 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 --- .../dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h | 7 +++++++ core/hdd/src/wlan_hdd_power.c | 10 +++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h b/components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h index a41fc7cf5d1a0..847819985444c 100644 --- a/components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h +++ b/components/cp_stats/dispatcher/inc/wlan_cp_stats_mc_ucfg_api.h @@ -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__ */ diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 8aaf52f32abb1..45266d6e689d8 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -88,6 +88,7 @@ #include "wlan_hdd_object_manager.h" #include #include "qdf_types.h" +#include /* 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; }