From a3de1a56ee97153e431447156aa0e6530b0e91fc Mon Sep 17 00:00:00 2001 From: Alan Chen Date: Thu, 13 Feb 2020 11:54:35 -0800 Subject: [PATCH] qcacld-3.0: Add vdev start check before sending arp_ns stats cmd to fw Add vdev start check such that host does not send ARP_NS stats command to FW when vdev is already stopped. Change-Id: I94c0b4c26db3f48c7b2de1ad3003c0f0520fa396 CRs-Fixed: 2621587 --- core/wma/inc/wma_internal.h | 10 ++++++++++ core/wma/src/wma_dev_if.c | 8 ++++++++ core/wma/src/wma_main.c | 13 +++++++++++++ 3 files changed, 31 insertions(+) diff --git a/core/wma/inc/wma_internal.h b/core/wma/inc/wma_internal.h index 76a63be30d87..bcefb8bcadc4 100644 --- a/core/wma/inc/wma_internal.h +++ b/core/wma/inc/wma_internal.h @@ -1798,6 +1798,16 @@ int wma_fill_beacon_interval_reset_req(tp_wma_handle wma, uint8_t vdev_id, */ bool wma_is_vdev_valid(uint32_t vdev_id); +/* + * wma_is_vdev_started() - check whether vdev is started or not + * @vdev: pointer to vdev object + * + * This function verifies the vdev is started nor not + * + * Return: 'true' if vdev is started else 'false' + */ +bool wma_is_vdev_started(struct wlan_objmgr_vdev *vdev); + /** * wma_vdev_obss_detection_info_handler - event handler to handle obss detection * @handle: the wma handle diff --git a/core/wma/src/wma_dev_if.c b/core/wma/src/wma_dev_if.c index f2e7bd2d7a8e..e426bd4c1eda 100644 --- a/core/wma/src/wma_dev_if.c +++ b/core/wma/src/wma_dev_if.c @@ -1344,6 +1344,14 @@ bool wma_is_vdev_valid(uint32_t vdev_id) return wma_handle->interfaces[vdev_id].vdev_active; } +bool wma_is_vdev_started(struct wlan_objmgr_vdev *vdev) +{ + if (WLAN_VDEV_S_START == wlan_vdev_mlme_get_state(vdev)) + return true; + else + return false; +} + /** * wma_vdev_set_param() - set per vdev params in fw * @wmi_handle: wmi handle diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 6480a459e826..71d4cb0bdf3c 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -7541,22 +7541,35 @@ static void wma_set_arp_req_stats(WMA_HANDLE handle, QDF_STATUS status; struct set_arp_stats *arp_stats; tp_wma_handle wma_handle = (tp_wma_handle) handle; + struct wlan_objmgr_vdev *vdev; if (!wma_handle || !wma_handle->wmi_handle) { WMA_LOGE("%s: WMA is closed, cannot send per roam config", __func__); return; } + if (!wma_is_vdev_valid(req_buf->vdev_id)) { WMA_LOGE("vdev id:%d is not active", req_buf->vdev_id); return; } + vdev = wlan_objmgr_get_vdev_by_id_from_psoc(wma_handle->psoc, + req_buf->vdev_id, + WLAN_LEGACY_WMA_ID); + if (!wma_is_vdev_started(vdev)) { + WMA_LOGD("vdev id:%d is not started", req_buf->vdev_id); + goto release_ref; + } + arp_stats = (struct set_arp_stats *)req_buf; status = wmi_unified_set_arp_stats_req(wma_handle->wmi_handle, arp_stats); if (QDF_IS_STATUS_ERROR(status)) wma_err("failed to set arp stats to FW"); + +release_ref: + wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_WMA_ID); } /**