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

qcacmn: Send get_station and ll_stats req in a single command

Currently ll_stats and get_station requests are sent back to back
from user space. The firmware time difference between these two commands
results in extra sleep and wakeup for Q6.

To avoid this extra Q6 sleep and wake, send both requests in a single
command from the driver if the firmware supports that operation. Cache
the get_station results in the driver until user space request reach
to the driver.

Change-Id: I5e6f42f9e3836ef4bf61d3d9220f8cedb775cbd5
CRs-Fixed: 2778479
Bapiraju Alla 4 жил өмнө
parent
commit
0ff4421b30

+ 14 - 0
wmi/inc/wmi_unified_api.h

@@ -1445,6 +1445,20 @@ QDF_STATUS wmi_unified_process_ll_stats_set_cmd(wmi_unified_t wmi_handle,
  */
 QDF_STATUS wmi_unified_process_ll_stats_get_cmd(wmi_unified_t wmi_handle,
 				 const struct ll_stats_get_params *get_req);
+
+#ifdef FEATURE_CLUB_LL_STATS_AND_GET_STATION
+/**
+ * wmi_process_unified_ll_stats_get_sta_cmd() - unified link layer stats and
+ *                                              get station request
+ * @wmi_handle: wmi handle
+ * @get_req: unified ll stats and get station request command params
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_process_unified_ll_stats_get_sta_cmd(
+				wmi_unified_t wmi_handle,
+				const struct ll_stats_get_params *get_req);
+#endif /* FEATURE_CLUB_LL_STATS_AND_GET_STATION */
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
 
 /**

+ 3 - 0
wmi/inc/wmi_unified_param.h

@@ -5364,6 +5364,9 @@ typedef enum {
 	wmi_service_thermal_multi_client_support,
 	wmi_service_mbss_param_in_vdev_start_support,
 	wmi_service_fse_cmem_alloc_support,
+#ifdef FEATURE_CLUB_LL_STATS_AND_GET_STATION
+	wmi_service_get_station_in_ll_stats_req,
+#endif
 	wmi_services_max,
 } wmi_conv_service_ids;
 #define WMI_SERVICE_UNAVAILABLE 0xFFFF

+ 4 - 0
wmi/inc/wmi_unified_priv.h

@@ -818,6 +818,10 @@ QDF_STATUS (*send_process_ll_stats_set_cmd)(wmi_unified_t wmi_handle,
 
 QDF_STATUS (*send_process_ll_stats_get_cmd)(wmi_unified_t wmi_handle,
 				const struct ll_stats_get_params *get_req);
+#ifdef FEATURE_CLUB_LL_STATS_AND_GET_STATION
+QDF_STATUS (*send_unified_ll_stats_get_sta_cmd)(wmi_unified_t wmi_handle,
+				const struct ll_stats_get_params *get_req);
+#endif
 #endif
 
 QDF_STATUS (*send_congestion_cmd)(wmi_unified_t wmi_handle,

+ 13 - 0
wmi/src/wmi_unified_api.c

@@ -769,6 +769,19 @@ QDF_STATUS wmi_unified_process_ll_stats_get_cmd(wmi_unified_t wmi_handle,
 
 	return QDF_STATUS_E_FAILURE;
 }
+
+#ifdef FEATURE_CLUB_LL_STATS_AND_GET_STATION
+QDF_STATUS wmi_process_unified_ll_stats_get_sta_cmd(
+				wmi_unified_t wmi_handle,
+				const struct ll_stats_get_params *get_req)
+{
+	if (wmi_handle->ops->send_unified_ll_stats_get_sta_cmd)
+		return wmi_handle->ops->send_unified_ll_stats_get_sta_cmd(
+						wmi_handle, get_req);
+
+	return QDF_STATUS_E_FAILURE;
+}
+#endif
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
 
 QDF_STATUS wmi_unified_congestion_request_cmd(wmi_unified_t wmi_handle,

+ 92 - 1
wmi/src/wmi_unified_tlv.c

@@ -5216,13 +5216,79 @@ static QDF_STATUS send_process_ll_stats_get_cmd_tlv(wmi_unified_t wmi_handle,
 	ret = wmi_unified_cmd_send_pm_chk(wmi_handle, buf, len,
 					  WMI_REQUEST_LINK_STATS_CMDID);
 	if (ret) {
-		wmi_err("Failed to send get link stats request");
 		wmi_buf_free(buf);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	return QDF_STATUS_SUCCESS;
 }
+
+#ifdef FEATURE_CLUB_LL_STATS_AND_GET_STATION
+/**
+ * send_unified_ll_stats_get_sta_cmd_tlv() - unified link layer stats and get
+ *                                           station request
+ * @wmi_handle: wmi handle
+ * @get_req: ll stats get request command params
+ *
+ * Return: QDF_STATUS_SUCCESS for success or error code
+ */
+static QDF_STATUS send_unified_ll_stats_get_sta_cmd_tlv(
+				wmi_unified_t wmi_handle,
+				const struct ll_stats_get_params *get_req)
+{
+	wmi_request_unified_ll_get_sta_cmd_fixed_param *unified_cmd;
+	int32_t len;
+	wmi_buf_t buf;
+	void *buf_ptr;
+	int ret;
+
+	len = sizeof(*unified_cmd);
+	buf = wmi_buf_alloc(wmi_handle, len);
+
+	if (!buf)
+		return QDF_STATUS_E_NOMEM;
+
+	buf_ptr = wmi_buf_data(buf);
+
+	unified_cmd = buf_ptr;
+	WMITLV_SET_HDR(
+		&unified_cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_request_unified_ll_get_sta_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN
+			(wmi_request_unified_ll_get_sta_cmd_fixed_param));
+
+	unified_cmd->link_stats_type = get_req->param_id_mask;
+	unified_cmd->get_sta_stats_id = (WMI_REQUEST_AP_STAT |
+					 WMI_REQUEST_PEER_STAT |
+					 WMI_REQUEST_VDEV_STAT |
+					 WMI_REQUEST_PDEV_STAT |
+					 WMI_REQUEST_PEER_EXTD2_STAT |
+					 WMI_REQUEST_RSSI_PER_CHAIN_STAT);
+	unified_cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
+							wmi_handle,
+							WMI_HOST_PDEV_ID_SOC);
+
+	unified_cmd->vdev_id = get_req->vdev_id;
+	unified_cmd->request_id = get_req->req_id;
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(get_req->peer_macaddr.bytes,
+				   &unified_cmd->peer_macaddr);
+
+	wmi_debug("UNIFIED_LINK_STATS_GET_STA - Get Request Params Request ID: %u Stats Type: %0x Vdev ID: %d Peer MAC Addr: "
+		  QDF_MAC_ADDR_FMT,
+		  get_req->req_id, get_req->param_id_mask, get_req->vdev_id,
+		  QDF_MAC_ADDR_REF(get_req->peer_macaddr.bytes));
+
+	wmi_mtrace(WMI_REQUEST_UNIFIED_LL_GET_STA_CMDID, get_req->vdev_id, 0);
+	ret = wmi_unified_cmd_send_pm_chk(wmi_handle, buf, len,
+					  WMI_REQUEST_UNIFIED_LL_GET_STA_CMDID);
+	if (ret) {
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+#endif
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS */
 
 /**
@@ -13983,6 +14049,10 @@ struct wmi_ops tlv_ops =  {
 	.send_process_ll_stats_clear_cmd = send_process_ll_stats_clear_cmd_tlv,
 	.send_process_ll_stats_set_cmd = send_process_ll_stats_set_cmd_tlv,
 	.send_process_ll_stats_get_cmd = send_process_ll_stats_get_cmd_tlv,
+#ifdef FEATURE_CLUB_LL_STATS_AND_GET_STATION
+	.send_unified_ll_stats_get_sta_cmd =
+					send_unified_ll_stats_get_sta_cmd_tlv,
+#endif /* FEATURE_CLUB_LL_STATS_AND_GET_STATION */
 #endif /* WLAN_FEATURE_LINK_LAYER_STATS*/
 	.send_congestion_cmd = send_congestion_cmd_tlv,
 	.send_snr_request_cmd = send_snr_request_cmd_tlv,
@@ -14659,6 +14729,25 @@ event_ids[wmi_roam_scan_chan_list_id] =
 			WMI_CTRL_PATH_STATS_EVENTID;
 }
 
+#ifdef WLAN_FEATURE_LINK_LAYER_STATS
+#ifdef FEATURE_CLUB_LL_STATS_AND_GET_STATION
+static void wmi_populate_service_get_sta_in_ll_stats_req(uint32_t *wmi_service)
+{
+	wmi_service[wmi_service_get_station_in_ll_stats_req] =
+				WMI_SERVICE_UNIFIED_LL_GET_STA_CMD_SUPPORT;
+}
+
+#else
+static void wmi_populate_service_get_sta_in_ll_stats_req(uint32_t *wmi_service)
+{
+}
+#endif /* FEATURE_CLUB_LL_STATS_AND_GET_STATION */
+#else
+static void wmi_populate_service_get_sta_in_ll_stats_req(uint32_t *wmi_service)
+{
+}
+#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
+
 /**
  * populate_tlv_service() - populates wmi services
  *
@@ -14985,6 +15074,8 @@ static void populate_tlv_service(uint32_t *wmi_service)
 			WMI_SERVICE_MBSS_PARAM_IN_VDEV_START_SUPPORT;
 	wmi_service[wmi_service_fse_cmem_alloc_support] =
 			WMI_SERVICE_FSE_CMEM_ALLOC_SUPPORT;
+
+	wmi_populate_service_get_sta_in_ll_stats_req(wmi_service);
 }
 
 /**