From 95bf309c3e2bad5d22b0273e0fdd2c69d5c64170 Mon Sep 17 00:00:00 2001 From: Surya Prakash Sivaraj Date: Wed, 11 Oct 2023 11:57:53 +0530 Subject: [PATCH] qcacld-3.0: Stop SAP if all channels are disabled User disables all the channels when the SAP is in operation, and policy manager restart sap functionality cannot get any valid channels and SAP also doesn't stop. Later, kernel stops the SAP, since it is operating on an invalid channel. To fix this, restart the SAP on a valid channel only if atleast one valid channel is available. Otherwise, stop the SAP instead of waiting for kernel to stop the SAP. CRs-Fixed: 3617706 Change-Id: Ia613b8e9585ff19aae9bf97ea5d0fc230ae41c5f --- core/hdd/src/wlan_hdd_ioctl.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 9c3d6738625d..c5bcd6328c9e 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -6634,17 +6634,28 @@ static void disconnect_sta_and_restart_sap(struct hdd_context *hdd_ctx, { struct hdd_adapter *adapter, *next = NULL; QDF_STATUS status; + uint32_t ch_list[NUM_CHANNELS]; + uint32_t ch_count = 0; + bool is_valid_chan_present = true; if (!hdd_ctx) return; hdd_check_and_disconnect_sta_on_invalid_channel(hdd_ctx, reason); + status = policy_mgr_get_valid_chans(hdd_ctx->psoc, ch_list, &ch_count); + if (QDF_IS_STATUS_ERROR(status) || !ch_count) { + hdd_debug("No valid channels present, stop the SAPs"); + is_valid_chan_present = false; + } + status = hdd_get_front_adapter(hdd_ctx, &adapter); while (adapter && (status == QDF_STATUS_SUCCESS)) { if (!hdd_validate_adapter(adapter) && adapter->device_mode == QDF_SAP_MODE) { - if (check_disable_channels( + if (!is_valid_chan_present) + wlan_hdd_stop_sap(adapter); + else if (check_disable_channels( hdd_ctx, adapter->session.ap.operating_chan_freq)) policy_mgr_check_sap_restart(hdd_ctx->psoc,