Browse Source

qcacmn: Send idle roam trigger monitor command to firmware

Send idle roam trigger monitor command to firmware based on
the SET SUSPEND mode command received from the user space.
The set suspend mode value sent will be used by firmware as
one of the parameters in determining if the device is in
idle state. When set suspend mode is 1, device is not in
idle state else the device is considered idle if idle state
data packet count, idle rssi, inactivity time criteria are met.

Add changes to send the idle trigger monitor value over the
wmi command WMI_IDLE_TRIGGER_MONITOR_CMDID.

Change-Id: I34632814a1e653fa87cfbab90c72ee1622dfd63c
CRs-Fixed: 2436222
Pragaspathi Thilagaraj 6 years ago
parent
commit
9582515724
4 changed files with 63 additions and 1 deletions
  1. 12 0
      wmi/inc/wmi_unified_api.h
  2. 3 0
      wmi/inc/wmi_unified_priv.h
  3. 10 0
      wmi/src/wmi_unified_api.c
  4. 38 1
      wmi/src/wmi_unified_tlv.c

+ 12 - 0
wmi/inc/wmi_unified_api.h

@@ -1808,6 +1808,17 @@ enum cdp_sec_type wlan_crypto_cipher_to_cdp_sec_type(
 QDF_STATUS wmi_unified_send_mws_coex_req_cmd(struct wmi_unified *wmi_handle,
 					     uint32_t vdev_id, uint32_t cmd_id);
 
+/**
+ * wmi_unified_send_idle_trigger_monitor() - send idle trigger monitor command
+ * @wmi_handle: WMI handle
+ * @val: idle trigger monitor value - 1 for idle monitor on, 0 for idle monitor
+ * off
+ *
+ * Return: QDF_STATUS_SUCCESS if success, else returns proper error code.
+ */
+QDF_STATUS
+wmi_unified_send_idle_trigger_monitor(wmi_unified_t wmi_handle, uint8_t val);
+
 #ifdef WLAN_CFR_ENABLE
 /**
  * wmi_unified_send_peer_cfr_capture_cmd() - WMI function to start CFR capture
@@ -1832,5 +1843,6 @@ wmi_unified_send_peer_cfr_capture_cmd(void *wmi_hdl,
 QDF_STATUS
 wmi_extract_cfr_peer_tx_event_param(void *wmi_hdl, void *evt_buf,
 				    wmi_cfr_peer_tx_event_param *peer_tx_event);
+
 #endif /* WLAN_CFR_ENABLE */
 #endif /* _WMI_UNIFIED_API_H_ */

+ 3 - 0
wmi/inc/wmi_unified_priv.h

@@ -418,6 +418,9 @@ QDF_STATUS (*send_modem_power_state_cmd)(wmi_unified_t wmi_handle,
 QDF_STATUS (*send_set_sta_ps_mode_cmd)(wmi_unified_t wmi_handle,
 			       uint32_t vdev_id, uint8_t val);
 
+QDF_STATUS (*send_idle_roam_monitor_cmd)(wmi_unified_t wmi_handle,
+					 uint8_t val);
+
 QDF_STATUS (*send_get_temperature_cmd)(wmi_unified_t wmi_handle);
 
 #ifdef CONVERGED_P2P_ENABLE

+ 10 - 0
wmi/src/wmi_unified_api.c

@@ -952,6 +952,16 @@ QDF_STATUS wmi_unified_set_sta_ps_mode(void *wmi_hdl,
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS
+wmi_unified_send_idle_trigger_monitor(wmi_unified_t wmi_handle, uint8_t val)
+{
+	if (wmi_handle->ops->send_idle_roam_monitor_cmd)
+		return wmi_handle->ops->send_idle_roam_monitor_cmd(wmi_handle,
+								   val);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 /**
  * wmi_set_mimops() - set MIMO powersave
  * @wmi_hdl: wmi handle

+ 38 - 1
wmi/src/wmi_unified_tlv.c

@@ -3167,7 +3167,43 @@ static QDF_STATUS send_set_sta_ps_mode_cmd_tlv(wmi_unified_t wmi_handle,
 		wmi_buf_free(buf);
 		return QDF_STATUS_E_FAILURE;
 	}
-	return 0;
+	return QDF_STATUS_SUCCESS;
+}
+
+/**
+ * send_idle_roam_monitor_cmd_tlv() - send idle monitor command to fw
+ * @wmi_handle: wmi handle
+ * @vdev_id: vdev id
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code.
+ */
+static QDF_STATUS send_idle_roam_monitor_cmd_tlv(wmi_unified_t wmi_handle,
+						 uint8_t val)
+{
+	wmi_idle_trigger_monitor_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+	size_t len = sizeof(*cmd);
+
+	buf = wmi_buf_alloc(wmi_handle, len);
+	if (!buf)
+		return QDF_STATUS_E_NOMEM;
+
+	cmd = (wmi_idle_trigger_monitor_cmd_fixed_param *)wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_idle_trigger_monitor_cmd_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(wmi_idle_trigger_monitor_cmd_fixed_param));
+
+	cmd->idle_trigger_monitor = (val ? WMI_IDLE_TRIGGER_MONITOR_ON :
+					   WMI_IDLE_TRIGGER_MONITOR_OFF);
+
+	WMI_LOGD("val:%d", cmd->idle_trigger_monitor);
+
+	if (wmi_unified_cmd_send(wmi_handle, buf, len,
+				 WMI_IDLE_TRIGGER_MONITOR_CMDID)) {
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+	return QDF_STATUS_SUCCESS;
 }
 
 /**
@@ -11298,6 +11334,7 @@ struct wmi_ops tlv_ops =  {
 	.send_offchan_data_tx_cmd = send_offchan_data_tx_cmd_tlv,
 	.send_modem_power_state_cmd = send_modem_power_state_cmd_tlv,
 	.send_set_sta_ps_mode_cmd = send_set_sta_ps_mode_cmd_tlv,
+	.send_idle_roam_monitor_cmd = send_idle_roam_monitor_cmd_tlv,
 	.send_set_sta_uapsd_auto_trig_cmd =
 		send_set_sta_uapsd_auto_trig_cmd_tlv,
 	.send_get_temperature_cmd = send_get_temperature_cmd_tlv,