From 4981a8f790a23beb05a1c95f2e0cdf74fec2012a Mon Sep 17 00:00:00 2001 From: Rakesh Pillai Date: Mon, 8 Jul 2019 17:53:02 +0530 Subject: [PATCH] qcacld-3.0: cdp: Convergence of cdp_mob_stats_ops Currently the cdp apis are given pdev/vdev/peer handle as its arguments, which is directly accessed in those APIs. This can cause a race-condition in access of the respective handles if it has been deleted in parallel. Hence as a part of cdp convergence, pass only the pdev/vdev id or peer mac address, which will be used to get the respective handles, and hence avoiding the unwanted access of the handles if it has been deleted. Converged mob_stats_ops - clear_stats CRs-Fixed: 2539747 Change-Id: I5ee060b62d15380df4b8d15bb5709d700902aafd --- core/dp/txrx/ol_txrx.c | 9 +++++---- core/hdd/src/wlan_hdd_hostapd_wext.c | 4 +++- core/hdd/src/wlan_hdd_wext.c | 3 +++ 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index c3c95c06606c..bd8963ccb4fd 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/core/dp/txrx/ol_txrx.c @@ -4533,17 +4533,18 @@ ol_txrx_display_stats(void *soc, uint16_t value, /** * ol_txrx_clear_stats() - Clear OL TXRX stats * @soc - ol soc handle + * @pdev_id: pdev identifier * @value - Module id for which stats needs to be cleared * * Return: 0 - success/ non-zero failure */ -static QDF_STATUS ol_txrx_clear_stats(struct cdp_soc *soc, - uint8_t value) +static QDF_STATUS ol_txrx_clear_stats(struct cdp_soc_t *soc_hdl, + uint8_t pdev_id, uint8_t value) { - ol_txrx_pdev_handle pdev; + struct ol_txrx_soc_t *soc = cdp_soc_t_to_ol_txrx_soc_t(soc_hdl); + ol_txrx_pdev_handle pdev = ol_txrx_get_pdev_from_pdev_id(soc, pdev_id); QDF_STATUS status = QDF_STATUS_SUCCESS; - pdev = cds_get_context(QDF_MODULE_ID_TXRX); if (!pdev) { QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR, "%s: pdev is NULL", __func__); diff --git a/core/hdd/src/wlan_hdd_hostapd_wext.c b/core/hdd/src/wlan_hdd_hostapd_wext.c index a90c0023be4d..a066d4d63058 100644 --- a/core/hdd/src/wlan_hdd_hostapd_wext.c +++ b/core/hdd/src/wlan_hdd_hostapd_wext.c @@ -37,6 +37,7 @@ #endif #include "wlan_hdd_power.h" #include "wlan_policy_mgr_ucfg.h" +#include #include #include "wlan_dfs_utils_api.h" #include @@ -957,7 +958,8 @@ static __iw_softap_setparam(struct net_device *dev, break; default: if (soc) - cdp_clear_stats(soc, set_value); + cdp_clear_stats(soc, OL_TXRX_PDEV_ID, + set_value); } break; } diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index f4fa0f49ea0f..b2c8355bc130 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -55,6 +55,8 @@ #include "dbglog_host.h" #include "wma.h" +#include + #include "wlan_hdd_power.h" #include "qwlan_version.h" #include "wlan_hdd_host_offload.h" @@ -4811,6 +4813,7 @@ static int hdd_we_clear_stats(struct hdd_adapter *adapter, int option) break; default: status = cdp_clear_stats(cds_get_context(QDF_MODULE_ID_SOC), + OL_TXRX_PDEV_ID, option); if (status != QDF_STATUS_SUCCESS) hdd_debug("Failed to dump stats for option: %d",