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

qcacmn: Add API to extract rate2power update response WMI event

Add API extract_tgtr2p_table_event_tlv to extract TLVs from the response
event of rate2power table update cmd. Add a wrapper function
wmi_extract_tgtr2p_table_event and call extract_tgtr2p_table_event_tlv
from it.

Add the host event id wmi_pdev_set_tgtr2p_table_eventid corresponding to
the target id WMI_PDEV_SET_TGTR2P_TABLE_EVENTID. Also add this mapping
to populate_tlv_events_id function.

Change-Id: I0a870125120f1f92ee50002953e114b27d597ae6
CRs-Fixed: 3405417
Amith A 2 жил өмнө
parent
commit
6ddd0be86d

+ 2 - 0
wmi/inc/wmi_unified_param.h

@@ -123,6 +123,7 @@
 #define CTL_5G_SIZE 1536
 #define CTL_2G_SIZE 684
 #define MAX_CTL_SIZE (CTL_5G_SIZE > CTL_2G_SIZE ? CTL_5G_SIZE : CTL_2G_SIZE)
+#define MAX_PWTAB_SIZE 3392
 #define IEEE80211_MICBUF_SIZE   (8+8)
 #define IEEE80211_TID_SIZE	17
 #define WME_NUM_AC	4
@@ -5250,6 +5251,7 @@ typedef enum {
 #ifdef WLAN_SUPPORT_GAP_LL_PS_MODE
 	wmi_xgap_enable_complete_eventid,
 #endif
+	wmi_pdev_set_tgtr2p_table_eventid,
 	wmi_events_max,
 } wmi_conv_event_id;
 

+ 10 - 0
wmi/inc/wmi_unified_priv.h

@@ -1405,6 +1405,10 @@ QDF_STATUS
 (*send_set_sta_max_pwr_table_cmd)(wmi_unified_t wmi_handle,
 				  struct sta_max_pwr_table_params *param);
 
+QDF_STATUS
+(*send_set_power_table_cmd)(wmi_unified_t wmi_handle,
+			    struct rate2power_table_params *param);
+
 QDF_STATUS (*send_set_mimogain_table_cmd)(wmi_unified_t wmi_handle,
 		struct mimogain_table_params *param);
 
@@ -3219,6 +3223,12 @@ QDF_STATUS
 (*send_wmi_tdma_schedule_request_cmd)(wmi_unified_t wmi_handle,
 				      struct wlan_tdma_sched_cmd_param *param);
 #endif
+
+QDF_STATUS
+(*extract_tgtr2p_table_event)(wmi_unified_t wmi_handle,
+			      uint8_t *evt_buf,
+			      struct r2p_table_update_status_obj *update_status,
+			      uint32_t len);
 };
 
 /* Forward declaration for psoc*/

+ 15 - 0
wmi/inc/wmi_unified_reg_api.h

@@ -135,4 +135,19 @@ QDF_STATUS wmi_extract_reg_ch_avoid_event(
 		struct ch_avoid_ind_type *ch_avoid_ind,
 		uint32_t len);
 
+/**
+ * wmi_extract_tgtr2p_table_event() - function to read the contents of the
+ * rate2power update response event
+ * @wmi_handle: wmi handle
+ * @evt_buf: event buffer
+ * @update_status: Status object
+ * @len: length of buffer
+ *
+ * Return: QDF_STATUS_SUCCESS on success, QDF_STATUS_E_FAILURE on error
+ */
+QDF_STATUS wmi_extract_tgtr2p_table_event(wmi_unified_t wmi_handle,
+		uint8_t *evt_buf,
+		struct r2p_table_update_status_obj *update_status,
+		uint32_t len);
+
 #endif /* _WMI_UNIFIED_REG_API_H_ */

+ 17 - 1
wmi/src/wmi_unified_reg_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
- *
+ * Copyright (c) 2023 Qualcomm Innovation Center, Inc. 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
@@ -152,3 +152,19 @@ QDF_STATUS wmi_extract_reg_ch_avoid_event(
 	return QDF_STATUS_E_FAILURE;
 }
 qdf_export_symbol(wmi_extract_reg_ch_avoid_event);
+
+QDF_STATUS wmi_extract_tgtr2p_table_event(
+		wmi_unified_t wmi_handle,
+		uint8_t *evt_buf,
+		struct r2p_table_update_status_obj *update_status,
+		uint32_t len)
+{
+	if (wmi_handle &&
+	    wmi_handle->ops->extract_tgtr2p_table_event)
+		return wmi_handle->ops->extract_tgtr2p_table_event(
+				wmi_handle, evt_buf, update_status, len);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+qdf_export_symbol(wmi_extract_tgtr2p_table_event);

+ 31 - 0
wmi/src/wmi_unified_tlv.c

@@ -20402,6 +20402,34 @@ extract_sap_coex_fix_chan_caps(wmi_unified_t wmi_handle,
 	return QDF_STATUS_SUCCESS;
 }
 
+static QDF_STATUS extract_tgtr2p_table_event_tlv(wmi_unified_t wmi_handle,
+		uint8_t *evt_buf,
+		struct r2p_table_update_status_obj *update_status,
+		uint32_t len)
+{
+	WMI_PDEV_SET_TGTR2P_TABLE_EVENTID_param_tlvs *param_buf;
+	wmi_pdev_set_tgtr2p_table_event_fixed_param *event_fixed_hdr;
+
+	param_buf = (WMI_PDEV_SET_TGTR2P_TABLE_EVENTID_param_tlvs *)evt_buf;
+	if (!param_buf) {
+		wmi_err("Invalid TGTR2P event buf");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	event_fixed_hdr = param_buf->fixed_param;
+	update_status->pdev_id = event_fixed_hdr->pdev_id;
+	update_status->status = event_fixed_hdr->status;
+
+	if (update_status->status != WMI_PDEV_TGTR2P_SUCCESS &&
+	    update_status->status !=
+			WMI_PDEV_TGTR2P_SUCCESS_WAITING_FOR_END_OF_UPDATE) {
+		wmi_err("Rate2Power table update failed. Status = %d",
+			update_status->status);
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
 struct wmi_ops tlv_ops =  {
 	.send_vdev_create_cmd = send_vdev_create_cmd_tlv,
 	.send_vdev_delete_cmd = send_vdev_delete_cmd_tlv,
@@ -20886,6 +20914,7 @@ struct wmi_ops tlv_ops =  {
 			send_update_edca_pifs_param_cmd_tlv,
 	.extract_sap_coex_cap_service_ready_ext2 =
 			extract_sap_coex_fix_chan_caps,
+	.extract_tgtr2p_table_event = extract_tgtr2p_table_event_tlv,
 };
 
 #ifdef WLAN_FEATURE_11BE_MLO
@@ -21388,6 +21417,8 @@ static void populate_tlv_events_id(WMI_EVT_ID *event_ids)
 	event_ids[wmi_xgap_enable_complete_eventid] =
 		WMI_XGAP_ENABLE_COMPLETE_EVENTID;
 #endif
+	event_ids[wmi_pdev_set_tgtr2p_table_eventid] =
+		WMI_PDEV_SET_TGTR2P_TABLE_EVENTID;
 }
 
 #ifdef WLAN_FEATURE_LINK_LAYER_STATS