Explorar el Código

qcacld-3.0: Process Disconnect request from FW

FW sends a disconnect request to HOST while roaming failure
through event WMI_VDEV_DISCONNECT_EVENTID per vdev id.
Fix is:
1. Process WMI_VDEV_DISCONNECT_EVENTID and issue disconnection.
2. Make WMI_VDEV_DISCONNECT_EVENTID event as wakable

Change-Id: Ic1e83aace48a3e8424f23641b0e77c66f4283587
CRs-Fixed: 2731952
Abhinav Kumar hace 4 años
padre
commit
68c001d157

+ 3 - 0
components/pmo/core/src/wlan_pmo_wow.c

@@ -429,6 +429,9 @@ void pmo_set_sta_wow_bitmask(uint32_t *bitmask, uint32_t wow_bitmap_size)
 	pmo_set_wow_event_bitmap(WOW_ROAM_PMKID_REQUEST_EVENT,
 				 wow_bitmap_size,
 				 bitmask);
+	pmo_set_wow_event_bitmap(WOW_VDEV_DISCONNECT_EVENT,
+				 wow_bitmap_size,
+				 bitmask);
 }
 
 void pmo_set_sap_wow_bitmask(uint32_t *bitmask, uint32_t wow_bitmap_size)

+ 28 - 0
core/wma/inc/wma_internal.h

@@ -186,6 +186,15 @@ void wma_process_roam_synch_fail(WMA_HANDLE handle,
 int wma_roam_synch_event_handler(void *handle, uint8_t *event,
 					uint32_t len);
 
+/**
+ * wma_register_roam_vdev_disc_event_handler() - API to register handler for
+ * roam vdev disconnect event id
+ * @wma_handle: wma handle
+ *
+ * Return: void
+ */
+void wma_register_roam_vdev_disc_event_handler(tp_wma_handle wma_handle);
+
 #ifdef WLAN_FEATURE_FIPS
 /**
  * wma_register_pmkid_req_event_handler() - Register pmkid request event handler
@@ -277,6 +286,18 @@ int wma_mlme_roam_synch_event_handler_cb(void *handle, uint8_t *event,
  */
 int wma_roam_synch_frame_event_handler(void *handle, uint8_t *event,
 					uint32_t len);
+
+/**
+ * wma_roam_vdev_disconnect_event_handler() - Handles roam vdev disconnect event
+ * @handle: wma_handle
+ * @event: pmkid request event data pointer
+ * @len: length of the data
+ *
+ * @Return: 0 on sucees else error code
+ */
+int wma_roam_vdev_disconnect_event_handler(void *handle, uint8_t *event,
+					   uint32_t len);
+
 #else
 static inline int wma_mlme_roam_synch_event_handler_cb(void *handle,
 						       uint8_t *event,
@@ -285,6 +306,13 @@ static inline int wma_mlme_roam_synch_event_handler_cb(void *handle,
 	return 0;
 }
 
+static inline int
+wma_roam_vdev_disconnect_event_handler(void *handle, uint8_t *event,
+				       uint32_t len)
+{
+	return 0;
+}
+
 static inline int
 wma_roam_stats_event_handler(WMA_HANDLE handle, uint8_t *event,
 			     uint32_t len)

+ 11 - 0
core/wma/src/wma_features.c

@@ -1530,6 +1530,8 @@ static const uint8_t *wma_wow_wake_reason_str(A_INT32 wake_reason)
 		return "PAGE_FAULT";
 	case WOW_REASON_ROAM_PMKID_REQUEST:
 		return "ROAM_PMKID_REQUEST";
+	case WOW_REASON_VDEV_DISCONNECT:
+		return "VDEV_DISCONNECT";
 	default:
 		return "unknown";
 	}
@@ -1755,6 +1757,9 @@ static int wow_get_wmi_eventid(int32_t reason, uint32_t tag)
 	case WOW_REASON_ROAM_PMKID_REQUEST:
 		event_id = WMI_ROAM_PMKID_REQUEST_EVENTID;
 		break;
+	case WOW_REASON_VDEV_DISCONNECT:
+		event_id = WMI_VDEV_DISCONNECT_EVENTID;
+		break;
 	default:
 		wma_debug("No Event Id for WOW reason %s(%d)",
 			 wma_wow_wake_reason_str(reason), reason);
@@ -1794,6 +1799,7 @@ static bool is_piggybacked_event(int32_t reason)
 	case WOW_REASON_TDLS_CONN_TRACKER_EVENT:
 	case WOW_REASON_ROAM_HO:
 	case WOW_REASON_ROAM_PMKID_REQUEST:
+	case WOW_REASON_VDEV_DISCONNECT:
 		return true;
 	default:
 		return false;
@@ -2666,6 +2672,11 @@ static int wma_wake_event_piggybacked(
 		errno = wma_roam_pmkid_request_event_handler(wma, pb_event,
 							     pb_event_len);
 		break;
+	case WOW_REASON_VDEV_DISCONNECT:
+		wma_debug("Host woken up because of vdev disconnect event");
+		errno = wma_roam_vdev_disconnect_event_handler(wma, pb_event,
+							       pb_event_len);
+		break;
 	default:
 		wma_err("Wake reason %s(%u) is not a piggybacked event",
 			 wma_wow_wake_reason_str(wake_reason), wake_reason);

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

@@ -3259,6 +3259,12 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
 					   WMA_RX_SERIALIZER_CTX);
 
 	wma_register_pmkid_req_event_handler(wma_handle);
+
+	wmi_unified_register_event_handler(wma_handle->wmi_handle,
+					wmi_vdev_disconnect_event_id,
+					wma_roam_vdev_disconnect_event_handler,
+					WMA_RX_SERIALIZER_CTX);
+
 #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
 				wmi_rssi_breach_event_id,

+ 58 - 23
core/wma/src/wma_scan_roam.c

@@ -312,6 +312,29 @@ static inline void wma_roam_scan_fill_fils_params(
 { }
 #endif
 
+/**
+ * wma_handle_btm_disassoc_imminent_msg() - Send del sta msg to lim on receiving
+ * BTM request from AP with disassoc imminent reason
+ * @wma_handle: wma handle
+ * @vdev_id: vdev id
+ *
+ * Return: None
+ */
+static void wma_handle_btm_disassoc_imminent_msg(tp_wma_handle wma_handle,
+						 uint32_t vdev_id)
+{
+	tpDeleteStaContext del_sta_ctx;
+
+	del_sta_ctx = qdf_mem_malloc(sizeof(tDeleteStaContext));
+	if (!del_sta_ctx)
+		return;
+
+	del_sta_ctx->vdev_id = vdev_id;
+	del_sta_ctx->reasonCode = HAL_DEL_STA_REASON_CODE_BTM_DISASSOC_IMMINENT;
+	wma_send_msg(wma_handle, SIR_LIM_DELETE_STA_CONTEXT_IND,
+		     (void *)del_sta_ctx, 0);
+}
+
 /**
  * wma_roam_scan_offload_set_params() - Set roam scan offload params
  * @wma_handle: pointer to wma context
@@ -376,6 +399,41 @@ static void wma_roam_scan_offload_set_params(
 		 params->roam_offload_params.roam_preauth_no_ack_timeout,
 		 params->is_sae_same_pmk);
 }
+
+int wma_roam_vdev_disconnect_event_handler(void *handle, uint8_t *event,
+					   uint32_t len)
+{
+	WMI_VDEV_DISCONNECT_EVENTID_param_tlvs *param_buf;
+	wmi_vdev_disconnect_event_fixed_param *roam_vdev_disc_ev;
+	tp_wma_handle wma = (tp_wma_handle)handle;
+
+	if (!event) {
+		wma_err("%s: received null event from target", __func__);
+		return -EINVAL;
+	}
+
+	param_buf = (WMI_VDEV_DISCONNECT_EVENTID_param_tlvs *)event;
+
+	roam_vdev_disc_ev = param_buf->fixed_param;
+	if (!roam_vdev_disc_ev) {
+		wma_err("%s: roam cap event is NULL", __func__);
+		return -EINVAL;
+	}
+
+	wma_debug("Received disconnect roam event on vdev_id : %d, reason:%d",
+		 roam_vdev_disc_ev->vdev_id, roam_vdev_disc_ev->reason);
+
+	switch (roam_vdev_disc_ev->reason) {
+	case WLAN_DISCONNECT_REASON_MOVE_TO_CELLULAR:
+		wma_handle_btm_disassoc_imminent_msg(wma,
+						roam_vdev_disc_ev->vdev_id);
+		break;
+	default:
+		return 0;
+	}
+
+	return 0;
+}
 #else
 static void wma_roam_scan_offload_set_params(
 				tp_wma_handle wma_handle,
@@ -5898,29 +5956,6 @@ void wma_roam_better_ap_handler(tp_wma_handle wma, uint32_t vdev_id)
 		qdf_mem_free(candidate_ind);
 }
 
-/**
- * wma_handle_btm_disassoc_imminent_msg() - Send del sta msg to lim on receiving
- * BTM request from AP with disassoc imminent reason
- * @wma_handle: wma handle
- * @vdev_id: vdev id
- *
- * Return: None
- */
-static void wma_handle_btm_disassoc_imminent_msg(tp_wma_handle wma_handle,
-						 uint32_t vdev_id)
-{
-	tpDeleteStaContext del_sta_ctx;
-
-	del_sta_ctx = qdf_mem_malloc(sizeof(tDeleteStaContext));
-	if (!del_sta_ctx)
-		return;
-
-	del_sta_ctx->vdev_id = vdev_id;
-	del_sta_ctx->reasonCode = HAL_DEL_STA_REASON_CODE_BTM_DISASSOC_IMMINENT;
-	wma_send_msg(wma_handle, SIR_LIM_DELETE_STA_CONTEXT_IND,
-		     (void *)del_sta_ctx, 0);
-}
-
 /**
  * wma_handle_hw_mode_in_roam_fail() - Fill hw mode info if present in policy
  * manager.