From 78ddddb14163f2662233d2bcc5d3c873e79a7a89 Mon Sep 17 00:00:00 2001 From: Rhythm Patwa Date: Wed, 11 Mar 2020 15:10:31 -0700 Subject: [PATCH] qcacmn: Add WMI support to enable injector frame cmd Add corresponding WMI host param for enabling the injector frame on the AP. CRs-fixed: 2640751 Change-Id: I00a634375e0eafbacfd505aa39dce9c8d90804c6 --- wmi/inc/wmi_unified_api.h | 12 +++++++++++ wmi/inc/wmi_unified_param.h | 16 +++++++++++++++ wmi/inc/wmi_unified_priv.h | 3 +++ wmi/src/wmi_unified_api.c | 12 +++++++++++ wmi/src/wmi_unified_tlv.c | 41 +++++++++++++++++++++++++++++++++++++ 5 files changed, 84 insertions(+) diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 8bb983fd99a7..30c4cba30bad 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -3912,4 +3912,16 @@ wmi_unified_extract_time_sync_ftm_offset(wmi_unified_t wmi_handle, struct ftm_time_sync_offset *param); #endif /* FEATURE_WLAN_TIME_SYNC_FTM */ +/** + * wmi_unified_send_injector_frame_config_cmd() - configure injector frame + * @wmi_handle: wmi handle + * @param: params received in the injector frame configure command + * + * This function configures the AP to send out injector frames + * + * Return QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE for failure + */ +QDF_STATUS +wmi_unified_send_injector_frame_config_cmd(wmi_unified_t wmi_handle, + struct wmi_host_injector_frame_params *param); #endif /* _WMI_UNIFIED_API_H_ */ diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index 9b168e8db54e..d84ad92556fa 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -7352,6 +7352,22 @@ struct wmi_host_obss_spatial_reuse_set_def_thresh { }; #endif +/** + * struct wmi_host_injector_frame_params - Injector frame configuration params + * @vdev_id: vdev identifer of VAP + * @enable: Enable/disable flag for the frame + * @frame_type: Frame type to be enabled + * @frame_inject_period: Periodicity of injector frame transmission + * @dstmac: Destination address to be used for the frame + */ +struct wmi_host_injector_frame_params { + uint32_t vdev_id; + uint32_t enable; + uint32_t frame_type; + uint32_t frame_inject_period; + uint8_t dstmac[QDF_MAC_ADDR_SIZE]; +}; + /** * struct wds_entry - WDS entry structure * @peer_mac: peer mac diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index b2fb2a10dc71..aa079dba5e1e 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -2254,6 +2254,9 @@ QDF_STATUS (*extract_time_sync_ftm_offset_event)( #endif /* FEATURE_WLAN_TIME_SYNC_FTM */ QDF_STATUS (*send_roam_scan_ch_list_req_cmd)(wmi_unified_t wmi_hdl, uint32_t vdev_id); + +QDF_STATUS (*send_injector_config_cmd)(wmi_unified_t wmi_handle, + struct wmi_host_injector_frame_params *params); }; /* Forward declartion for psoc*/ diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index a8eb23e07e06..197fb3bb35ae 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -3196,3 +3196,15 @@ QDF_STATUS wmi_unified_extract_time_sync_ftm_offset( return QDF_STATUS_E_FAILURE; } #endif /* FEATURE_WLAN_TIME_SYNC_FTM */ + +QDF_STATUS +wmi_unified_send_injector_frame_config_cmd(wmi_unified_t wmi_handle, + struct wmi_host_injector_frame_params *param) +{ + if (wmi_handle->ops->send_injector_config_cmd) { + return wmi_handle->ops->send_injector_config_cmd(wmi_handle, + param); + } + + return QDF_STATUS_E_FAILURE; +} diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index 70c99552504c..d19b9534035a 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -8477,6 +8477,46 @@ QDF_STATUS send_obss_spatial_reuse_set_cmd_tlv(wmi_unified_t wmi_handle, } #endif +static +QDF_STATUS send_injector_config_cmd_tlv(wmi_unified_t wmi_handle, + struct wmi_host_injector_frame_params *inject_config_params) +{ + wmi_buf_t buf; + wmi_frame_inject_cmd_fixed_param *cmd; + QDF_STATUS ret; + uint32_t len; + + len = sizeof(*cmd); + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) + return QDF_STATUS_E_NOMEM; + + cmd = (wmi_frame_inject_cmd_fixed_param *)wmi_buf_data(buf); + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_frame_inject_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN + (wmi_frame_inject_cmd_fixed_param)); + + cmd->vdev_id = inject_config_params->vdev_id; + cmd->enable = inject_config_params->enable; + cmd->frame_type = inject_config_params->frame_type; + cmd->frame_inject_period = inject_config_params->frame_inject_period; + WMI_CHAR_ARRAY_TO_MAC_ADDR(inject_config_params->dstmac, + &cmd->frame_addr1); + + ret = wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_PDEV_FRAME_INJECT_CMDID); + + if (QDF_IS_STATUS_ERROR(ret)) { + WMI_LOGE( + "WMI_PDEV_FRAME_INJECT_CMDID send returned Error %d", + ret); + wmi_buf_free(buf); + } + + return ret; +} #ifdef QCA_SUPPORT_CP_STATS /** * extract_cca_stats_tlv - api to extract congestion stats from event buffer @@ -13727,6 +13767,7 @@ struct wmi_ops tlv_ops = { extract_time_sync_ftm_offset_event_tlv, #endif /* FEATURE_WLAN_TIME_SYNC_FTM */ .send_roam_scan_ch_list_req_cmd = send_roam_scan_ch_list_req_cmd_tlv, + .send_injector_config_cmd = send_injector_config_cmd_tlv, }; /**