Эх сурвалжийг харах

qcacld-3.0: wma to target_if migration of roam_scan_ch list_event

Currently, wmi_roam_scan_chan_list_id data is extracted and
processing is also done in wma. This is not inline with component
model where target_if takes care of data extraction and handover
the extracted data to corresponding component(connection mgr in
this case). Add changes to support the same.

Change-Id: I8f59f9ebfe1bbdc7ef37ccc1f10178fe8128e912
CRs-Fixed: 2990376
Srinivas Dasari 3 жил өмнө
parent
commit
f39f703609

+ 19 - 0
components/target_if/connection_mgr/inc/target_if_cm_roam_event.h

@@ -86,6 +86,18 @@ target_if_roam_offload_register_events(struct wlan_objmgr_psoc *psoc);
 int
 target_if_cm_roam_vdev_disconnect_event_handler(ol_scn_t scn, uint8_t *event,
 						uint32_t len);
+
+/**
+ * target_if_cm_roam_scan_chan_list_event_handler - roam scan ch evt handler
+ * @scn: target handle
+ * @event: event buffer
+ * @len: event buffer length
+ *
+ * Return: int for success or error code
+ */
+int
+target_if_cm_roam_scan_chan_list_event_handler(ol_scn_t scn, uint8_t *event,
+					       uint32_t len);
 #endif /* ROAM_TARGET_IF_CONVERGENCE */
 
 /**
@@ -124,6 +136,13 @@ target_if_cm_roam_vdev_disconnect_event_handler(ol_scn_t scn, uint8_t *event,
 {
 	return 0;
 }
+
+static inline int
+target_if_cm_roam_scan_chan_list_event_handler(ol_scn_t scn, uint8_t *event,
+					       uint32_t len)
+{
+	return 0;
+}
 #endif /* ROAM_TARGET_IF_CONVERGENCE */
 #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
 #endif

+ 54 - 0
components/target_if/connection_mgr/src/target_if_cm_roam_event.c

@@ -59,6 +59,7 @@ target_if_cm_roam_register_rx_ops(struct wlan_cm_roam_rx_ops *rx_ops)
 	rx_ops->roam_event_rx = cm_roam_event_handler;
 	rx_ops->btm_blacklist_event = cm_btm_blacklist_event_handler;
 	rx_ops->vdev_disconnect_event = cm_vdev_disconnect_event_handler;
+	rx_ops->roam_scan_chan_list_event = cm_roam_scan_ch_list_event_handler;
 #endif
 }
 
@@ -297,6 +298,49 @@ err:
 	return status;
 }
 
+int
+target_if_cm_roam_scan_chan_list_event_handler(ol_scn_t scn, uint8_t *event,
+					       uint32_t len)
+{
+	QDF_STATUS qdf_status;
+	int status = 0;
+	struct wmi_unified *wmi_handle;
+	struct wlan_objmgr_psoc *psoc;
+	struct wlan_cm_roam_rx_ops *roam_rx_ops;
+	struct cm_roam_scan_ch_resp *data = NULL;
+
+	psoc = target_if_get_psoc_from_scn_hdl(scn);
+	if (!psoc) {
+		target_if_err("psoc is null");
+		return -EINVAL;
+	}
+
+	wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
+	if (!wmi_handle) {
+		target_if_err("wmi_handle is null");
+		return -EINVAL;
+	}
+
+	qdf_status = wmi_extract_roam_scan_chan_list(wmi_handle, event, len,
+						     &data);
+	if (QDF_IS_STATUS_ERROR(qdf_status)) {
+		target_if_err("parsing of event failed, %d", qdf_status);
+		return -EINVAL;
+	}
+
+	roam_rx_ops = target_if_cm_get_roam_rx_ops(psoc);
+	if (!roam_rx_ops || !roam_rx_ops->roam_scan_chan_list_event) {
+		target_if_err("No valid roam rx ops");
+		qdf_mem_free(data);
+		return -EINVAL;
+	}
+	qdf_status = roam_rx_ops->roam_scan_chan_list_event(data);
+	if (QDF_IS_STATUS_ERROR(qdf_status))
+		status = -EINVAL;
+
+	return status;
+}
+
 QDF_STATUS
 target_if_roam_offload_register_events(struct wlan_objmgr_psoc *psoc)
 {
@@ -355,6 +399,16 @@ target_if_roam_offload_register_events(struct wlan_objmgr_psoc *psoc)
 		return QDF_STATUS_E_FAILURE;
 	}
 
+	ret = wmi_unified_register_event_handler(handle,
+				wmi_roam_scan_chan_list_id,
+				target_if_cm_roam_scan_chan_list_event_handler,
+				WMI_RX_SERIALIZER_CTX);
+	if (QDF_IS_STATUS_ERROR(ret)) {
+		target_if_err("wmi event(%u) registration failed, ret: %d",
+			      wmi_roam_scan_chan_list_id, ret);
+		return QDF_STATUS_E_FAILURE;
+	}
+
 	return QDF_STATUS_SUCCESS;
 }
 

+ 24 - 0
components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_api.h

@@ -926,6 +926,15 @@ void cm_invalid_roam_reason_handler(uint32_t vdev_id, enum cm_roam_notif notif);
 void
 cm_handle_roam_reason_ho_failed(uint8_t vdev_id, struct qdf_mac_addr bssid,
 				struct cm_hw_mode_trans_ind *hw_mode_trans_ind);
+
+/**
+ * cm_handle_scan_ch_list_data() - Roam scan ch evt wrapper for wma
+ * @data: roam scan channel event data
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+cm_handle_scan_ch_list_data(struct cm_roam_scan_ch_resp *data);
 #endif
 #else
 static inline
@@ -1047,6 +1056,12 @@ static inline void
 cm_handle_roam_reason_ho_failed(uint8_t vdev_id, struct qdf_mac_addr bssid,
 				struct cm_hw_mode_trans_ind *hw_mode_trans_ind)
 {}
+
+static inline QDF_STATUS
+cm_handle_scan_ch_list_data(struct cm_roam_scan_ch_resp *data)
+{
+	return QDF_STATUS_E_NOSUPPORT;
+}
 #endif
 #endif  /* FEATURE_ROAM_OFFLOAD */
 
@@ -1157,5 +1172,14 @@ cm_vdev_disconnect_event_handler(struct vdev_disconnect_event_data *data);
  */
 QDF_STATUS
 cm_handle_disconnect_reason(struct vdev_disconnect_event_data *data);
+
+/**
+ * cm_roam_scan_ch_list_event_handler() - Roam scan ch evt handler for target_if
+ * @data: roam scan channel event data
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+cm_roam_scan_ch_list_event_handler(struct cm_roam_scan_ch_resp *data);
 #endif
 #endif  /* WLAN_CM_ROAM_API_H__ */

+ 18 - 0
components/umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_roam_public_struct.h

@@ -164,6 +164,7 @@
 #define DEAUTH_MIN_RSSI 0
 #define BMISS_MIN_RSSI  1
 #define MIN_RSSI_2G_TO_5G_ROAM 2
+#define CM_CFG_VALID_CHANNEL_LIST_LEN 100
 
 /**
  * struct cm_roam_neighbor_report_offload_params - neighbor report offload
@@ -1831,6 +1832,20 @@ struct vdev_disconnect_event_data {
 	uint8_t vdev_id;
 	enum cm_vdev_disconnect_reason reason;
 };
+
+/**
+ * struct roam_scan_ch_resp - roam scan chan list response to userspace
+ * @vdev_id: vdev id
+ * @num_channels: number of roam scan channels
+ * @command_resp: command response or async event
+ * @chan_list: list of roam scan channels
+ */
+struct cm_roam_scan_ch_resp {
+	uint16_t vdev_id;
+	uint16_t num_channels;
+	uint32_t command_resp;
+	uint32_t *chan_list;
+};
 #endif
 
 /**
@@ -1906,6 +1921,7 @@ struct wlan_cm_roam_tx_ops {
  * @roam_event_rx: Rx ops function pointer for roam info event
  * @btm_blacklist_event: Rx ops function pointer for btm blacklist event
  * @vdev_disconnect_event: Rx ops function pointer for vdev disconnect event
+ * @roam_scan_chan_list_event: Rx ops function pointer for roam scan ch event
  */
 struct wlan_cm_roam_rx_ops {
 	QDF_STATUS (*roam_sync_event)(struct wlan_objmgr_psoc *psoc,
@@ -1920,6 +1936,8 @@ struct wlan_cm_roam_rx_ops {
 					  struct roam_blacklist_event *list);
 	QDF_STATUS
 	(*vdev_disconnect_event)(struct vdev_disconnect_event_data *data);
+	QDF_STATUS
+	(*roam_scan_chan_list_event)(struct cm_roam_scan_ch_resp *data);
 #endif
 };
 

+ 6 - 0
components/umac/mlme/connection_mgr/dispatcher/src/wlan_cm_roam_api.c

@@ -2139,4 +2139,10 @@ cm_btm_blacklist_event_handler(struct wlan_objmgr_psoc *psoc,
 
 	return QDF_STATUS_SUCCESS;
 }
+
+QDF_STATUS
+cm_roam_scan_ch_list_event_handler(struct cm_roam_scan_ch_resp *data)
+{
+	return cm_handle_scan_ch_list_data(data);
+}
 #endif

+ 14 - 0
components/wmi/inc/wmi_unified_roam_api.h

@@ -306,6 +306,20 @@ QDF_STATUS
 wmi_extract_vdev_disconnect_event(wmi_unified_t wmi_handle,
 				  uint8_t *event, uint32_t data_len,
 				  struct vdev_disconnect_event_data *data);
+
+/**
+ * wmi_extract_roam_scan_chan_list - Extract roam scan chan list
+ * @wmi_handle: WMI handle
+ * @event: Event data received from firmware
+ * @data_len: Event data length received from firmware
+ * @data: Extract the event and fill in data
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wmi_extract_roam_scan_chan_list(wmi_unified_t wmi_handle,
+				uint8_t *event, uint32_t data_len,
+				struct cm_roam_scan_ch_resp **data);
 #endif /* ROAM_TARGET_IF_CONVERGENCE */
 #endif /* WLAN_FEATURE_ROAM_OFFLOAD */
 

+ 11 - 0
components/wmi/src/wmi_unified_roam_api.c

@@ -402,5 +402,16 @@ wmi_extract_vdev_disconnect_event(wmi_unified_t wmi_handle,
 				wmi_handle, event, data_len, data);
 	return QDF_STATUS_E_FAILURE;
 }
+
+QDF_STATUS
+wmi_extract_roam_scan_chan_list(wmi_unified_t wmi_handle,
+				uint8_t *event, uint32_t data_len,
+				struct cm_roam_scan_ch_resp **data)
+{
+	if (wmi_handle->ops->extract_roam_scan_chan_list)
+		return wmi_handle->ops->extract_roam_scan_chan_list(
+				wmi_handle, event, data_len, data);
+	return QDF_STATUS_E_FAILURE;
+}
 #endif /* ROAM_TARGET_IF_CONVERGENCE */
 #endif

+ 48 - 0
components/wmi/src/wmi_unified_roam_tlv.c

@@ -2204,6 +2204,53 @@ extract_vdev_disconnect_event_tlv(wmi_unified_t wmi_handle,
 
 	return QDF_STATUS_SUCCESS;
 }
+
+static QDF_STATUS
+extract_roam_scan_chan_list_tlv(wmi_unified_t wmi_handle,
+				uint8_t *event, uint32_t data_len,
+				struct cm_roam_scan_ch_resp **list)
+{
+	WMI_ROAM_SCAN_CHANNEL_LIST_EVENTID_param_tlvs *param_buf;
+	wmi_roam_scan_channel_list_event_fixed_param *fixed_param;
+	struct cm_roam_scan_ch_resp *data;
+	uint8_t i = 0, num_ch = 0;
+
+	param_buf = (WMI_ROAM_SCAN_CHANNEL_LIST_EVENTID_param_tlvs *)event;
+	if (!param_buf) {
+		wmi_err_rl("NULL event received from target");
+		return -EINVAL;
+	}
+
+	fixed_param = param_buf->fixed_param;
+	if (!fixed_param) {
+		wmi_err_rl(" NULL fixed param");
+		return -EINVAL;
+	}
+
+	if (fixed_param->vdev_id >= WLAN_MAX_VDEVS) {
+		wmi_err_rl("Invalid vdev_id %d", fixed_param->vdev_id);
+		return -EINVAL;
+	}
+
+	num_ch = (param_buf->num_channel_list < CM_CFG_VALID_CHANNEL_LIST_LEN) ?
+		param_buf->num_channel_list : CM_CFG_VALID_CHANNEL_LIST_LEN;
+
+	data = qdf_mem_malloc(sizeof(struct cm_roam_scan_ch_resp) +
+		num_ch * sizeof(param_buf->channel_list[0]));
+	if (!data)
+		return -EINVAL;
+
+	data->chan_list = (uint32_t *)(data + 1);
+	data->vdev_id = fixed_param->vdev_id;
+	data->command_resp = fixed_param->command_response;
+	data->num_channels = param_buf->num_channel_list;
+
+	for (i = 0; i < num_ch; i++)
+		data->chan_list[i] = param_buf->channel_list[i];
+
+	*list = data;
+	return QDF_STATUS_SUCCESS;
+}
 #endif
 
 void wmi_roam_offload_attach_tlv(wmi_unified_t wmi_handle)
@@ -2220,6 +2267,7 @@ void wmi_roam_offload_attach_tlv(wmi_unified_t wmi_handle)
 	ops->extract_roam_event = extract_roam_event_tlv;
 	ops->extract_btm_bl_event = extract_btm_blacklist_event;
 	ops->extract_vdev_disconnect_event = extract_vdev_disconnect_event_tlv;
+	ops->extract_roam_scan_chan_list = extract_roam_scan_chan_list_tlv;
 #endif /* ROAM_TARGET_IF_CONVERGENCE */
 	ops->send_set_ric_req_cmd = send_set_ric_req_cmd_tlv;
 	ops->send_process_roam_synch_complete_cmd =

+ 5 - 5
core/wma/src/wma_main.c

@@ -3358,6 +3358,11 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
 					wmi_vdev_disconnect_event_id,
 					wma_roam_vdev_disconnect_event_handler,
 					WMA_RX_SERIALIZER_CTX);
+
+	wmi_unified_register_event_handler(wma_handle->wmi_handle,
+					wmi_roam_scan_chan_list_id,
+					wma_roam_scan_chan_list_event_handler,
+					WMA_RX_SERIALIZER_CTX);
 #endif /* ROAM_TARGET_IF_CONVERGENCE */
 	wmi_unified_register_event_handler(wma_handle->wmi_handle,
 					   wmi_roam_auth_offload_event_id,
@@ -3369,11 +3374,6 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc,
 					   wma_roam_stats_event_handler,
 					   WMA_RX_SERIALIZER_CTX);
 
-	wmi_unified_register_event_handler(wma_handle->wmi_handle,
-					   wmi_roam_scan_chan_list_id,
-					   wma_roam_scan_chan_list_event_handler,
-					   WMA_RX_SERIALIZER_CTX);
-
 	wma_register_pmkid_req_event_handler(wma_handle);
 
 #endif /* WLAN_FEATURE_ROAM_OFFLOAD */

+ 22 - 1
core/wma/src/wma_scan_roam.c

@@ -292,6 +292,25 @@ cm_handle_disconnect_reason(struct vdev_disconnect_event_data *data)
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+cm_handle_scan_ch_list_data(struct cm_roam_scan_ch_resp *data)
+{
+	struct scheduler_msg sme_msg = {0};
+
+	sme_msg.type = eWNI_SME_GET_ROAM_SCAN_CH_LIST_EVENT;
+	sme_msg.bodyptr = data;
+
+	if (scheduler_post_message(QDF_MODULE_ID_WMA,
+				   QDF_MODULE_ID_SME,
+				   QDF_MODULE_ID_SME, &sme_msg)) {
+		wma_err("Failed to post msg to SME");
+		qdf_mem_free(sme_msg.bodyptr);
+		return -EINVAL;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
 #else
 
 int wma_roam_vdev_disconnect_event_handler(void *handle, uint8_t *event,
@@ -1453,6 +1472,8 @@ int wma_roam_auth_offload_event_handler(WMA_HANDLE handle, uint8_t *event,
 	return 0;
 }
 
+#ifdef WLAN_FEATURE_ROAM_OFFLOAD
+#ifndef ROAM_TARGET_IF_CONVERGENCE
 int wma_roam_scan_chan_list_event_handler(WMA_HANDLE handle,
 					  uint8_t *event,
 					  uint32_t len)
@@ -1513,8 +1534,8 @@ int wma_roam_scan_chan_list_event_handler(WMA_HANDLE handle,
 
 	return 0;
 }
+#endif
 
-#ifdef WLAN_FEATURE_ROAM_OFFLOAD
 /**
  * wma_get_trigger_detail_str  - Return roam trigger string from the
  * enum WMI_ROAM_TRIGGER_REASON