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

qcacmn: Implement the commands that cover APF 3.0 requirements

Android Packet Filter 3.0 requires the framework to be able to
read and write into the APF work memory in the Firmware. It
also requires to be able to enable or disable the interpreter.
New WMI commands are defined for read/write/enable/disable
operations.

Complete the implementation of these new commands.

Change-Id: I852d61eb213d9ae530e8a71069144ef35816f5b8
CRs-Fixed: 2184971
Nachiket Kukade 6 жил өмнө
parent
commit
b29adc4a4f

+ 11 - 0
os_if/linux/qca_vendor.h

@@ -3818,10 +3818,18 @@ enum qca_set_band {
  * enum set_reset_packet_filter - set packet filter control commands
  * @QCA_WLAN_SET_PACKET_FILTER: Set Packet Filter
  * @QCA_WLAN_GET_PACKET_FILTER: Get Packet filter
+ * @QCA_WLAN_WRITE_PACKET_FILTER: Write packet filter program/data
+ * @QCA_WLAN_READ_PACKET_FILTER: Read packet filter program/data
+ * @QCA_WLAN_ENABLE_PACKET_FILTER: Enable APF interpreter
+ * @QCA_WLAN_DISABLE_PACKET_FILTER: Disable APF interpreter
  */
 enum set_reset_packet_filter {
 	QCA_WLAN_SET_PACKET_FILTER = 1,
 	QCA_WLAN_GET_PACKET_FILTER = 2,
+	QCA_WLAN_WRITE_PACKET_FILTER = 3,
+	QCA_WLAN_READ_PACKET_FILTER = 4,
+	QCA_WLAN_ENABLE_PACKET_FILTER = 5,
+	QCA_WLAN_DISABLE_PACKET_FILTER = 6,
 };
 
 /**
@@ -3832,6 +3840,8 @@ enum set_reset_packet_filter {
  * @QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_SIZE: Total Length
  * @QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_CURRENT_OFFSET: Current offset
  * @QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_PROGRAM: length of APF instructions
+ * @QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_PROG_LENGTH: length of the program
+ *	section in packet filter buffer
  */
 enum qca_wlan_vendor_attr_packet_filter {
 	QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_INVALID = 0,
@@ -3841,6 +3851,7 @@ enum qca_wlan_vendor_attr_packet_filter {
 	QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_SIZE,
 	QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_CURRENT_OFFSET,
 	QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_PROGRAM,
+	QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_PROG_LENGTH,
 
 	/* keep last */
 	QCA_WLAN_VENDOR_ATTR_PACKET_FILTER_AFTER_LAST,

+ 65 - 7
wmi/inc/wmi_unified_apf_tlv.h

@@ -19,24 +19,82 @@
 #ifndef _WMI_UNIFIED_APF_TLV_H_
 #define _WMI_UNIFIED_APF_TLV_H_
 
+#ifdef FEATURE_WLAN_APF
+
 #include "wmi_unified.h"
 #include "wmi_unified_api.h"
 #include "wmi_unified_param.h"
 
 /**
- * send_set_active_apf_mode_cmd_tlv() - configure active APF mode in FW
+ * wmi_send_set_active_apf_mode_cmd_tlv() - configure active APF mode in FW
  * @wmi_handle: the WMI handle
  * @vdev_id: the Id of the vdev to apply the configuration to
  * @ucast_mode: the active APF mode to configure for unicast packets
  * @mcast_bcast_mode: the active APF mode to configure for multicast/broadcast
- *	packets
+ * packets
+ *
+ * Return: QDF status
+ */
+QDF_STATUS
+wmi_send_set_active_apf_mode_cmd_tlv(wmi_unified_t wmi_handle,
+				     uint8_t vdev_id,
+				     enum wmi_host_active_apf_mode ucast_mode,
+				     enum wmi_host_active_apf_mode
+							      mcast_bcast_mode);
+
+/**
+ * wmi_send_apf_enable_cmd_tlv() - send cmd to enable/disable APF interpreter
+ * @wmi_handle: the WMI handle
+ * @vdev_id: VDEV on which APF interpreter is to be enabled/disabled
+ * @enable: true: enable, false: disable
+ *
+ * Return: QDF status
+ */
+QDF_STATUS
+wmi_send_apf_enable_cmd_tlv(wmi_unified_t wmi_handle, uint32_t vdev_id,
+			    bool enable);
+
+/**
+ * wmi_send_apf_write_work_memory_cmd_tlv() - send cmd to write into the APF
+ * work
+ * memory
+ * @wmi_handle: the WMI handle
+ * @apf_write_params: parameters and buffer pointer for the write
  *
  * Return: QDF status
  */
 QDF_STATUS
-send_set_active_apf_mode_cmd_tlv(wmi_unified_t wmi_handle,
-				 uint8_t vdev_id,
-				 enum wmi_host_active_apf_mode ucast_mode,
-				 enum wmi_host_active_apf_mode
-							mcast_bcast_mode);
+wmi_send_apf_write_work_memory_cmd_tlv(wmi_unified_t wmi_handle,
+				       struct wmi_apf_write_memory_params
+							     *apf_write_params);
+
+/**
+ * wmi_send_apf_read_work_memory_cmd_tlv() - send cmd to read part of APF
+ * work memory
+ * @wmi_handle: the WMI handle
+ * @apf_read_params: contains relative address and length to read from
+ *
+ * Return: QDF status
+ */
+QDF_STATUS
+wmi_send_apf_read_work_memory_cmd_tlv(wmi_unified_t wmi_handle,
+				      struct wmi_apf_read_memory_params
+							      *apf_read_params);
+
+/**
+ * wmi_extract_apf_read_memory_resp_event_tlv() - extract read memory response
+ * event into the given structure pointer
+ * @wmi_handle: the WMI handle
+ * @evt_buf: Pointer to the event buffer
+ * @resp: pointer to memory to extract event parameters into
+ *
+ * Return: QDF status
+ */
+QDF_STATUS
+wmi_extract_apf_read_memory_resp_event_tlv(wmi_unified_t wmi_handle,
+				void *evt_buf,
+				struct wmi_apf_read_memory_resp_event_params
+									 *resp);
+#endif /* FEATURE_WLAN_APF */
+
 #endif /* _WMI_UNIFIED_APF_TLV_H_ */

+ 58 - 2
wmi/inc/wmi_unified_api.h

@@ -1096,20 +1096,76 @@ QDF_STATUS wmi_unified_roam_scan_offload_rssi_change_cmd(void *wmi_hdl,
 QDF_STATUS wmi_unified_set_per_roam_config(void *wmi_hdl,
 		struct wmi_per_roam_config_req *req_buf);
 
+#ifdef FEATURE_WLAN_APF
 /**
  * wmi_unified_set_active_apf_mode_cmd() - config active APF mode in FW
- * @wmi_hdl: the WMI handle
+ * @wmi: the WMI handle
  * @vdev_id: the Id of the vdev to apply the configuration to
  * @ucast_mode: the active APF mode to configure for unicast packets
  * @mcast_bcast_mode: the active APF mode to configure for multicast/broadcast
  *	packets
  */
 QDF_STATUS
-wmi_unified_set_active_apf_mode_cmd(void *wmi_hdl, uint8_t vdev_id,
+wmi_unified_set_active_apf_mode_cmd(wmi_unified_t wmi, uint8_t vdev_id,
 				    enum wmi_host_active_apf_mode ucast_mode,
 				    enum wmi_host_active_apf_mode
 							      mcast_bcast_mode);
 
+/**
+ * wmi_unified_send_apf_enable_cmd() - send apf enable/disable cmd
+ * @wmi: wmi handle
+ * @vdev_id: VDEV id
+ * @enable: true: enable, false: disable
+ *
+ * This function passes the apf enable command to fw
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_send_apf_enable_cmd(wmi_unified_t wmi,
+					   uint32_t vdev_id, bool enable);
+
+/**
+ * wmi_unified_send_apf_write_work_memory_cmd() - send cmd to write into the APF
+ *	work memory.
+ * @wmi: wmi handle
+ * @write_params: parameters and buffer pointer for the write
+ *
+ * This function passes the write apf work mem command to fw
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_send_apf_write_work_memory_cmd(wmi_unified_t wmi,
+			struct wmi_apf_write_memory_params *write_params);
+
+/**
+ * wmi_unified_send_apf_read_work_memory_cmd() - send cmd to read part of APF
+ *	work memory
+ * @wmi: wmi handle
+ * @read_params: contains relative address and length to read from
+ *
+ * This function passes the read apf work mem command to fw
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS wmi_unified_send_apf_read_work_memory_cmd(wmi_unified_t wmi,
+				struct wmi_apf_read_memory_params *read_params);
+
+/**
+ * wmi_extract_apf_read_memory_resp_event() - exctract read mem resp event
+ * @wmi: wmi handle
+ * @evt_buf: Pointer to the event buffer
+ * @resp: pointer to memory to extract event parameters into
+ *
+ * This function exctracts read mem response event into the given structure ptr
+ *
+ * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure
+ */
+QDF_STATUS
+wmi_extract_apf_read_memory_resp_event(wmi_unified_t wmi, void *evt_buf,
+				struct wmi_apf_read_memory_resp_event_params
+								*read_mem_evt);
+#endif /* FEATURE_WLAN_APF */
+
 QDF_STATUS wmi_unified_stats_request_send(void *wmi_hdl,
 				uint8_t macaddr[IEEE80211_ADDR_LEN],
 				struct stats_request_params *param);

+ 52 - 0
wmi/inc/wmi_unified_param.h

@@ -5529,6 +5529,7 @@ typedef enum {
 	wmi_host_dfs_status_check_event_id,
 #endif
 	wmi_twt_enable_complete_event_id,
+	wmi_apf_get_vdev_work_memory_resp_event_id,
 
 	wmi_events_max,
 } wmi_conv_event_id;
@@ -8434,4 +8435,55 @@ struct wmi_host_congestion_stats {
 	uint32_t congestion;
 };
 #endif
+
+#ifdef FEATURE_WLAN_APF
+/**
+ * struct wmi_apf_write_memory_params - Android Packet Filter write memory
+ * params
+ * @vdev_id: VDEV on which APF memory is to be written
+ * @apf_version: APF version number
+ * @program_len: Length reserved for program in the APF work memory
+ * @addr_offset: Relative address in APF work memory to start writing
+ * @length: Size of the write
+ * @buf: Pointer to the buffer
+ */
+struct wmi_apf_write_memory_params {
+	uint8_t vdev_id;
+	uint32_t apf_version;
+	uint32_t program_len;
+	uint32_t addr_offset;
+	uint32_t length;
+	uint8_t *buf;
+};
+
+/**
+ * struct wmi_apf_read_memory_params - Android Packet Filter read memory params
+ * @vdev_id: vdev id
+ * @addr_offset: Relative address in APF work memory to read from
+ * @length: Size of the memory fetch
+ */
+struct wmi_apf_read_memory_params {
+	uint8_t vdev_id;
+	uint32_t addr_offset;
+	uint32_t length;
+};
+
+/**
+ * struct wmi_apf_read_memory_resp_event_params - Event containing read Android
+ *	Packet Filter memory response
+ * @vdev_id: vdev id
+ * @offset: Read memory offset
+ * @length: Read memory length
+ * @more_data: Indicates more data to come
+ * @data: Pointer to the data
+ */
+struct wmi_apf_read_memory_resp_event_params {
+	uint32_t vdev_id;
+	uint32_t offset;
+	uint32_t length;
+	bool more_data;
+	uint8_t *data;
+};
+#endif /* FEATURE_WLAN_APF */
+
 #endif /* _WMI_UNIFIED_PARAM_H_ */

+ 15 - 0
wmi/inc/wmi_unified_priv.h

@@ -811,11 +811,26 @@ QDF_STATUS (*send_get_buf_extscan_hotlist_cmd)(wmi_unified_t wmi_handle,
 				   struct ext_scan_setbssi_hotlist_params *
 				   photlist, int *buf_len);
 
+#ifdef FEATURE_WLAN_APF
 QDF_STATUS
 (*send_set_active_apf_mode_cmd)(wmi_unified_t wmi_handle, uint8_t vdev_id,
 				enum wmi_host_active_apf_mode ucast_mode,
 				enum wmi_host_active_apf_mode mcast_bcast_mode);
 
+QDF_STATUS (*send_apf_enable_cmd)(wmi_unified_t wmi_handle, uint32_t vdev_id,
+				  bool enable);
+
+QDF_STATUS (*send_apf_write_work_memory_cmd)(wmi_unified_t wmi_handle,
+			struct wmi_apf_write_memory_params *apf_write_params);
+
+QDF_STATUS (*send_apf_read_work_memory_cmd)(wmi_unified_t wmi_handle,
+			struct wmi_apf_read_memory_params *apf_read_params);
+
+QDF_STATUS (*extract_apf_read_memory_resp_event)(wmi_unified_t wmi_handle,
+			void *evt_buf,
+			struct wmi_apf_read_memory_resp_event_params *resp);
+#endif /* FEATURE_WLAN_APF */
+
 QDF_STATUS (*send_pdev_get_tpc_config_cmd)(wmi_unified_t wmi_handle,
 		uint32_t param);
 

+ 160 - 4
wmi/src/wmi_unified_apf_tlv.c

@@ -18,7 +18,7 @@
 
 #include "wmi_unified_apf_tlv.h"
 
-QDF_STATUS send_set_active_apf_mode_cmd_tlv(wmi_unified_t wmi_handle,
+QDF_STATUS wmi_send_set_active_apf_mode_cmd_tlv(wmi_unified_t wmi_handle,
 					    uint8_t vdev_id,
 					    enum wmi_host_active_apf_mode
 								     ucast_mode,
@@ -33,7 +33,7 @@ QDF_STATUS send_set_active_apf_mode_cmd_tlv(wmi_unified_t wmi_handle,
 	wmi_bpf_set_vdev_active_mode_cmd_fixed_param *cmd;
 	wmi_buf_t buf;
 
-	WMI_LOGD("Sending WMI_APF_SET_VDEV_ACTIVE_MODE_CMDID(%u, %d, %d)",
+	WMI_LOGD("Sending WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID(%u, %d, %d)",
 		 vdev_id, ucast_mode, mcast_bcast_mode);
 
 	/* allocate command buffer */
@@ -56,14 +56,170 @@ QDF_STATUS send_set_active_apf_mode_cmd_tlv(wmi_unified_t wmi_handle,
 	status = wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd),
 				      WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID);
 	if (QDF_IS_STATUS_ERROR(status)) {
-		WMI_LOGE("Failed to send WMI_APF_SET_VDEV_ACTIVE_MODE_CMDID:%d",
+		WMI_LOGE("Failed to send WMI_BPF_SET_VDEV_ACTIVE_MODE_CMDID:%d",
 			 status);
 		wmi_buf_free(buf);
 		return status;
 	}
 
-	WMI_LOGD("Sent WMI_APF_SET_VDEV_ACTIVE_MODE_CMDID successfully");
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS wmi_send_apf_enable_cmd_tlv(wmi_unified_t wmi_handle,
+				       uint32_t vdev_id,
+				       bool enable)
+{
+	wmi_bpf_set_vdev_enable_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+
+	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
+	if (!buf) {
+		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	cmd = (wmi_bpf_set_vdev_enable_cmd_fixed_param *) wmi_buf_data(buf);
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_bpf_set_vdev_enable_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+			wmi_bpf_set_vdev_enable_cmd_fixed_param));
+	cmd->vdev_id = vdev_id;
+	cmd->is_enabled = enable;
+
+	if (wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd),
+				 WMI_BPF_SET_VDEV_ENABLE_CMDID)) {
+		WMI_LOGE("%s: Failed to enable/disable APF interpreter",
+			 __func__);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+wmi_send_apf_write_work_memory_cmd_tlv(wmi_unified_t wmi_handle,
+				       struct wmi_apf_write_memory_params
+							      *apf_write_params)
+{
+	wmi_bpf_set_vdev_work_memory_cmd_fixed_param *cmd;
+	uint32_t wmi_buf_len;
+	wmi_buf_t buf;
+	uint8_t *buf_ptr;
+	uint32_t aligned_len = 0;
+
+	wmi_buf_len = sizeof(*cmd);
+	if (apf_write_params->length) {
+		aligned_len = roundup(apf_write_params->length,
+				      sizeof(A_UINT32));
+
+		wmi_buf_len += WMI_TLV_HDR_SIZE + aligned_len;
+
+	}
+
+	buf = wmi_buf_alloc(wmi_handle, wmi_buf_len);
+	if (!buf) {
+		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	buf_ptr = wmi_buf_data(buf);
+	cmd = (wmi_bpf_set_vdev_work_memory_cmd_fixed_param *)buf_ptr;
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_bpf_set_vdev_work_memory_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+			wmi_bpf_set_vdev_work_memory_cmd_fixed_param));
+	cmd->vdev_id = apf_write_params->vdev_id;
+	cmd->bpf_version = apf_write_params->apf_version;
+	cmd->program_len = apf_write_params->program_len;
+	cmd->addr_offset = apf_write_params->addr_offset;
+	cmd->length = apf_write_params->length;
+
+	if (apf_write_params->length) {
+		buf_ptr += sizeof(*cmd);
+		WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_BYTE,
+			       aligned_len);
+		buf_ptr += WMI_TLV_HDR_SIZE;
+		qdf_mem_copy(buf_ptr, apf_write_params->buf,
+			     apf_write_params->length);
+	}
+
+	if (wmi_unified_cmd_send(wmi_handle, buf, wmi_buf_len,
+				 WMI_BPF_SET_VDEV_WORK_MEMORY_CMDID)) {
+		WMI_LOGE("%s: Failed to write APF work memory", __func__);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
 
 	return QDF_STATUS_SUCCESS;
 }
 
+QDF_STATUS
+wmi_send_apf_read_work_memory_cmd_tlv(wmi_unified_t wmi_handle,
+				      struct wmi_apf_read_memory_params
+							       *apf_read_params)
+{
+	wmi_bpf_get_vdev_work_memory_cmd_fixed_param *cmd;
+	wmi_buf_t buf;
+
+	buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd));
+	if (!buf) {
+		WMI_LOGP("%s: wmi_buf_alloc failed", __func__);
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	cmd = (wmi_bpf_get_vdev_work_memory_cmd_fixed_param *)
+							wmi_buf_data(buf);
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		WMITLV_TAG_STRUC_wmi_bpf_get_vdev_work_memory_cmd_fixed_param,
+		WMITLV_GET_STRUCT_TLVLEN(
+			wmi_bpf_get_vdev_work_memory_cmd_fixed_param));
+	cmd->vdev_id = apf_read_params->vdev_id;
+	cmd->addr_offset = apf_read_params->addr_offset;
+	cmd->length = apf_read_params->length;
+
+	if (wmi_unified_cmd_send(wmi_handle, buf, sizeof(*cmd),
+				 WMI_BPF_GET_VDEV_WORK_MEMORY_CMDID)) {
+		WMI_LOGE("%s: Failed to get APF work memory", __func__);
+		wmi_buf_free(buf);
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS
+wmi_extract_apf_read_memory_resp_event_tlv(wmi_unified_t wmi_handle,
+				void *evt_buf,
+				struct wmi_apf_read_memory_resp_event_params
+									  *resp)
+{
+	WMI_BPF_GET_VDEV_WORK_MEMORY_RESP_EVENTID_param_tlvs *param_buf;
+	wmi_bpf_get_vdev_work_memory_resp_evt_fixed_param *data_event;
+
+	param_buf = evt_buf;
+	if (!param_buf) {
+		WMI_LOGE("encrypt decrypt resp evt_buf is NULL");
+		return QDF_STATUS_E_INVAL;
+	}
+
+	data_event = param_buf->fixed_param;
+
+	resp->vdev_id = data_event->vdev_id;
+	resp->offset = data_event->offset;
+	resp->more_data = data_event->fragment;
+
+	if (data_event->length > param_buf->num_data) {
+		WMI_LOGE("FW msg data_len %d more than TLV hdr %d",
+			 data_event->length,
+			 param_buf->num_data);
+		return QDF_STATUS_E_INVAL;
+	}
+	resp->length = data_event->length;
+
+	if (resp->length)
+		resp->data = (uint8_t *)param_buf->data;
+
+	return QDF_STATUS_SUCCESS;
+}

+ 52 - 9
wmi/src/wmi_unified_api.c

@@ -3157,23 +3157,66 @@ QDF_STATUS wmi_unified_roam_send_hlp_cmd(void *wmi_hdl,
 }
 #endif
 
+#ifdef FEATURE_WLAN_APF
 QDF_STATUS
-wmi_unified_set_active_apf_mode_cmd(void *wmi_hdl, uint8_t vdev_id,
+wmi_unified_set_active_apf_mode_cmd(wmi_unified_t wmi, uint8_t vdev_id,
 				    enum wmi_host_active_apf_mode ucast_mode,
 				    enum wmi_host_active_apf_mode
 							       mcast_bcast_mode)
 {
-	wmi_unified_t wmi = (wmi_unified_t)wmi_hdl;
+	if (wmi->ops->send_set_active_apf_mode_cmd)
+		return wmi->ops->send_set_active_apf_mode_cmd(wmi, vdev_id,
+							      ucast_mode,
+							      mcast_bcast_mode);
+	return QDF_STATUS_E_FAILURE;
+}
 
-	if (!wmi->ops->send_set_active_apf_mode_cmd) {
-		WMI_LOGD("send_set_active_apf_mode_cmd op is NULL");
-		return QDF_STATUS_E_FAILURE;
-	}
+QDF_STATUS
+wmi_unified_send_apf_enable_cmd(wmi_unified_t wmi,
+				uint32_t vdev_id, bool enable)
+{
+	if (wmi->ops->send_apf_enable_cmd)
+		return wmi->ops->send_apf_enable_cmd(wmi, vdev_id, enable);
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS
+wmi_unified_send_apf_write_work_memory_cmd(wmi_unified_t wmi,
+					   struct wmi_apf_write_memory_params
+								  *write_params)
+{
+	if (wmi->ops->send_apf_write_work_memory_cmd)
+		return wmi->ops->send_apf_write_work_memory_cmd(wmi,
+								write_params);
 
-	return wmi->ops->send_set_active_apf_mode_cmd(wmi, vdev_id,
-						      ucast_mode,
-						      mcast_bcast_mode);
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS
+wmi_unified_send_apf_read_work_memory_cmd(wmi_unified_t wmi,
+					  struct wmi_apf_read_memory_params
+								   *read_params)
+{
+	if (wmi->ops->send_apf_read_work_memory_cmd)
+		return wmi->ops->send_apf_read_work_memory_cmd(wmi,
+							       read_params);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
+QDF_STATUS
+wmi_extract_apf_read_memory_resp_event(wmi_unified_t wmi, void *evt_buf,
+				struct wmi_apf_read_memory_resp_event_params
+								*read_mem_evt)
+{
+	if (wmi->ops->extract_apf_read_memory_resp_event)
+		return wmi->ops->extract_apf_read_memory_resp_event(wmi,
+								evt_buf,
+								read_mem_evt);
+
+	return QDF_STATUS_E_FAILURE;
 }
+#endif /* FEATURE_WLAN_APF */
 
 /**
  *  wmi_unified_pdev_get_tpc_config_cmd_send() - WMI get tpc config function

+ 14 - 2
wmi/src/wmi_unified_tlv.c

@@ -24,8 +24,9 @@
 #include <qdf_module.h>
 #include <wlan_defs.h>
 #include <htc_services.h>
+#ifdef FEATURE_WLAN_APF
 #include "wmi_unified_apf_tlv.h"
-
+#endif
 #ifdef CONVERGED_P2P_ENABLE
 #include "wlan_p2p_public_struct.h"
 #endif
@@ -21828,7 +21829,16 @@ struct wmi_ops tlv_ops =  {
 		 send_roam_scan_offload_chan_list_cmd_tlv,
 	.send_roam_scan_offload_rssi_change_cmd =
 		 send_roam_scan_offload_rssi_change_cmd_tlv,
-	.send_set_active_apf_mode_cmd = send_set_active_apf_mode_cmd_tlv,
+#ifdef FEATURE_WLAN_APF
+	.send_set_active_apf_mode_cmd = wmi_send_set_active_apf_mode_cmd_tlv,
+	.send_apf_enable_cmd = wmi_send_apf_enable_cmd_tlv,
+	.send_apf_write_work_memory_cmd =
+				wmi_send_apf_write_work_memory_cmd_tlv,
+	.send_apf_read_work_memory_cmd =
+				wmi_send_apf_read_work_memory_cmd_tlv,
+	.extract_apf_read_memory_resp_event =
+				wmi_extract_apf_read_memory_resp_event_tlv,
+#endif /* FEATURE_WLAN_APF */
 	.send_adapt_dwelltime_params_cmd =
 		send_adapt_dwelltime_params_cmd_tlv,
 	.send_dbs_scan_sel_params_cmd =
@@ -22354,6 +22364,8 @@ static void populate_tlv_events_id(uint32_t *event_ids)
 		WMI_PDEV_DIV_RSSI_ANTID_EVENTID;
 	event_ids[wmi_twt_enable_complete_event_id] =
 		WMI_TWT_ENABLE_COMPLETE_EVENTID;
+	event_ids[wmi_apf_get_vdev_work_memory_resp_event_id] =
+		WMI_BPF_GET_VDEV_WORK_MEMORY_RESP_EVENTID;
 }
 
 /**