diff --git a/init_deinit/dispatcher/src/dispatcher_init_deinit.c b/init_deinit/dispatcher/src/dispatcher_init_deinit.c index 258996b8e1..38cffaa77b 100644 --- a/init_deinit/dispatcher/src/dispatcher_init_deinit.c +++ b/init_deinit/dispatcher/src/dispatcher_init_deinit.c @@ -68,6 +68,9 @@ #endif #include +#ifdef WLAN_SUPPORT_FILS +#include +#endif #ifdef WLAN_SUPPORT_GREEN_AP #include @@ -716,6 +719,48 @@ static QDF_STATUS dispatcher_green_ap_deinit(void) } #endif +#ifdef WLAN_SUPPORT_FILS +static QDF_STATUS dispatcher_fd_init(void) +{ + return wlan_fd_init(); +} + +static QDF_STATUS dispatcher_fd_deinit(void) +{ + return wlan_fd_deinit(); +} + +static QDF_STATUS fd_psoc_enable(struct wlan_objmgr_psoc *psoc) +{ + return wlan_fd_enable(psoc); +} + +static QDF_STATUS fd_psoc_disable(struct wlan_objmgr_psoc *psoc) +{ + return wlan_fd_disable(psoc); +} +#else +static QDF_STATUS dispatcher_fd_init(void) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS dispatcher_fd_deinit(void) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS fd_psoc_enable(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} + +static QDF_STATUS fd_psoc_disable(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} +#endif /* WLAN_SUPPORT_FILS */ + QDF_STATUS dispatcher_init(void) { if (QDF_STATUS_SUCCESS != wlan_objmgr_global_obj_init()) @@ -772,6 +817,9 @@ QDF_STATUS dispatcher_init(void) if (QDF_STATUS_SUCCESS != dispatcher_spectral_init()) goto spectral_init_fail; + if (QDF_STATUS_SUCCESS != dispatcher_fd_init()) + goto fd_init_fail; + if (QDF_STATUS_SUCCESS != dispatcher_green_ap_init()) goto green_ap_init_fail; @@ -793,6 +841,8 @@ scheduler_init_fail: ftm_init_fail: dispatcher_green_ap_deinit(); green_ap_init_fail: + dispatcher_fd_deinit(); +fd_init_fail: dispatcher_spectral_deinit(); spectral_init_fail: dispatcher_splitmac_deinit(); @@ -842,6 +892,8 @@ QDF_STATUS dispatcher_deinit(void) QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_green_ap_deinit()); + QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_fd_deinit()); + QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_spectral_deinit()); QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_splitmac_deinit()); @@ -1013,12 +1065,17 @@ QDF_STATUS dispatcher_psoc_enable(struct wlan_objmgr_psoc *psoc) if (QDF_STATUS_SUCCESS != dispatcher_dfs_psoc_enable(psoc)) goto wifi_dfs_psoc_enable_fail; + if (QDF_STATUS_SUCCESS != fd_psoc_enable(psoc)) + goto fd_psoc_enable_fail; + if (QDF_STATUS_SUCCESS != dispatcher_dbr_psoc_enable(psoc)) goto dbr_psoc_enable_fail; return QDF_STATUS_SUCCESS; dbr_psoc_enable_fail: + fd_psoc_disable(psoc); +fd_psoc_enable_fail: dispatcher_dfs_psoc_disable(psoc); wifi_dfs_psoc_enable_fail: dispatcher_nan_psoc_disable(psoc); @@ -1046,6 +1103,8 @@ QDF_STATUS dispatcher_psoc_disable(struct wlan_objmgr_psoc *psoc) { QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_dbr_psoc_disable(psoc)); + QDF_BUG(QDF_STATUS_SUCCESS == fd_psoc_disable(psoc)); + QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_dfs_psoc_disable(psoc)); QDF_BUG(QDF_STATUS_SUCCESS == dispatcher_nan_psoc_disable(psoc)); diff --git a/qdf/inc/qdf_types.h b/qdf/inc/qdf_types.h index 8e33f93b15..81c30bc7d8 100644 --- a/qdf/inc/qdf_types.h +++ b/qdf/inc/qdf_types.h @@ -327,6 +327,7 @@ typedef void (*qdf_timer_func_t)(void *); * @QDF_MODULE_ID_GREEN_AP: Green AP related logging * @QDF_MODULE_ID_FTM: FTM module ID * @QDF_MODULE_ID_EXTAP: Extender AP module ID + * @QDF_MODULE_ID_FD: FILS discovery logging * @QDF_MODULE_ID_ANY: anything * @QDF_MODULE_ID_MAX: Max place holder module ID */ @@ -426,6 +427,7 @@ typedef enum { QDF_MODULE_ID_GREEN_AP, QDF_MODULE_ID_FTM, QDF_MODULE_ID_EXTAP, + QDF_MODULE_ID_FD, QDF_MODULE_ID_ANY, QDF_MODULE_ID_MAX, } QDF_MODULE_ID; diff --git a/qdf/linux/src/qdf_trace.c b/qdf/linux/src/qdf_trace.c index f1590ae724..1bb764a382 100644 --- a/qdf/linux/src/qdf_trace.c +++ b/qdf/linux/src/qdf_trace.c @@ -2120,6 +2120,7 @@ struct category_name_info g_qdf_category_name[MAX_SUPPORTED_CATEGORY] = { [QDF_MODULE_ID_DISA] = {"disa"}, [QDF_MODULE_ID_GREEN_AP] = {"GREEN_AP"}, [QDF_MODULE_ID_EXTAP] = {"EXTAP"}, + [QDF_MODULE_ID_FD] = {"FILS discovery"}, [QDF_MODULE_ID_ANY] = {"ANY"}, }; EXPORT_SYMBOL(g_qdf_category_name); @@ -2590,6 +2591,7 @@ static void set_default_trace_levels(struct category_info *cinfo) [QDF_MODULE_ID_DIRECT_BUF_RX] = QDF_TRACE_LEVEL_ERROR, [QDF_MODULE_ID_GREEN_AP] = QDF_TRACE_LEVEL_ERROR, [QDF_MODULE_ID_EXTAP] = QDF_TRACE_LEVEL_NONE, + [QDF_MODULE_ID_FD] = QDF_TRACE_LEVEL_ERROR, [QDF_MODULE_ID_ANY] = QDF_TRACE_LEVEL_NONE, }; diff --git a/target_if/core/src/target_if_main.c b/target_if/core/src/target_if_main.c index 1f90f2d914..162ab9c350 100644 --- a/target_if/core/src/target_if_main.c +++ b/target_if/core/src/target_if_main.c @@ -67,6 +67,10 @@ #include #endif +#ifdef WLAN_SUPPORT_FILS +#include +#endif + static struct target_if_ctx *g_target_if_ctx; struct target_if_ctx *target_if_get_ctx() @@ -173,6 +177,17 @@ static void target_if_sa_api_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops) } #endif /* WLAN_SA_API_ENABLE */ +#ifdef WLAN_SUPPORT_FILS +static void target_if_fd_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops) +{ + target_if_fd_register_tx_ops(tx_ops); +} +#else +static void target_if_fd_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops) +{ +} +#endif + #ifdef WIFI_POS_CONVERGED static void target_if_wifi_pos_tx_ops_register( struct wlan_lmac_if_tx_ops *tx_ops) @@ -334,6 +349,8 @@ QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) target_if_tdls_tx_ops_register(tx_ops); + target_if_fd_tx_ops_register(tx_ops); + target_if_target_tx_ops_register(tx_ops); target_if_offchan_txrx_ops_register(tx_ops); diff --git a/umac/cmn_services/inc/wlan_cmn.h b/umac/cmn_services/inc/wlan_cmn.h index b28b3d0aa8..4ab2a1d432 100644 --- a/umac/cmn_services/inc/wlan_cmn.h +++ b/umac/cmn_services/inc/wlan_cmn.h @@ -123,6 +123,7 @@ * @WLAN_UMAC_COMP_DISA: DISA encryption test * @WLAN_UMAC_COMP_GREEN_AP: Green AP * @WLAN_UMAC_COMP_FTM: FTM component + * @WLAN_UMAC_COMP_FD: FILS Discovery * * @WLAN_UMAC_COMP_ID_MAX: Maximum components in UMAC * @@ -154,6 +155,7 @@ enum wlan_umac_comp_id { WLAN_UMAC_COMP_DISA, WLAN_UMAC_COMP_GREEN_AP, WLAN_UMAC_COMP_FTM, + WLAN_UMAC_COMP_FD, WLAN_UMAC_COMP_ID_MAX, }; diff --git a/umac/cmn_services/mgmt_txrx/dispatcher/inc/wlan_mgmt_txrx_utils_api.h b/umac/cmn_services/mgmt_txrx/dispatcher/inc/wlan_mgmt_txrx_utils_api.h index dcedf47d07..a806de4870 100644 --- a/umac/cmn_services/mgmt_txrx/dispatcher/inc/wlan_mgmt_txrx_utils_api.h +++ b/umac/cmn_services/mgmt_txrx/dispatcher/inc/wlan_mgmt_txrx_utils_api.h @@ -753,6 +753,23 @@ QDF_STATUS wlan_mgmt_txrx_beacon_frame_tx(struct wlan_objmgr_peer *peer, qdf_nbuf_t buf, enum wlan_umac_comp_id comp_id); +#ifdef WLAN_SUPPORT_FILS +/** + * wlan_mgmt_txrx_fd_action_frame_tx() - transmits mgmt. FD Action frame + * @vdev: vdev object + * @buf: buffer to be transmitted + * @comp_id: umac component id + * + * This function transmits the FILS Dicovery Action frame to + * southbound interface. + * + * Return: QDF_STATUS_SUCCESS - in case of success + */ +QDF_STATUS wlan_mgmt_txrx_fd_action_frame_tx(struct wlan_objmgr_vdev *vdev, + qdf_nbuf_t buf, + enum wlan_umac_comp_id comp_id); +#endif /* WLAN_SUPPORT_FILS */ + /** * wlan_mgmt_txrx_register_rx_cb() - registers the rx cb for mgmt. frames * @psoc: psoc context diff --git a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c index b9473a611c..bda96191e7 100644 --- a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c +++ b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c @@ -479,6 +479,41 @@ QDF_STATUS wlan_mgmt_txrx_beacon_frame_tx(struct wlan_objmgr_peer *peer, return QDF_STATUS_SUCCESS; } +#ifdef WLAN_SUPPORT_FILS +QDF_STATUS +wlan_mgmt_txrx_fd_action_frame_tx(struct wlan_objmgr_vdev *vdev, + qdf_nbuf_t buf, + enum wlan_umac_comp_id comp_id) +{ + struct wlan_objmgr_psoc *psoc; + uint32_t vdev_id; + + if (!vdev) { + mgmt_txrx_err("Invalid vdev"); + return QDF_STATUS_E_NULL_VALUE; + } + vdev_id = wlan_vdev_get_id(vdev); + psoc = wlan_vdev_get_psoc(vdev); + if (!psoc) { + mgmt_txrx_err("psoc unavailable for vdev %d", vdev_id); + return QDF_STATUS_E_NULL_VALUE; + } + + if (!psoc->soc_cb.tx_ops.mgmt_txrx_tx_ops.fd_action_frame_send) { + mgmt_txrx_err("mgmt txrx txop to send fd action frame is NULL"); + return QDF_STATUS_E_FAILURE; + } + + if (psoc->soc_cb.tx_ops.mgmt_txrx_tx_ops.fd_action_frame_send( + vdev, buf)) { + mgmt_txrx_err("FD send fail for vdev %d", vdev_id); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +} +#endif /* WLAN_SUPPORT_FILS */ + /** * wlan_mgmt_txrx_create_rx_handler() - creates rx handler node for umac comp. * @mgmt_txrx_psoc_ctx: mgmt txrx context diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h index 3c3da3a897..01dbfddd8f 100644 --- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h +++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h @@ -204,6 +204,7 @@ typedef void (*wlan_objmgr_peer_status_handler)( * @WLAN_DIRECT_BUF_RX_ID: Direct Buffer Receive operations * @WLAN_DISA_ID: DISA (encryption test) operations * @WLAN_FTM_ID: FTM module + * @WLAN_FD_ID: FILS Discovery * @WLAN_REF_ID_MAX: Max id used to generate ref count tracking array */ /* New value added to the enum must also be reflected in function @@ -243,6 +244,7 @@ typedef enum { WLAN_DIRECT_BUF_RX_ID = 30, WLAN_DISA_ID = 31, WLAN_FTM_ID = 31, + WLAN_FD_ID = 33, WLAN_REF_ID_MAX, } wlan_objmgr_ref_dbgid; @@ -289,6 +291,7 @@ static inline char *string_from_dbgid(wlan_objmgr_ref_dbgid id) "WLAN_DIRECT_BUF_RX_ID", "WLAN_DISA_ID", "WLAN_FTM_ID", + "WLAN_FD_ID", "WLAN_REF_ID_MAX" }; return (char *)strings[id]; diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h index 98ca15862b..59916f0555 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h +++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h @@ -76,6 +76,7 @@ struct scheduler_msg; * pointers for mgmt txrx component * @mgmt_tx_send: function pointer to transmit mgmt tx frame * @beacon_send: function pointer to transmit beacon frame + * @fd_action_frame_send: function pointer to transmit FD action frame */ struct wlan_lmac_if_mgmt_txrx_tx_ops { QDF_STATUS (*mgmt_tx_send)(struct wlan_objmgr_vdev *vdev, @@ -83,6 +84,8 @@ struct wlan_lmac_if_mgmt_txrx_tx_ops { void *mgmt_tx_params); QDF_STATUS (*beacon_send)(struct wlan_objmgr_vdev *vdev, qdf_nbuf_t nbuf); + QDF_STATUS (*fd_action_frame_send)(struct wlan_objmgr_vdev *vdev, + qdf_nbuf_t nbuf); }; /** @@ -263,6 +266,21 @@ struct wlan_lmac_if_atf_tx_ops { }; #endif +#ifdef WLAN_SUPPORT_FILS +/** + * struct wlan_lmac_if_fd_tx_ops - FILS Discovery specific Tx function pointers + * @fd_vdev_config_fils: Enable and configure FILS Discovery + * @fd_register_event_handler: Register swfda WMI event handler + * @fd_unregister_event_handler: Un-register swfda WMI event handler + */ +struct wlan_lmac_if_fd_tx_ops { + QDF_STATUS (*fd_vdev_config_fils)(struct wlan_objmgr_vdev *vdev, + uint32_t fd_period); + void (*fd_register_event_handler)(struct wlan_objmgr_psoc *psoc); + void (*fd_unregister_event_handler)(struct wlan_objmgr_psoc *psoc); +}; +#endif + #ifdef WLAN_SA_API_ENABLE /** @@ -638,6 +656,10 @@ struct wlan_lmac_if_tx_ops { #ifdef CONVERGED_TDLS_ENABLE struct wlan_lmac_if_tdls_tx_ops tdls_tx_ops; #endif + +#ifdef WLAN_SUPPORT_FILS + struct wlan_lmac_if_fd_tx_ops fd_tx_ops; +#endif struct wlan_lmac_if_mlme_tx_ops mops; struct wlan_lmac_if_target_tx_ops target_tx_ops; @@ -827,6 +849,24 @@ struct wlan_lmac_if_atf_rx_ops { }; #endif +#ifdef WLAN_SUPPORT_FILS +/** + * struct wlan_lmac_if_fd_rx_ops - FILS Discovery specific Rx function pointers + * @fd_alloc: Allocate FD buffer + * @fd_stop: Stop and free deferred FD buffer + * @fd_free: Free FD frame buffer + * @fd_get_valid_fd_period: Get valid FD period + * @fd_swfda_handler: SWFDA event handler + */ +struct wlan_lmac_if_fd_rx_ops { + void (*fd_alloc)(struct wlan_objmgr_vdev *vdev); + void (*fd_stop)(struct wlan_objmgr_vdev *vdev); + void (*fd_free)(struct wlan_objmgr_vdev *vdev); + uint32_t (*fd_get_valid_fd_period)(struct wlan_objmgr_vdev *vdev); + QDF_STATUS (*fd_swfda_handler)(struct wlan_objmgr_vdev *vdev); +}; +#endif + #ifdef WLAN_SA_API_ENABLE /** @@ -1096,6 +1136,11 @@ struct wlan_lmac_if_rx_ops { #ifdef CONVERGED_TDLS_ENABLE struct wlan_lmac_if_tdls_rx_ops tdls_rx_ops; #endif + +#ifdef WLAN_SUPPORT_FILS + struct wlan_lmac_if_fd_rx_ops fd_rx_ops; +#endif + struct wlan_lmac_if_mlme_rx_ops mops; #ifdef WLAN_SUPPORT_GREEN_AP diff --git a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c index b2670b8acc..245d57a142 100644 --- a/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c +++ b/umac/global_umac_dispatcher/lmac_if/src/wlan_lmac_if.c @@ -58,6 +58,10 @@ #endif #include +#ifdef WLAN_SUPPORT_FILS +#include +#endif + /* Function pointer for OL/WMA specific UMAC tx_ops * registration. */ @@ -122,6 +126,25 @@ wlan_lmac_if_atf_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) } #endif +#ifdef WLAN_SUPPORT_FILS +static void +wlan_lmac_if_fd_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) +{ + struct wlan_lmac_if_fd_rx_ops *fd_rx_ops = &rx_ops->fd_rx_ops; + + fd_rx_ops->fd_alloc = tgt_fd_alloc; + fd_rx_ops->fd_stop = tgt_fd_stop; + fd_rx_ops->fd_free = tgt_fd_free; + fd_rx_ops->fd_get_valid_fd_period = tgt_fd_get_valid_fd_period; + fd_rx_ops->fd_swfda_handler = tgt_fd_swfda_handler; +} +#else +static void +wlan_lmac_if_fd_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) +{ +} +#endif + #ifdef WLAN_SA_API_ENABLE /** * wlan_lmac_if_sa_api_rx_ops_register() - Function to register SA_API RX ops. @@ -406,6 +429,9 @@ wlan_lmac_if_umac_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) /* FTM rx_ops */ wlan_lmac_if_umac_ftm_rx_ops_register(rx_ops); + /* FILS Discovery */ + wlan_lmac_if_fd_rx_ops_register(rx_ops); + return QDF_STATUS_SUCCESS; } diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 9aa0c512b2..f41feac19f 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -1888,6 +1888,7 @@ QDF_STATUS wmi_extract_ndp_end_ind(wmi_unified_t wmi_handle, uint8_t *data, struct nan_datapath_end_indication_event **ind); #endif + /** * wmi_unified_send_btm_config() - Send BTM config to fw * @wmi_hdl: wmi handle @@ -1929,4 +1930,37 @@ QDF_STATUS wmi_unified_extract_obss_detection_info(void *wmi_hdl, struct wmi_obss_detect_info *info); +#ifdef WLAN_SUPPORT_FILS +/** + * wmi_unified_fils_vdev_config_send_cmd() - send FILS config cmd to fw + * @wmi_hdl: wmi handle + * @param: fils config params + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +QDF_STATUS +wmi_unified_fils_vdev_config_send_cmd(void *wmi_hdl, + struct config_fils_params *param); + +/** + * wmi_extract_swfda_vdev_id() - api to extract vdev id + * @wmi_hdl: wmi handle + * @evt_buf: pointer to event buffer + * @vdev_id: pointer to vdev id + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +QDF_STATUS wmi_extract_swfda_vdev_id(void *wmi_hdl, void *evt_buf, + uint32_t *vdev_id); + +/** + * wmi_unified_fils_discovery_send_cmd() - send FILS discovery cmd to fw + * @wmi_hdl: wmi handle + * @param: fils discovery params + * + * Return: QDF_STATUS_SUCCESS for success or error code + */ +QDF_STATUS wmi_unified_fils_discovery_send_cmd(void *wmi_hdl, + struct fd_params *param); +#endif /* WLAN_SUPPORT_FILS */ #endif /* _WMI_UNIFIED_API_H_ */ diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index a84d9e95ce..844792e80b 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -1028,6 +1028,18 @@ struct beacon_params { bool is_high_latency; }; +/** + * struct fd_params - FD cmd parameter + * @vdev_id: vdev id + * @wbuf: FD buffer + * @frame_ctrl: frame control field + */ +struct fd_params { + uint8_t vdev_id; + qdf_nbuf_t wbuf; + uint16_t frame_ctrl; +}; + /** * struct bcn_prb_template_params - beacon probe template parameter * @vdev_id: vdev id @@ -3926,6 +3938,16 @@ struct config_ratemask_params { uint32_t higher32; }; +/** + * struct config_fils_params - FILS config params + * @vdev_id: vdev id + * @fd_period: 0 - Disabled, non-zero - Period in ms (mili seconds) + */ +struct config_fils_params { + uint8_t vdev_id; + uint32_t fd_period; +}; + /** * struct peer_add_wds_entry_params - WDS peer entry add params * @dest_addr: Pointer to destination macaddr @@ -5641,6 +5663,7 @@ typedef enum { wmi_report_stats_event_id, wmi_dma_buf_release_event_id, wmi_sap_obss_detection_report_event_id, + wmi_host_swfda_event_id, wmi_events_max, } wmi_conv_event_id; diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h index 5f426c7b87..2136123d00 100644 --- a/wmi/inc/wmi_unified_priv.h +++ b/wmi/inc/wmi_unified_priv.h @@ -1490,7 +1490,6 @@ QDF_STATUS (*extract_ndp_end_rsp)(wmi_unified_t wmi_handle, uint8_t *data, struct nan_datapath_end_rsp_event **rsp); QDF_STATUS (*extract_ndp_end_ind)(wmi_unified_t wmi_handle, uint8_t *data, struct nan_datapath_end_indication_event **ind); - #endif QDF_STATUS (*send_btm_config)(wmi_unified_t wmi_handle, struct wmi_btm_config *params); @@ -1498,6 +1497,15 @@ QDF_STATUS (*send_obss_detection_cfg_cmd)(wmi_unified_t wmi_handle, struct wmi_obss_detection_cfg_param *obss_cfg_param); QDF_STATUS (*extract_obss_detection_info)(uint8_t *evt_buf, struct wmi_obss_detect_info *info); + +#ifdef WLAN_SUPPORT_FILS +QDF_STATUS (*send_vdev_fils_enable_cmd)(wmi_unified_t wmi_handle, + struct config_fils_params *param); +QDF_STATUS (*extract_swfda_vdev_id)(wmi_unified_t wmi_handle, void *evt_buf, + uint32_t *vdev_id); +QDF_STATUS (*send_fils_discovery_send_cmd)(wmi_unified_t wmi_handle, + struct fd_params *param); +#endif /* WLAN_SUPPORT_FILS */ }; /* Forward declartion for psoc*/ diff --git a/wmi/src/wmi_unified_api.c b/wmi/src/wmi_unified_api.c index 6e265f7504..59d0f8a68a 100644 --- a/wmi/src/wmi_unified_api.c +++ b/wmi/src/wmi_unified_api.c @@ -4158,6 +4158,45 @@ QDF_STATUS wmi_unified_vdev_set_fwtest_param_cmd_send(void *wmi_hdl, return QDF_STATUS_E_FAILURE; } +#ifdef WLAN_SUPPORT_FILS +QDF_STATUS +wmi_unified_fils_discovery_send_cmd(void *wmi_hdl, struct fd_params *param) +{ + wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl; + + if (wmi_handle->ops->send_fils_discovery_send_cmd) + return wmi_handle->ops->send_fils_discovery_send_cmd(wmi_handle, + param); + + return QDF_STATUS_E_FAILURE; +} + +QDF_STATUS +wmi_unified_fils_vdev_config_send_cmd(void *wmi_hdl, + struct config_fils_params *param) +{ + wmi_unified_t wmi = (wmi_unified_t)wmi_hdl; + + if (wmi->ops->send_vdev_fils_enable_cmd) + return wmi->ops->send_vdev_fils_enable_cmd(wmi, param); + + return QDF_STATUS_E_FAILURE; +} + +QDF_STATUS +wmi_extract_swfda_vdev_id(void *wmi_hdl, void *evt_buf, + uint32_t *vdev_id) +{ + wmi_unified_t wmi_handle = (wmi_unified_t)wmi_hdl; + + if (wmi_handle->ops->extract_swfda_vdev_id) + return wmi_handle->ops->extract_swfda_vdev_id(wmi_handle, + evt_buf, vdev_id); + + return QDF_STATUS_E_FAILURE; +} +#endif /* WLAN_SUPPORT_FILS */ + /** * wmi_unified_vdev_config_ratemask_cmd_send() - WMI config ratemask function * @param wmi_handle : handle to WMI. diff --git a/wmi/src/wmi_unified_non_tlv.c b/wmi/src/wmi_unified_non_tlv.c index 57f40578e8..720b3e057f 100644 --- a/wmi/src/wmi_unified_non_tlv.c +++ b/wmi/src/wmi_unified_non_tlv.c @@ -2691,6 +2691,102 @@ static QDF_STATUS send_vdev_spectral_configure_cmd_non_tlv(wmi_unified_t wmi_han return ret; } +#ifdef WLAN_SUPPORT_FILS +/** + * send_fils_discovery_send_cmd_non_tlv() - WMI FILS Discovery send function + * @wmi_handle: handle to WMI + * @param: pointer to hold FD send cmd parameter + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS error code on failure. + */ +static QDF_STATUS +send_fils_discovery_send_cmd_non_tlv(wmi_unified_t wmi_handle, + struct fd_params *param) +{ + wmi_fd_send_from_host_cmd_t *cmd; + wmi_buf_t wmi_buf; + QDF_STATUS status; + int fd_len = qdf_nbuf_len(param->wbuf); + int len = sizeof(wmi_fd_send_from_host_cmd_t); + + wmi_buf = wmi_buf_alloc(wmi_handle, roundup(len, sizeof(u_int32_t))); + if (!wmi_buf) { + WMI_LOGE("wmi_buf_alloc failed\n"); + return QDF_STATUS_E_NOMEM; + } + + cmd = (wmi_fd_send_from_host_cmd_t *)wmi_buf_data(wmi_buf); + cmd->vdev_id = param->vdev_id; + cmd->data_len = fd_len; + cmd->frag_ptr = qdf_nbuf_get_frag_paddr(param->wbuf, 0); + cmd->frame_ctrl = param->frame_ctrl; + status = wmi_unified_cmd_send(wmi_handle, wmi_buf, len, + WMI_PDEV_SEND_FD_CMDID); + if (status != QDF_STATUS_SUCCESS) { + wmi_buf_free(wmi_buf); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +} + +/** + * send_vdev_fils_enable_cmd_non_tlv() - enable/Disable FD Frame command to fw + * @wmi_handle: wmi handle + * @param: pointer to hold FILS discovery enable param + * + * Return: QDF_STATUS_SUCCESS on success or QDF_STATUS error code on failure + */ +static QDF_STATUS +send_vdev_fils_enable_cmd_non_tlv(wmi_unified_t wmi_handle, + struct config_fils_params *param) +{ + wmi_enable_fils_cmd *cmd; + wmi_buf_t buf; + QDF_STATUS status; + int len = sizeof(wmi_enable_fils_cmd); + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + WMI_LOGE("wmi_buf_alloc failed\n"); + return QDF_STATUS_E_FAILURE; + } + cmd = (wmi_enable_fils_cmd *)wmi_buf_data(buf); + cmd->vdev_id = param->vdev_id; + cmd->fd_period = param->fd_period; + WMI_LOGI("Setting FD period to %d vdev id : %d\n", + param->fd_period, param->vdev_id); + + status = wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_ENABLE_FILS_CMDID); + if (status != QDF_STATUS_SUCCESS) { + wmi_buf_free(buf); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +} + +/** + * extract_swfda_vdev_id_non_tlv() - extract swfda vdev id from event + * @wmi_handle: wmi handle + * @evt_buf: pointer to event buffer + * @vdev_id: pointer to hold vdev id + * + * Return: QDF_STATUS_SUCCESS + */ +static QDF_STATUS +extract_swfda_vdev_id_non_tlv(wmi_unified_t wmi_handle, + void *evt_buf, uint32_t *vdev_id) +{ + wmi_host_swfda_event *swfda_event = (wmi_host_swfda_event *)evt_buf; + + *vdev_id = swfda_event->vdev_id; + + return QDF_STATUS_SUCCESS; +} +#endif /* WLAN_SUPPORT_FILS */ + /** * send_vdev_spectral_enable_cmd_non_tlv() - send VDEV spectral configure * command to fw @@ -8449,6 +8545,11 @@ struct wmi_ops non_tlv_ops = { send_dfs_phyerr_offload_dis_cmd_non_tlv, .send_wds_entry_list_cmd = send_wds_entry_list_cmd_non_tlv, .extract_wds_entry = extract_wds_entry_non_tlv, +#ifdef WLAN_SUPPORT_FILS + .send_vdev_fils_enable_cmd = send_vdev_fils_enable_cmd_non_tlv, + .send_fils_discovery_send_cmd = send_fils_discovery_send_cmd_non_tlv, + .extract_swfda_vdev_id = extract_swfda_vdev_id_non_tlv, +#endif /* WLAN_SUPPORT_FILS */ }; /** @@ -8740,6 +8841,7 @@ static void populate_non_tlv_events_id(uint32_t *event_ids) WMI_ATF_PEER_STATS_EVENTID; event_ids[wmi_pdev_wds_entry_list_event_id] = WMI_PDEV_WDS_ENTRY_LIST_EVENTID; + event_ids[wmi_host_swfda_event_id] = WMI_HOST_SWFDA_EVENTID; } /** diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c index b9686117c3..0a883a41a5 100644 --- a/wmi/src/wmi_unified_tlv.c +++ b/wmi/src/wmi_unified_tlv.c @@ -1788,6 +1788,118 @@ static QDF_STATUS send_packet_log_disable_cmd_tlv(wmi_unified_t wmi_handle, } #endif +#ifdef WLAN_SUPPORT_FILS +/** + * extract_swfda_vdev_id_tlv() - extract swfda vdev id from event + * @wmi_handle: wmi handle + * @evt_buf: pointer to event buffer + * @vdev_id: pointer to hold vdev id + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_INVAL on failure + */ +static QDF_STATUS +extract_swfda_vdev_id_tlv(wmi_unified_t wmi_handle, + void *evt_buf, uint32_t *vdev_id) +{ + WMI_HOST_SWFDA_EVENTID_param_tlvs *param_buf; + wmi_host_swfda_event_fixed_param *swfda_event; + + param_buf = (WMI_HOST_SWFDA_EVENTID_param_tlvs *)evt_buf; + if (!param_buf) { + WMI_LOGE("Invalid swfda event buffer"); + return QDF_STATUS_E_INVAL; + } + swfda_event = param_buf->fixed_param; + *vdev_id = swfda_event->vdev_id; + + return QDF_STATUS_SUCCESS; +} + +/** + * send_vdev_fils_enable_cmd_tlv() - enable/Disable FD Frame command to fw + * @wmi_handle: wmi handle + * @param: pointer to hold FILS discovery enable param + * + * Return: QDF_STATUS_SUCCESS on success and QDF_STATUS_E_FAILURE on failure + */ +static QDF_STATUS +send_vdev_fils_enable_cmd_tlv(wmi_unified_t wmi_handle, + struct config_fils_params *param) +{ + wmi_enable_fils_cmd_fixed_param *cmd; + wmi_buf_t buf; + QDF_STATUS status; + uint32_t len = sizeof(wmi_enable_fils_cmd_fixed_param); + + buf = wmi_buf_alloc(wmi_handle, len); + if (!buf) { + WMI_LOGE("%s : wmi_buf_alloc failed\n", __func__); + return QDF_STATUS_E_NOMEM; + } + cmd = (wmi_enable_fils_cmd_fixed_param *)wmi_buf_data(buf); + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_enable_fils_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN( + wmi_enable_fils_cmd_fixed_param)); + cmd->vdev_id = param->vdev_id; + cmd->fd_period = param->fd_period; + WMI_LOGI("Setting FD period to %d vdev id : %d\n", + param->fd_period, param->vdev_id); + + status = wmi_unified_cmd_send(wmi_handle, buf, len, + WMI_ENABLE_FILS_CMDID); + if (status != QDF_STATUS_SUCCESS) { + wmi_buf_free(buf); + return QDF_STATUS_E_FAILURE; + } + + return QDF_STATUS_SUCCESS; +} + +/** + * send_fils_discovery_send_cmd_tlv() - WMI FILS Discovery send function + * @wmi_handle: wmi handle + * @param: pointer to hold FD send cmd parameter + * + * Return : QDF_STATUS_SUCCESS on success and QDF_STATUS_E_NOMEM on failure. + */ +static QDF_STATUS +send_fils_discovery_send_cmd_tlv(wmi_unified_t wmi_handle, + struct fd_params *param) +{ + QDF_STATUS ret; + wmi_fd_send_from_host_cmd_fixed_param *cmd; + wmi_buf_t wmi_buf; + qdf_dma_addr_t dma_addr; + + wmi_buf = wmi_buf_alloc(wmi_handle, sizeof(*cmd)); + if (!wmi_buf) { + WMI_LOGE("%s : wmi_buf_alloc failed\n", __func__); + return QDF_STATUS_E_NOMEM; + } + cmd = (wmi_fd_send_from_host_cmd_fixed_param *)wmi_buf_data(wmi_buf); + WMITLV_SET_HDR(&cmd->tlv_header, + WMITLV_TAG_STRUC_wmi_fd_send_from_host_cmd_fixed_param, + WMITLV_GET_STRUCT_TLVLEN( + wmi_fd_send_from_host_cmd_fixed_param)); + cmd->vdev_id = param->vdev_id; + cmd->data_len = qdf_nbuf_len(param->wbuf); + dma_addr = qdf_nbuf_get_frag_paddr(param->wbuf, 0); + qdf_dmaaddr_to_32s(dma_addr, &cmd->frag_ptr_lo, &cmd->frag_ptr_hi); + cmd->frame_ctrl = param->frame_ctrl; + + ret = wmi_unified_cmd_send(wmi_handle, wmi_buf, sizeof(*cmd), + WMI_PDEV_SEND_FD_CMDID); + if (ret != QDF_STATUS_SUCCESS) { + WMI_LOGE("%s: Failed to send fils discovery frame: %d", + __func__, ret); + wmi_buf_free(wmi_buf); + } + + return ret; +} +#endif /* WLAN_SUPPORT_FILS */ + static QDF_STATUS send_beacon_send_cmd_tlv(wmi_unified_t wmi_handle, struct beacon_params *param) { @@ -21505,6 +21617,11 @@ struct wmi_ops tlv_ops = { .send_btm_config = send_btm_config_cmd_tlv, .send_obss_detection_cfg_cmd = send_obss_detection_cfg_cmd_tlv, .extract_obss_detection_info = extract_obss_detection_info_tlv, +#ifdef WLAN_SUPPORT_FILS + .send_vdev_fils_enable_cmd = send_vdev_fils_enable_cmd_tlv, + .extract_swfda_vdev_id = extract_swfda_vdev_id_tlv, + .send_fils_discovery_send_cmd = send_fils_discovery_send_cmd_tlv, +#endif /* WLAN_SUPPORT_FILS */ }; /** @@ -21785,6 +21902,7 @@ static void populate_tlv_events_id(uint32_t *event_ids) WMI_PDEV_DMA_RING_BUF_RELEASE_EVENTID; event_ids[wmi_sap_obss_detection_report_event_id] = WMI_SAP_OBSS_DETECTION_REPORT_EVENTID; + event_ids[wmi_host_swfda_event_id] = WMI_HOST_SWFDA_EVENTID; } #ifndef CONFIG_MCL