Ver código fonte

qcacmn: Add support to get roam scan channel list from fw

Firmware advertises WMI_SERVICE_ROAM_SCAN_CHANNEL_LIST_TO_HOST_SUPPORT
at the time of initialization, that means host can querry for roam scan
channels list to firmware.

Host driver sends WMI_ROAM_GET_SCAN_CHANNEL_LIST_CMDID to firmware to
querry roam scan channels list and firmware responds with an event
WMI_ROAM_SCAN_CHANNEL_LIST_EVENTID.

Change-Id: I419a0206d7b06b6186d0c333c951bca5206f342f
CRs-Fixed: 2620607
Abhishek Ambure 5 anos atrás
pai
commit
122adb67b3

+ 2 - 0
wmi/inc/wmi_unified_param.h

@@ -4598,6 +4598,7 @@ typedef enum {
 	wmi_wlan_time_sync_ftm_start_stop_event_id,
 	wmi_wlan_time_sync_q_master_slave_offset_eventid,
 #endif
+	wmi_roam_scan_chan_list_id,
 	wmi_events_max,
 } wmi_conv_event_id;
 
@@ -5106,6 +5107,7 @@ typedef enum {
 	wmi_service_peer_delete_no_peer_flush_tids_cmd,
 	wmi_service_time_sync_ftm,
 	wmi_service_nss_ratio_to_host_support,
+	wmi_roam_scan_chan_list_to_host_support,
 	wmi_services_max,
 } wmi_conv_service_ids;
 #define WMI_SERVICE_UNAVAILABLE 0xFFFF

+ 2 - 1
wmi/inc/wmi_unified_priv.h

@@ -2232,7 +2232,8 @@ QDF_STATUS (*extract_time_sync_ftm_offset_event)(
 					wmi_unified_t wmi_hdl, void *evt_buf,
 					struct ftm_time_sync_offset *param);
 #endif /* FEATURE_WLAN_TIME_SYNC_FTM */
-
+QDF_STATUS (*send_roam_scan_ch_list_req_cmd)(wmi_unified_t wmi_hdl,
+					     uint32_t vdev_id);
 };
 
 /* Forward declartion for psoc*/

+ 13 - 1
wmi/inc/wmi_unified_roam_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -379,6 +379,18 @@ QDF_STATUS wmi_unified_invoke_neighbor_report_cmd(
 			wmi_unified_t wmi_handle,
 			struct wmi_invoke_neighbor_report_params *params);
 
+/**
+ * wmi_unified_get_roam_scan_ch_list() - send roam scan channel list get cmd
+ * @wmi_handle: wmi handle
+ * @vdev_id: vdev id
+ *
+ * This function sends roam scan channel list get command to firmware.
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_get_roam_scan_ch_list(wmi_unified_t wmi_handle,
+					     uint8_t vdev_id);
+
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 /**
  * wmi_unified_set_roam_triggers() - send roam trigger bitmap

+ 11 - 1
wmi/src/wmi_unified_roam_api.c

@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 2013-2019 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2020 The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for
  * any purpose with or without fee is hereby granted, provided that the
@@ -317,6 +317,16 @@ QDF_STATUS wmi_unified_invoke_neighbor_report_cmd(
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS wmi_unified_get_roam_scan_ch_list(wmi_unified_t wmi_handle,
+					     uint8_t vdev_id)
+{
+	if (wmi_handle->ops->send_roam_scan_ch_list_req_cmd)
+		return wmi_handle->ops->send_roam_scan_ch_list_req_cmd(
+				wmi_handle, vdev_id);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
 QDF_STATUS wmi_unified_set_roam_triggers(wmi_unified_t wmi_handle,
 					 struct roam_triggers *triggers)

+ 45 - 0
wmi/src/wmi_unified_tlv.c

@@ -11841,6 +11841,46 @@ send_roam_scan_stats_cmd_tlv(wmi_unified_t wmi_handle,
 	return QDF_STATUS_SUCCESS;
 }
 
+/**
+ * send_roam_scan_ch_list_req_cmd_tlv() - send wmi cmd to get roam scan
+ * channel list from firmware
+ * @wmi_handle: wmi handler
+ * @vdev_id: vdev id
+ *
+ * Return: QDF_STATUS
+ */
+static QDF_STATUS send_roam_scan_ch_list_req_cmd_tlv(wmi_unified_t wmi_handle,
+						     uint32_t vdev_id)
+{
+	wmi_buf_t buf;
+	wmi_roam_get_scan_channel_list_cmd_fixed_param *cmd;
+	uint16_t len = sizeof(*cmd);
+	int ret;
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf) {
+		WMI_LOGE("%s: Failed to allocate wmi buffer", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	cmd = (wmi_roam_get_scan_channel_list_cmd_fixed_param *)
+					wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+	WMITLV_TAG_STRUC_wmi_roam_get_scan_channel_list_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+		wmi_roam_get_scan_channel_list_cmd_fixed_param));
+	cmd->vdev_id = vdev_id;
+	wmi_mtrace(WMI_ROAM_GET_SCAN_CHANNEL_LIST_CMDID, vdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
+				   WMI_ROAM_GET_SCAN_CHANNEL_LIST_CMDID);
+	if (QDF_IS_STATUS_ERROR(ret)) {
+		WMI_LOGE("Failed to send get roam scan channels request = %d",
+			 ret);
+		wmi_buf_free(buf);
+	}
+	return ret;
+}
+
 /**
  * extract_roam_scan_stats_res_evt_tlv() - Extract roam scan stats event
  * @wmi_handle: wmi handle
@@ -13471,6 +13511,7 @@ struct wmi_ops tlv_ops =  {
 	.extract_time_sync_ftm_offset_event =
 					extract_time_sync_ftm_offset_event_tlv,
 #endif /* FEATURE_WLAN_TIME_SYNC_FTM */
+	.send_roam_scan_ch_list_req_cmd = send_roam_scan_ch_list_req_cmd_tlv,
 };
 
 /**
@@ -13835,6 +13876,8 @@ static void populate_tlv_events_id(uint32_t *event_ids)
 	event_ids[wmi_wlan_time_sync_q_master_slave_offset_eventid] =
 			WMI_VDEV_AUDIO_SYNC_Q_MASTER_SLAVE_OFFSET_EVENTID;
 #endif
+event_ids[wmi_roam_scan_chan_list_id] =
+			WMI_ROAM_SCAN_CHANNEL_LIST_EVENTID;
 }
 
 /**
@@ -14124,6 +14167,8 @@ static void populate_tlv_service(uint32_t *wmi_service)
 			WMI_SERVICE_AUDIO_SYNC_SUPPORT;
 	wmi_service[wmi_service_nss_ratio_to_host_support] =
 			WMI_SERVICE_NSS_RATIO_TO_HOST_SUPPORT;
+	wmi_service[wmi_roam_scan_chan_list_to_host_support] =
+			WMI_SERVICE_ROAM_SCAN_CHANNEL_LIST_TO_HOST_SUPPORT;
 }
 
 /**