Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ea665648 authored by Srinivas Girigowda's avatar Srinivas Girigowda
Browse files

qcacmn: Move ctrl_path_twt_stats functions to appropriate files

Move ctrl_path_twt_stats related functions to appropriate source
and header files.

CRs-Fixed:  2871393
Change-Id: I7043259c102e5aee6cbb13260ce2bb0c53c17853
parent 192d08ac
Loading
Loading
Loading
Loading
+0 −17
Original line number Diff line number Diff line
@@ -4218,23 +4218,6 @@ wmi_unified_send_injector_frame_config_cmd(wmi_unified_t wmi_handle,
QDF_STATUS wmi_unified_send_cp_stats_cmd(wmi_unified_t wmi_handle,
					 void *buf_ptr, uint32_t buf_len);

#ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
/**
 * wmi_unified_extract_infra_cp_stats() - extract various infra cp statistics
 * @wmi_handle: wmi handle
 * @evt_buf: event buffer
 * @evt_buf_len: length of event buffer
 * @params: pointer to store the extracted event info
 *
 * This function extracts the infra cp statistics from the event
 *
 * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
 */
QDF_STATUS
wmi_unified_extract_infra_cp_stats(wmi_unified_t wmi_handle,
				   void *evt_buf, uint32_t evt_buf_len,
				   struct infra_cp_stats_event *params);
#endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */

/**
 * wmi_unified_extract_cp_stats_more_pending() - extract more flag
+24 −0
Original line number Diff line number Diff line
@@ -38,6 +38,30 @@ QDF_STATUS
wmi_unified_infra_cp_stats_request_send(
				wmi_unified_t wmi_handle,
				struct infra_cp_stats_cmd_info *param);

/**
 * wmi_unified_extract_infra_cp_stats() - extract various infra cp statistics
 * @wmi_handle: wmi handle
 * @evt_buf: event buffer
 * @evt_buf_len: length of event buffer
 * @params: pointer to store the extracted event info
 *
 * This function extracts the infra cp statistics from the event
 *
 * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
 */
QDF_STATUS
wmi_unified_extract_infra_cp_stats(wmi_unified_t wmi_handle,
				   void *evt_buf, uint32_t evt_buf_len,
				   struct infra_cp_stats_event *params);

QDF_STATUS wmi_stats_handler(void *buff, int32_t len,
			     struct infra_cp_stats_event *params);

QDF_STATUS
extract_infra_cp_stats_tlv(wmi_unified_t wmi_handle, void *evt_buf,
			   uint32_t evt_buf_len,
			   struct infra_cp_stats_event *params);
#endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */

/**
+0 −16
Original line number Diff line number Diff line
@@ -3326,22 +3326,6 @@ QDF_STATUS wmi_unified_send_cp_stats_cmd(wmi_unified_t wmi_handle,
	return QDF_STATUS_E_FAILURE;
}

#ifdef WLAN_SUPPORT_INFRA_CTRL_PATH_STATS
QDF_STATUS
wmi_unified_extract_infra_cp_stats(wmi_unified_t wmi_handle,
				   void *evt_buf, uint32_t evt_buf_len,
				   struct infra_cp_stats_event *params)
{
	if (wmi_handle->ops->extract_infra_cp_stats)
		return wmi_handle->ops->extract_infra_cp_stats(wmi_handle,
								   evt_buf,
								   evt_buf_len,
								   params);

	return QDF_STATUS_E_FAILURE;
}
#endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */

QDF_STATUS
wmi_unified_extract_cp_stats_more_pending(wmi_unified_t wmi_handle,
					  void *evt_buf, uint32_t *more_flag)
+15 −0
Original line number Diff line number Diff line
@@ -33,6 +33,21 @@ wmi_unified_infra_cp_stats_request_send(wmi_unified_t wmi_handle,

	return QDF_STATUS_E_FAILURE;
}

QDF_STATUS
wmi_unified_extract_infra_cp_stats(wmi_unified_t wmi_handle,
				   void *evt_buf, uint32_t evt_buf_len,
				   struct infra_cp_stats_event *params)
{
	if (wmi_handle->ops->extract_infra_cp_stats)
		return wmi_handle->ops->extract_infra_cp_stats(wmi_handle,
								   evt_buf,
								   evt_buf_len,
								   params);

	return QDF_STATUS_E_FAILURE;
}

#endif /* WLAN_SUPPORT_INFRA_CTRL_PATH_STATS */

QDF_STATUS wmi_unified_stats_request_send(wmi_unified_t wmi_handle,
+176 −1
Original line number Diff line number Diff line
@@ -28,13 +28,188 @@ get_stats_req_twt_dialog_id(struct infra_cp_stats_cmd_info *req)
{
	return req->dialog_id;
}

static inline
void wmi_extract_ctrl_path_twt_stats_tlv(void *tag_buf,
					 struct twt_infra_cp_stats_event *param)
{
	wmi_ctrl_path_twt_stats_struct *wmi_stats_buf =
			(wmi_ctrl_path_twt_stats_struct *)tag_buf;

	param->dialog_id = wmi_stats_buf->dialog_id;
	param->status = wmi_stats_buf->status;
	param->num_sp_cycles = wmi_stats_buf->num_sp_cycles;
	param->avg_sp_dur_us = wmi_stats_buf->avg_sp_dur_us;
	param->min_sp_dur_us = wmi_stats_buf->min_sp_dur_us;
	param->max_sp_dur_us = wmi_stats_buf->max_sp_dur_us;
	param->tx_mpdu_per_sp = wmi_stats_buf->tx_mpdu_per_sp;
	param->rx_mpdu_per_sp = wmi_stats_buf->rx_mpdu_per_sp;
	param->tx_bytes_per_sp = wmi_stats_buf->tx_bytes_per_sp;
	param->rx_bytes_per_sp = wmi_stats_buf->rx_bytes_per_sp;

	wmi_debug("dialog_id = %u status = %u", wmi_stats_buf->dialog_id,
		  wmi_stats_buf->status);
	wmi_debug("num_sp_cycles = %u avg_sp_dur_us = 0x%x, \
		  min_sp_dur_us = 0x%x, max_sp_dur_us = 0x%x",
		  wmi_stats_buf->num_sp_cycles, wmi_stats_buf->avg_sp_dur_us,
		  wmi_stats_buf->min_sp_dur_us, wmi_stats_buf->max_sp_dur_us);
	wmi_debug("tx_mpdu_per_sp 0x%x, rx_mpdu_per_sp = 0x%x, \
		  tx_bytes_per_sp = 0x%x, rx_bytes_per_sp = 0x%x",
		  wmi_stats_buf->tx_mpdu_per_sp, wmi_stats_buf->rx_mpdu_per_sp,
		  wmi_stats_buf->tx_bytes_per_sp,
		  wmi_stats_buf->rx_bytes_per_sp);
}

static void wmi_twt_extract_stats_struct(void *tag_buf,
					 struct infra_cp_stats_event *params)
{
	struct twt_infra_cp_stats_event *twt_params;

	twt_params = params->twt_infra_cp_stats +
		     params->num_twt_infra_cp_stats;

	wmi_debug("TWT stats struct found - num_twt_cp_stats %d",
		  params->num_twt_infra_cp_stats);

	params->num_twt_infra_cp_stats++;
	wmi_extract_ctrl_path_twt_stats_tlv(tag_buf, twt_params);
}
#else
static inline
uint32_t get_stats_req_twt_dialog_id(struct infra_cp_stats_cmd_info *req)
{
	return 0;
}
#endif

static void wmi_twt_extract_stats_struct(void *tag_buf,
					 struct infra_cp_stats_event *params)
{
}
#endif /* WLAN_SUPPORT_TWT */

/*
 * wmi_stats_extract_tag_struct: function to extract tag structs
 * @tag_type: tag type that is to be printed
 * @tag_buf: pointer to the tag structure
 * @params: buffer to hold parameters extracted from response event
 *
 * Return: None
 */
static void wmi_stats_extract_tag_struct(uint32_t tag_type, void *tag_buf,
					 struct infra_cp_stats_event *params)
{
	wmi_debug("tag_type %d", tag_type);

	switch (tag_type) {
	case WMITLV_TAG_STRUC_wmi_ctrl_path_pdev_stats_struct:
		break;

	case WMITLV_TAG_STRUC_wmi_ctrl_path_mem_stats_struct:
		break;

	case WMITLV_TAG_STRUC_wmi_ctrl_path_twt_stats_struct:
		wmi_twt_extract_stats_struct(tag_buf, params);
		break;

	default:
		break;
	}
}

/*
 * wmi_stats_handler: parse the wmi event and fill the stats values
 * @buff: Buffer containing wmi event
 * @len: length of event buffer
 * @params: buffer to hold parameters extracted from response event
 *
 * Return: QDF_STATUS_SUCCESS on success, else other qdf error values
 */
QDF_STATUS wmi_stats_handler(void *buff, int32_t len,
			     struct infra_cp_stats_event *params)
{
	WMI_CTRL_PATH_STATS_EVENTID_param_tlvs *param_buf;
	wmi_ctrl_path_stats_event_fixed_param *ev;
	uint8_t *buf_ptr = (uint8_t *)buff;
	uint32_t curr_tlv_tag;
	uint32_t curr_tlv_len;
	uint8_t *tag_start_ptr;

	param_buf = (WMI_CTRL_PATH_STATS_EVENTID_param_tlvs *)buff;
	if (!param_buf)
		return QDF_STATUS_E_FAILURE;
	ev = (wmi_ctrl_path_stats_event_fixed_param *)param_buf->fixed_param;

	curr_tlv_tag = WMITLV_GET_TLVTAG(ev->tlv_header);
	curr_tlv_len = WMITLV_GET_TLVLEN(ev->tlv_header);
	buf_ptr = (uint8_t *)param_buf->fixed_param;
	wmi_debug("Fixed param more %d req_id %d status %d", ev->more,
		  ev->request_id, ev->status);
	params->request_id = ev->request_id;
	params->status = ev->status;

	/* buffer should point to next TLV in event */
	buf_ptr += (curr_tlv_len + WMI_TLV_HDR_SIZE);
	len -= (curr_tlv_len + WMI_TLV_HDR_SIZE);

	curr_tlv_tag = WMITLV_GET_TLVTAG(WMITLV_GET_HDR(buf_ptr));
	curr_tlv_len = WMITLV_GET_TLVLEN(WMITLV_GET_HDR(buf_ptr));

	wmi_debug("curr_tlv_len %d curr_tlv_tag %d rem_len %d", len,
		  curr_tlv_len, curr_tlv_tag);

	while ((len >= curr_tlv_len) &&
	       (curr_tlv_tag >= WMITLV_TAG_FIRST_ARRAY_ENUM)) {
		if (curr_tlv_tag == WMITLV_TAG_ARRAY_STRUC) {
			/* Move to next WMITLV_TAG_ARRAY_STRUC */
			buf_ptr += WMI_TLV_HDR_SIZE;
			len -= WMI_TLV_HDR_SIZE;
			if (len <= 0)
				break;
		}
		curr_tlv_tag = WMITLV_GET_TLVTAG(WMITLV_GET_HDR(buf_ptr));
		curr_tlv_len = WMITLV_GET_TLVLEN(WMITLV_GET_HDR(buf_ptr));

		wmi_debug("curr_tlv_len %d curr_tlv_tag %d rem_len %d",
			  len, curr_tlv_len, curr_tlv_tag);
		if (curr_tlv_len) {
			/* point to the tag inside WMITLV_TAG_ARRAY_STRUC */
			tag_start_ptr = buf_ptr + WMI_TLV_HDR_SIZE;
			curr_tlv_tag = WMITLV_GET_TLVTAG(
						WMITLV_GET_HDR(tag_start_ptr));
			wmi_stats_extract_tag_struct(curr_tlv_tag,
						     (void *)tag_start_ptr,
						     params);
		}
		/* Move to next tag */
		buf_ptr += curr_tlv_len + WMI_TLV_HDR_SIZE;
		len -= (curr_tlv_len + WMI_TLV_HDR_SIZE);

		if (len <= 0)
			break;
	}

	return QDF_STATUS_SUCCESS;
}

/**
 * extract_infra_cp_stats_tlv - api to extract stats information from
 * event buffer
 * @wmi_handle:  wmi handle
 * @evt_buf:     event buffer
 * @evt_buf_len: length of the event buffer
 * @params:      buffer to populate more flag
 *
 * Return: QDF_STATUS_SUCCESS on success, else other qdf error values
 */
QDF_STATUS
extract_infra_cp_stats_tlv(wmi_unified_t wmi_handle, void *evt_buf,
			   uint32_t evt_buf_len,
			   struct infra_cp_stats_event *params)
{
	wmi_stats_handler(evt_buf, evt_buf_len, params);
	return QDF_STATUS_SUCCESS;
}

/**
 * prepare_infra_cp_stats_buf() - Allocate and prepate wmi cmd request buffer
 * @wmi_handle: wmi handle
Loading