diff --git a/wmi_unified_apf_tlv.h b/wmi_unified_apf_tlv.h index ab764198bc..cbeba3e2d1 100644 --- a/wmi_unified_apf_tlv.h +++ b/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 -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_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 +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_ */ diff --git a/wmi_unified_api.h b/wmi_unified_api.h index f8cf143eb1..80dcbfa503 100644 --- a/wmi_unified_api.h +++ b/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); diff --git a/wmi_unified_param.h b/wmi_unified_param.h index a6289f5af2..38cb6f17e3 100644 --- a/wmi_unified_param.h +++ b/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_ */ diff --git a/wmi_unified_priv.h b/wmi_unified_priv.h index 5971f16972..6cd1555238 100644 --- a/wmi_unified_priv.h +++ b/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);