Bladeren bron

qcacld-3.0: Stop the opportunistic timer when hdd stop happens

Stop the opportunistic timer & take action if needed when hdd stop
happens. Also, take action when set_hw_mode request to FW times out.

Change-Id: I32f1e38e93a5805e0d85b800cc4e070cd6f79669
CRs-Fixed: 2133388
Tushnim Bhattacharyya 7 jaren geleden
bovenliggende
commit
8629489f02

+ 2 - 0
core/hdd/src/wlan_hdd_main.c

@@ -2714,6 +2714,8 @@ static int __hdd_stop(struct net_device *dev)
 	if (WLAN_HDD_IS_NDI(adapter))
 		return 0;
 
+	policy_mgr_check_and_stop_opportunistic_timer(hdd_ctx->hdd_psoc);
+
 	/*
 	 * The interface is marked as down for outside world (aka kernel)
 	 * But the driver is pretty much alive inside. The driver needs to

+ 15 - 0
core/sme/src/common/sme_api.c

@@ -229,6 +229,9 @@ static QDF_STATUS sme_process_set_hw_mode_resp(tpAniSirGlobal mac, uint8_t *msg)
 	}
 
 end:
+	wlan_objmgr_vdev_release_ref(command->u.set_hw_mode_cmd.vdev,
+		WLAN_LEGACY_SME_ID);
+
 	found = csr_nonscan_active_ll_remove_entry(mac, entry,
 			LL_ACCESS_LOCK);
 	if (found)
@@ -13664,6 +13667,7 @@ QDF_STATUS sme_pdev_set_hw_mode(struct policy_mgr_hw_mode msg)
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 	tpAniSirGlobal mac = sme_get_mac_context();
 	tSmeCmd *cmd = NULL;
+	struct wlan_objmgr_vdev *vdev = NULL;
 
 	status = sme_acquire_global_lock(&mac->sme);
 	if (!QDF_IS_STATUS_SUCCESS(status)) {
@@ -13671,9 +13675,19 @@ QDF_STATUS sme_pdev_set_hw_mode(struct policy_mgr_hw_mode msg)
 		return QDF_STATUS_E_RESOURCES;
 	}
 
+	vdev = wlan_objmgr_get_vdev_by_id_from_psoc(mac->psoc, msg.session_id,
+		WLAN_LEGACY_SME_ID);
+	if (!vdev) {
+		sme_err("vdev is NULL for sme_session, no need to proceed with cmd Qing:%d",
+		msg.session_id);
+		sme_release_global_lock(&mac->sme);
+		return QDF_STATUS_E_NULL_VALUE;
+	}
+
 	cmd = csr_get_command_buffer(mac);
 	if (!cmd) {
 		sme_err("Get command buffer failed");
+		wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID);
 		sme_release_global_lock(&mac->sme);
 		return QDF_STATUS_E_NULL_VALUE;
 	}
@@ -13684,6 +13698,7 @@ QDF_STATUS sme_pdev_set_hw_mode(struct policy_mgr_hw_mode msg)
 	cmd->u.set_hw_mode_cmd.set_hw_mode_cb = msg.set_hw_mode_cb;
 	cmd->u.set_hw_mode_cmd.reason = msg.reason;
 	cmd->u.set_hw_mode_cmd.session_id = msg.session_id;
+	cmd->u.set_hw_mode_cmd.vdev = vdev;
 	cmd->u.set_hw_mode_cmd.context = msg.context;
 
 	sme_debug("Queuing set hw mode to CSR, session: %d reason: %d",

+ 4 - 0
core/sme/src/csr/csr_api_roam.c

@@ -20403,6 +20403,8 @@ void csr_process_set_hw_mode(tpAniSirGlobal mac, tSmeCmd *command)
 		policy_mgr_set_hw_mode_change_in_progress(mac->psoc,
 			POLICY_MGR_HW_MODE_NOT_IN_PROGRESS);
 		sme_err("Posting to PE failed");
+		wlan_objmgr_vdev_release_ref(command->u.set_hw_mode_cmd.vdev,
+			WLAN_LEGACY_SME_ID);
 		return;
 	}
 	return;
@@ -20413,6 +20415,8 @@ fail:
 	if (!param) {
 		sme_err(
 			"Malloc fail: Fail to send response to SME");
+		wlan_objmgr_vdev_release_ref(command->u.set_hw_mode_cmd.vdev,
+			WLAN_LEGACY_SME_ID);
 		return;
 	}
 	sme_err("Sending set HW fail response to SME");

+ 3 - 0
core/wma/inc/wma.h

@@ -288,6 +288,9 @@ enum ds_mode {
 #define WMA_DEL_P2P_SELF_STA_RSP_START 0x03
 #define WMA_SET_LINK_PEER_RSP 0x04
 #define WMA_DELETE_PEER_RSP 0x05
+
+#define WMA_PDEV_SET_HW_MODE_RESP 0x06
+
 #define WMA_VDEV_START_REQUEST_TIMEOUT		6000 /* 6s */
 #define WMA_VDEV_STOP_REQUEST_TIMEOUT		6000 /* 6s */
 #define WMA_VDEV_HW_MODE_REQUEST_TIMEOUT	5000 /* 5s */

+ 20 - 0
core/wma/src/wma_dev_if.c

@@ -2858,6 +2858,26 @@ void wma_hold_req_timer(void *data)
 		else
 			wma_send_msg_high_priority(wma, WMA_DELETE_BSS_RSP,
 						   params, 0);
+	} else if ((tgt_req->msg_type == SIR_HAL_PDEV_SET_HW_MODE) &&
+			(tgt_req->type == WMA_PDEV_SET_HW_MODE_RESP)) {
+		struct sir_set_hw_mode_resp *params =
+			qdf_mem_malloc(sizeof(*params));
+
+		WMA_LOGE(FL("set hw mode req timed out"));
+
+		if (!params)
+			WMA_LOGE("%s: Memory allocation failed", __func__);
+		else {
+			params->status = SET_HW_MODE_STATUS_ECANCELED;
+			params->cfgd_hw_mode_index = 0;
+			params->num_vdev_mac_entries = 0;
+
+			if (wma_crash_on_fw_timeout(wma->fw_timeout_crash) == true)
+				QDF_BUG(0);
+			else
+				wma_send_msg_high_priority(wma,
+					SIR_HAL_PDEV_SET_HW_MODE_RESP, params, 0);
+		}
 	} else {
 		WMA_LOGE(FL("Unhandled timeout for msg_type:%d and type:%d"),
 				tgt_req->msg_type, tgt_req->type);

+ 9 - 0
core/wma/src/wma_main.c

@@ -8140,6 +8140,7 @@ QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle,
 					 struct policy_mgr_hw_mode *msg)
 {
 	struct sir_set_hw_mode_resp *param;
+	struct wma_target_req *timeout_msg;
 
 	if (!wma_handle) {
 		WMA_LOGE("%s: WMA handle is NULL. Cannot issue command",
@@ -8163,6 +8164,14 @@ QDF_STATUS wma_send_pdev_set_hw_mode_cmd(tp_wma_handle wma_handle,
 		wma_release_wakelock(&wma_handle->wmi_cmd_rsp_wake_lock);
 		goto fail;
 	}
+	timeout_msg = wma_fill_hold_req(wma_handle, 0,
+			SIR_HAL_PDEV_SET_HW_MODE,
+			WMA_PDEV_SET_HW_MODE_RESP, NULL,
+			WMA_VDEV_HW_MODE_REQUEST_TIMEOUT - 1);
+	if (!timeout_msg) {
+		WMA_LOGE("Failed to allocate request for SIR_HAL_PDEV_SET_HW_MODE");
+		wma_remove_req(wma_handle, 0, WMA_PDEV_SET_HW_MODE_RESP);
+	}
 
 	return QDF_STATUS_SUCCESS;
 fail: