Browse Source

qcacmn: Send idle and disconnect roam parameters to firmware

Add support for new wmi command WMI_ROAM_DEAUTH_CONFIG_CMDID to
send disconnect roam trigger parameters and the new wmi command
WMI_ROAM_IDLE_CONFIG_CMDID is used to send the idle roam trigger
parameters.

Update the idle roam and disconnect roam parameters and send them
on the new wmi commands over wmi.

Change-Id: I57acb90266d506d37dcbb58d50ef23fadc439e46
CRs-Fixed: 2431502
Pragaspathi Thilagaraj 6 years ago
parent
commit
5e3cd0af27

+ 7 - 0
wmi/inc/wmi_unified_priv.h

@@ -577,6 +577,13 @@ QDF_STATUS (*send_invoke_neighbor_report_cmd)(wmi_unified_t wmi_handle,
 QDF_STATUS (*send_roam_bss_load_config)(wmi_unified_t wmi_handle,
 					struct wmi_bss_load_config *params);
 
+QDF_STATUS (*send_disconnect_roam_params)(
+			wmi_unified_t wmi_handle,
+			struct wmi_disconnect_roam_params *req);
+
+QDF_STATUS (*send_idle_roam_params)(wmi_unified_t wmi_handle,
+				    struct wmi_idle_roam_params *req);
+
 QDF_STATUS (*send_btm_config)(wmi_unified_t wmi_handle,
 			      struct wmi_btm_config *params);
 

+ 24 - 1
wmi/inc/wmi_unified_roam_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2019 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
@@ -308,6 +308,29 @@ QDF_STATUS wmi_unified_send_btm_config(void *wmi_hdl,
 QDF_STATUS wmi_unified_send_bss_load_config(void *wmi_hdl,
 					    struct wmi_bss_load_config *params);
 
+/**
+ * wmi_unified_send_disconnect_roam_params() - Send disconnect roam trigger
+ * parameters to firmware
+ * @wmi_hdl:  wmi handle
+ * @params: pointer to wmi_disconnect_roam_params
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wmi_unified_send_disconnect_roam_params(wmi_unified_t wmi_handle,
+					struct wmi_disconnect_roam_params *req);
+
+/**
+ * wmi_unified_send_idle_roam_params() - Send idle roam trigger params to fw
+ * @wmi_hdl:  wmi handle
+ * @params: pointer to wmi_idle_roam_params
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS
+wmi_unified_send_idle_roam_params(wmi_unified_t wmi_handle,
+				  struct wmi_idle_roam_params *req);
+
 /**
  * wmi_unified_offload_11k_cmd() - send 11k offload command
  * @wmi_hdl: wmi handle

+ 30 - 0
wmi/inc/wmi_unified_roam_param.h

@@ -548,6 +548,36 @@ struct wmi_bss_load_config {
 	uint32_t bss_load_sample_time;
 };
 
+/**
+ * struct wmi_idle_roam_params - Idle roam trigger parameters
+ * @vdev_id: VDEV on which the parameters should be applied
+ * @enable: Enable/Disable Idle roaming
+ * @band: Connected AP band
+ * @conn_ap_rssi_delta: Rssi change of connected AP in dBm
+ * @conn_ap_min_rssi: If connected AP rssi is less than min rssi trigger roam
+ * @inactive_time: Connected AP idle time
+ * @data_pkt_count: Data packet count allowed during idle time
+ */
+struct wmi_idle_roam_params {
+	uint32_t vdev_id;
+	bool enable;
+	uint32_t band;
+	uint32_t conn_ap_rssi_delta;
+	int32_t conn_ap_min_rssi;
+	uint32_t inactive_time;
+	uint32_t data_pkt_count;
+};
+
+/**
+ * struct wmi_disconnect_roam_params - Emergency deauth/disconnect roam params
+ * @vdev_id: VDEV on which the parameters should be applied
+ * @enable: Enable or disable disconnect roaming.
+ */
+struct wmi_disconnect_roam_params {
+	uint32_t vdev_id;
+	bool enable;
+};
+
 /**
  * @time_offset: time offset after 11k offload command to trigger a neighbor
  *	report request (in seconds)

+ 21 - 1
wmi/src/wmi_unified_roam_api.c

@@ -1,6 +1,6 @@
 
 /*
- * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2013-2019 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
@@ -300,6 +300,26 @@ QDF_STATUS wmi_unified_send_bss_load_config(void *wmi_hdl,
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS
+wmi_unified_send_disconnect_roam_params(wmi_unified_t wmi_handle,
+					struct wmi_disconnect_roam_params *req)
+{
+	if (wmi_handle->ops->send_disconnect_roam_params)
+		return wmi_handle->ops->send_disconnect_roam_params(wmi_handle,
+								    req);
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS
+wmi_unified_send_idle_roam_params(wmi_unified_t wmi_handle,
+				  struct wmi_idle_roam_params *req)
+{
+	if (wmi_handle->ops->send_idle_roam_params)
+		return wmi_handle->ops->send_idle_roam_params(wmi_handle,
+							      req);
+	return QDF_STATUS_E_FAILURE;
+}
+
 QDF_STATUS wmi_unified_offload_11k_cmd(void *wmi_hdl,
 				struct wmi_11k_offload_params *params)
 {

+ 118 - 0
wmi/src/wmi_unified_roam_tlv.c

@@ -2102,6 +2102,122 @@ send_roam_bss_load_config_tlv(wmi_unified_t wmi_handle,
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef WLAN_FEATURE_ROAM_OFFLOAD
+/**
+ * send_disconnect_roam_params_tlv() - send disconnect roam trigger parameters
+ * @wmi_handle: wmi handle
+ * @disconnect_roam: pointer to wmi_disconnect_roam_params which carries the
+ * disconnect_roam_trigger parameters from CSR
+ *
+ * This function sends the disconnect roam trigger parameters to fw.
+ *
+ * Return: QDF status
+ */
+static QDF_STATUS
+send_disconnect_roam_params_tlv(wmi_unified_t wmi_handle,
+				struct wmi_disconnect_roam_params *req)
+{
+	wmi_roam_deauth_config_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	uint32_t len;
+
+	len = sizeof(*cmd);
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf)
+		return QDF_STATUS_E_NOMEM;
+
+	cmd = (wmi_roam_deauth_config_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(
+	    &cmd->tlv_header,
+	    WMITLV_TAG_STRUC_wmi_roam_deauth_config_cmd_fixed_param,
+	    WMITLV_GET_STRUCT_TLVLEN(wmi_roam_deauth_config_cmd_fixed_param));
+
+	cmd->vdev_id = req->vdev_id;
+	cmd->enable = req->enable;
+	WMI_LOGD("%s: Send WMI_ROAM_DEAUTH_CONFIG vdev_id:%d enable:%d",
+		 __func__, cmd->vdev_id, cmd->enable);
+
+	wmi_mtrace(WMI_ROAM_DEAUTH_CONFIG_CMDID, cmd->vdev_id, 0);
+	if (wmi_unified_cmd_send(wmi_handle, buf, len,
+				 WMI_ROAM_DEAUTH_CONFIG_CMDID)) {
+		WMI_LOGE("%s: failed to send WMI_ROAM_DEAUTH_CONFIG_CMDID",
+			 __func__);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * send_idle_roam_params_tlv() - send idle roam trigger parameters
+ * @wmi_handle: wmi handle
+ * @idle_roam_params: pointer to wmi_idle_roam_params which carries the
+ * idle roam parameters from CSR
+ *
+ * This function sends the idle roam trigger parameters to fw.
+ *
+ * Return: QDF status
+ */
+static QDF_STATUS
+send_idle_roam_params_tlv(wmi_unified_t wmi_handle,
+			  struct wmi_idle_roam_params *idle_roam_params)
+{
+	wmi_roam_idle_config_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	uint32_t len;
+
+	len = sizeof(*cmd);
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf)
+		return QDF_STATUS_E_NOMEM;
+
+	cmd = (wmi_roam_idle_config_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(
+	    &cmd->tlv_header,
+	    WMITLV_TAG_STRUC_wmi_roam_idle_config_cmd_fixed_param,
+	    WMITLV_GET_STRUCT_TLVLEN(wmi_roam_idle_config_cmd_fixed_param));
+
+	cmd->vdev_id = idle_roam_params->vdev_id;
+	cmd->enable = idle_roam_params->enable;
+	cmd->band = idle_roam_params->band;
+	cmd->rssi_delta = idle_roam_params->conn_ap_rssi_delta;
+	cmd->min_rssi = idle_roam_params->conn_ap_min_rssi;
+	cmd->idle_time = idle_roam_params->inactive_time;
+	cmd->data_packet_count = idle_roam_params->data_pkt_count;
+	WMI_LOGD("%s: Send WMI_ROAM_IDLE_CONFIG_CMDID vdev_id:%d enable:%d",
+		 __func__, cmd->vdev_id, cmd->enable);
+	WMI_LOGD("%s: band:%d rssi_delta:%d min_rssi:%d idle_time:%d data_pkt:%d",
+		 __func__, cmd->band, cmd->rssi_delta, cmd->min_rssi,
+		 cmd->idle_time, cmd->data_packet_count);
+
+	wmi_mtrace(WMI_ROAM_IDLE_CONFIG_CMDID, cmd->vdev_id, 0);
+	if (wmi_unified_cmd_send(wmi_handle, buf, len,
+				 WMI_ROAM_IDLE_CONFIG_CMDID)) {
+		WMI_LOGE("%s: failed to send WMI_ROAM_IDLE_CONFIG_CMDID",
+			 __func__);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+#else
+static inline QDF_STATUS
+send_disconnect_roam_params_tlv(wmi_unified_t wmi_handle,
+				struct wmi_disconnect_roam_params *req)
+{
+	return QDF_STATUS_E_FAILURE;
+}
+
+static inline QDF_STATUS
+send_idle_roam_params_tlv(wmi_unified_t wmi_handle,
+			  struct wmi_idle_roam_params *idle_roam_params)
+{
+	return QDF_STATUS_E_FAILURE;
+}
+#endif
+
 /**
  * send_offload_11k_cmd_tlv() - send wmi cmd with 11k offload params
  * @wmi_handle: wmi handler
@@ -2271,6 +2387,8 @@ void wmi_roam_attach_tlv(wmi_unified_t wmi_handle)
 	ops->send_invoke_neighbor_report_cmd =
 			send_invoke_neighbor_report_cmd_tlv;
 	ops->send_roam_bss_load_config = send_roam_bss_load_config_tlv;
+	ops->send_idle_roam_params = send_idle_roam_params_tlv;
+	ops->send_disconnect_roam_params = send_disconnect_roam_params_tlv;
 
 	wmi_lfr_subnet_detection_attach_tlv(wmi_handle);
 	wmi_rssi_monitor_attach_tlv(wmi_handle);