From 9dd3c3e9cbb7ff93573d655b3a6a40ed649c30a6 Mon Sep 17 00:00:00 2001 From: Frank Liu Date: Tue, 11 Apr 2017 22:37:03 +0800 Subject: [PATCH] qcacmn: TDLS component: south interface Add lmac_if layer changes for TDLS Change-Id: Ic842857ce7ebc83d2a22a8a8e23c60df1c3dbfc8 CRs-Fixed: 2011330 --- target_if/core/src/target_if_main.c | 16 ++ target_if/tdls/inc/target_if_tdls.h | 116 ++++++++++++ target_if/tdls/src/target_if_tdls.c | 176 ++++++++++++++++++ .../lmac_if/inc/wlan_lmac_if_def.h | 57 ++++++ .../lmac_if/src/wlan_lmac_if.c | 22 +++ umac/tdls/core/src/wlan_tdls_cmds_process.c | 2 +- .../dispatcher/inc/wlan_tdls_public_structs.h | 56 ++++++ umac/tdls/dispatcher/inc/wlan_tdls_tgt_api.h | 91 +++++++++ umac/tdls/dispatcher/src/wlan_tdls_tgt_api.c | 162 ++++++++++++++++ 9 files changed, 697 insertions(+), 1 deletion(-) create mode 100644 target_if/tdls/inc/target_if_tdls.h create mode 100644 target_if/tdls/src/target_if_tdls.c diff --git a/target_if/core/src/target_if_main.c b/target_if/core/src/target_if_main.c index 4aa64b95ec7f..80e9a667b8ed 100644 --- a/target_if/core/src/target_if_main.c +++ b/target_if/core/src/target_if_main.c @@ -43,6 +43,10 @@ #include "target_if_nan.h" #endif /* WLAN_FEATURE_NAN_CONVERGENCE */ +#ifdef CONVERGED_TDLS_ENABLE +#include "target_if_tdls.h" +#endif + static struct target_if_ctx *g_target_if_ctx; struct target_if_ctx *target_if_get_ctx() @@ -136,6 +140,17 @@ static void target_if_nan_tx_ops_register( } #endif /* WLAN_FEATURE_NAN_CONVERGENCE */ +#ifdef CONVERGED_TDLS_ENABLE +static void target_if_tdls_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops) +{ + target_if_tdls_register_tx_ops(tx_ops); +} +#else +static void target_if_tdls_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops) +{ +} +#endif /* CONVERGED_TDLS_ENABLE */ + static QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) { @@ -154,6 +169,7 @@ QDF_STATUS target_if_register_umac_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) /* call regulatory callback to register tx ops */ target_if_register_regulatory_tx_ops(tx_ops); + target_if_tdls_tx_ops_register(tx_ops); /* Converged UMAC components to register their TX-ops here */ return QDF_STATUS_SUCCESS; } diff --git a/target_if/tdls/inc/target_if_tdls.h b/target_if/tdls/inc/target_if_tdls.h new file mode 100644 index 000000000000..7fe21cdf0c4e --- /dev/null +++ b/target_if/tdls/inc/target_if_tdls.h @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2017 The Linux Foundation. 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 + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: offload lmac interface APIs for tdls + * + */ + +#ifndef __TARGET_IF_TDLS_H__ +#define __TARGET_IF_TDLS_H__ + +struct tdls_info; +struct wlan_objmgr_psoc; +struct tdls_peer_update_state; +struct tdls_channel_switch_params; +struct sta_uapsd_trig_params; + +/** + * target_if_tdls_update_fw_state() - lmac handler to update tdls fw state + * @psoc: psoc object + * @param: tdls state parameter + * + * Return: QDF_STATUS + */ +QDF_STATUS +target_if_tdls_update_fw_state(struct wlan_objmgr_psoc *psoc, + struct tdls_info *param); + +/** + * target_if_tdls_update_peer_state() - lmac handler to update tdls peer state + * @psoc: psoc object + * @peer_params: tdls peer state params + * + * Return: QDF_STATUS + */ +QDF_STATUS +target_if_tdls_update_peer_state(struct wlan_objmgr_psoc *psoc, + struct tdls_peer_update_state *peer_params); + +/** + * target_if_tdls_set_offchan_mode() - lmac handler to set tdls off channel mode + * @psoc: psoc object + * @params: tdls channel swithc params + * + * Return: QDF_STATUS + */ +QDF_STATUS +target_if_tdls_set_offchan_mode(struct wlan_objmgr_psoc *psoc, + struct tdls_channel_switch_params *params); + +/** + * target_if_tdls_set_uapsd() - lmac handler to set uapsd auto trigger cmd + * @psoc: psoc object + * @params: upasd parameters + * + * This function sets the trigger + * uapsd params such as service interval, delay interval + * and suspend interval which will be used by the firmware + * to send trigger frames periodically when there is no + * traffic on the transmit side. + * + * Return: QDF_STATUS + */ +QDF_STATUS +target_if_tdls_set_uapsd(struct wlan_objmgr_psoc *psoc, + struct sta_uapsd_trig_params *params); + +/** + * target_if_tdls_register_event_handler() - lmac handler to register tdls event + * handler + * @psoc : psoc object + * @arg: argument passed to lmac + * + * Return: QDF_STATUS + */ +QDF_STATUS +target_if_tdls_register_event_handler(struct wlan_objmgr_psoc *psoc, + void *arg); + +/** + * target_if_tdls_unregister_event_handler() - lmac handler to unregister tdls + * event handler + * @psoc : psoc object + * @arg: argument passed to lmac + * + * Return: QDF_STATUS + */ +QDF_STATUS +target_if_tdls_unregister_event_handler(struct wlan_objmgr_psoc *psoc, + void *arg); + +/** + * target_if_tdls_register_tx_ops() - lmac handler to register tdls tx ops + * callback functions + * @tx_ops: wlan_lmac_if_tx_ops object + * + * Return: QDF_STATUS + */ +QDF_STATUS +target_if_tdls_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); +#endif diff --git a/target_if/tdls/src/target_if_tdls.c b/target_if/tdls/src/target_if_tdls.c new file mode 100644 index 000000000000..9f304f2bf2b8 --- /dev/null +++ b/target_if/tdls/src/target_if_tdls.c @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2017 The Linux Foundation. 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 + * above copyright notice and this permission notice appear in all + * copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE + * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +/** + * DOC: offload lmac interface APIs for tdls + * + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static inline struct wlan_lmac_if_tdls_rx_ops * +target_if_tdls_get_rx_ops(struct wlan_objmgr_psoc *psoc) +{ + return &psoc->soc_cb.rx_ops.tdls_rx_ops; +} + +static int +target_if_tdls_event_handler(ol_scn_t scn, uint8_t *data, uint32_t datalen) +{ + struct wlan_objmgr_psoc *psoc; + struct wmi_unified *wmi_handle; + struct wlan_lmac_if_tdls_rx_ops *tdls_rx_ops; + struct tdls_event_info info; + QDF_STATUS status; + + if (!scn || !data) { + target_if_err("scn: 0x%p, data: 0x%p", scn, data); + return -EINVAL; + } + psoc = target_if_get_psoc_from_scn_hdl(scn); + if (!psoc) { + target_if_err("null psoc"); + return -EINVAL; + } + wmi_handle = GET_WMI_HDL_FROM_PSOC(psoc); + + if (wmi_extract_vdev_tdls_ev_param(wmi_handle, data, &info)) { + target_if_err("Failed to extract wmi tdls event"); + return -EINVAL; + } + + tdls_rx_ops = target_if_tdls_get_rx_ops(psoc); + if (tdls_rx_ops && tdls_rx_ops->tdls_ev_handler) { + status = tdls_rx_ops->tdls_ev_handler(psoc, &info); + if (QDF_IS_STATUS_ERROR(status)) { + target_if_err("fail to handle tdls event"); + return -EINVAL; + } + } + + return 0; +} + +QDF_STATUS +target_if_tdls_update_fw_state(struct wlan_objmgr_psoc *psoc, + struct tdls_info *param) +{ + QDF_STATUS status; + uint8_t tdls_state; + + if (TDLS_SUPPORT_EXP_TRIG_ONLY == param->tdls_state) + tdls_state = WMI_TDLS_ENABLE_PASSIVE; + else if (TDLS_SUPPORT_IMP_MODE == param->tdls_state || + TDLS_SUPPORT_EXT_CONTROL == param->tdls_state) + tdls_state = WMI_TDLS_ENABLE_CONNECTION_TRACKER_IN_HOST; + else + tdls_state = WMI_TDLS_DISABLE; + + status = wmi_unified_update_fw_tdls_state_cmd(psoc->tgt_if_handle, + param, tdls_state); + + target_if_debug("vdev_id %d", param->vdev_id); + return status; +} + +QDF_STATUS +target_if_tdls_update_peer_state(struct wlan_objmgr_psoc *psoc, + struct tdls_peer_update_state *peer_params) +{ + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +target_if_tdls_set_offchan_mode(struct wlan_objmgr_psoc *psoc, + struct tdls_channel_switch_params *params) +{ + QDF_STATUS status; + + status = wmi_unified_set_tdls_offchan_mode_cmd(psoc->tgt_if_handle, + params); + + return status; +} + +QDF_STATUS +target_if_tdls_set_uapsd(struct wlan_objmgr_psoc *psoc, + struct sta_uapsd_trig_params *params) +{ + QDF_STATUS ret; + + if (!WMI_SERVICE_IS_ENABLED(psoc->service_param.service_bitmap, + WMI_STA_UAPSD_BASIC_AUTO_TRIG) || + !WMI_SERVICE_IS_ENABLED(psoc->service_param.service_bitmap, + WMI_STA_UAPSD_VAR_AUTO_TRIG)) { + target_if_debug("Trigger uapsd is not supported vdev id %d", + params->vdevid); + return QDF_STATUS_SUCCESS; + } + ret = wmi_unified_set_sta_uapsd_auto_trig_cmd(psoc->tgt_if_handle, + params); + + if (QDF_IS_STATUS_ERROR(ret)) + target_if_err("Failed to send set uapsd param ret = %d", ret); + + return ret; +} + +QDF_STATUS +target_if_tdls_register_event_handler(struct wlan_objmgr_psoc *psoc, + void *arg) +{ + return wmi_unified_register_event(psoc->tgt_if_handle, + wmi_tdls_peer_event_id, + target_if_tdls_event_handler); +} + +QDF_STATUS +target_if_tdls_unregister_event_handler(struct wlan_objmgr_psoc *psoc, + void *arg) +{ + return wmi_unified_unregister_event(psoc->tgt_if_handle, + wmi_tdls_peer_event_id); +} + +QDF_STATUS +target_if_tdls_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) +{ + struct wlan_lmac_if_tdls_tx_ops *tdls_txops; + + tdls_txops = &tx_ops->tdls_tx_ops; + + tdls_txops->update_fw_state = target_if_tdls_update_fw_state; + tdls_txops->update_peer_state = target_if_tdls_update_peer_state; + tdls_txops->set_offchan_mode = target_if_tdls_set_offchan_mode; + tdls_txops->tdls_reg_ev_handler = target_if_tdls_register_event_handler; + tdls_txops->tdls_unreg_ev_handler = + target_if_tdls_unregister_event_handler; + tdls_txops->tdls_set_uapsd = target_if_tdls_set_uapsd; + + return QDF_STATUS_SUCCESS; +} 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 d177d675b344..277c53a82283 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 @@ -46,6 +46,10 @@ struct oem_data_rsp; struct scheduler_msg; #endif +#ifdef CONVERGED_TDLS_ENABLE +#include "wlan_tdls_public_structs.h" +#endif + /** * struct wlan_lmac_if_mgmt_txrx_tx_ops - structure of tx function * pointers for mgmt txrx component @@ -350,6 +354,52 @@ struct wlan_lmac_if_wifi_pos_tx_ops { }; #endif +#ifdef CONVERGED_TDLS_ENABLE +/* fwd declarations for tdls tx ops */ +struct tdls_info; +struct tdls_peer_update_state; +struct tdls_channel_switch_params; +struct sta_uapsd_trig_params; +/** + * struct wlan_lmac_if_tdls_tx_ops - south bound tx function pointers for tdls + * @update_fw_state: function to update tdls firmware state + * @update_peer_state: function to update tdls peer state + * @set_offchan_mode: function to set tdls offchannel mode + * @tdls_reg_ev_handler: function to register for tdls events + * @tdls_unreg_ev_handler: function to unregister for tdls events + * @tdls_set_uapsd: function to set upasdt trigger command + * + * tdls module uses these functions to avail ol/da lmac services + */ +struct wlan_lmac_if_tdls_tx_ops { + QDF_STATUS(*update_fw_state)(struct wlan_objmgr_psoc *psoc, + struct tdls_info *req); + QDF_STATUS(*update_peer_state)(struct wlan_objmgr_psoc *psoc, + struct tdls_peer_update_state *param); + QDF_STATUS(*set_offchan_mode)(struct wlan_objmgr_psoc *psoc, + struct tdls_channel_switch_params *param); + QDF_STATUS(*tdls_reg_ev_handler)(struct wlan_objmgr_psoc *psoc, + void *arg); + QDF_STATUS(*tdls_unreg_ev_handler) (struct wlan_objmgr_psoc *psoc, + void *arg); + QDF_STATUS(*tdls_set_uapsd)(struct wlan_objmgr_psoc *psoc, + struct sta_uapsd_trig_params *params); +}; + +/* fwd declarations for tdls rx ops */ +struct tdls_event_info; +/** + * struct wlan_lmac_if_tdls_rx_ops - south bound rx function pointers for tdls + * @tdls_ev_handler: function to handler tdls event + * + * lmac modules uses this API to post scan events to tdls module + */ +struct wlan_lmac_if_tdls_rx_ops { + QDF_STATUS(*tdls_ev_handler)(struct wlan_objmgr_psoc *psoc, + struct tdls_event_info *info); +}; +#endif + #ifdef WLAN_FEATURE_NAN_CONVERGENCE /** * struct wlan_lmac_if_nan_tx_ops - structure of firwware tx function @@ -490,6 +540,10 @@ struct wlan_lmac_if_tx_ops { #endif struct wlan_lmac_if_reg_tx_ops reg_ops; struct wlan_lmac_if_dfs_tx_ops dfs_tx_ops; + +#ifdef CONVERGED_TDLS_ENABLE + struct wlan_lmac_if_tdls_tx_ops tdls_tx_ops; +#endif }; /** @@ -797,6 +851,9 @@ struct wlan_lmac_if_rx_ops { #endif struct wlan_lmac_if_reg_rx_ops reg_rx_ops; struct wlan_lmac_if_dfs_rx_ops dfs_rx_ops; +#ifdef CONVERGED_TDLS_ENABLE + struct wlan_lmac_if_tdls_rx_ops tdls_rx_ops; +#endif }; /* Function pointer to call legacy tx_ops registration in OL/WMA. 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 42494a525c89..58d20716e739 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 @@ -35,6 +35,9 @@ #ifdef CONVERGED_P2P_ENABLE #include "wlan_p2p_tgt_api.h" #endif +#ifdef CONVERGED_TDLS_ENABLE +#include "wlan_tdls_tgt_api.h" +#endif #ifdef WLAN_CONV_CRYPTO_SUPPORTED #include "wlan_crypto_global_api.h" @@ -199,6 +202,22 @@ wlan_lmac_if_umac_dfs_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) } #endif +#ifdef CONVERGED_TDLS_ENABLE +static QDF_STATUS +wlan_lmac_if_umac_tdls_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) +{ + rx_ops->tdls_rx_ops.tdls_ev_handler = tgt_tdls_event_handler; + + return QDF_STATUS_SUCCESS; +} +#else +static QDF_STATUS +wlan_lmac_if_umac_tdls_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) +{ + return QDF_STATUS_SUCCESS; +} +#endif + /** * wlan_lmac_if_umac_rx_ops_register() - UMAC rx handler register * @rx_ops: Pointer to rx_ops structure to be populated @@ -244,6 +263,9 @@ wlan_lmac_if_umac_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) /* wifi_pos rx ops */ wlan_lmac_if_umac_rx_ops_register_wifi_pos(rx_ops); + /* tdls rx ops */ + wlan_lmac_if_umac_tdls_rx_ops_register(rx_ops); + wlan_lmac_if_register_nan_rx_ops(rx_ops); rx_ops->reg_rx_ops.master_list_handler = diff --git a/umac/tdls/core/src/wlan_tdls_cmds_process.c b/umac/tdls/core/src/wlan_tdls_cmds_process.c index 12dde2563df9..4e1f0f0db1f1 100644 --- a/umac/tdls/core/src/wlan_tdls_cmds_process.c +++ b/umac/tdls/core/src/wlan_tdls_cmds_process.c @@ -981,7 +981,7 @@ error: } /** - * tdls_process_add_peer_rsp() - handle response for add TDLS peer + * tdls_add_peer_rsp() - handle response for add TDLS peer * @rsp: TDLS add peer response * * Return: QDF_STATUS_SUCCESS for success; other values if failed diff --git a/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h b/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h index 2f76979be4fb..4fc129ebead3 100644 --- a/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h +++ b/umac/tdls/dispatcher/inc/wlan_tdls_public_structs.h @@ -718,6 +718,62 @@ struct tdls_channel_switch_params { uint8_t is_responder; }; +/** + * enum uapsd_access_cat - U-APSD Access Categories + * @UAPSD_AC_BE: best effort + * @UAPSD_AC_BK: back ground + * @UAPSD_AC_VI: video + * @UAPSD_AC_VO: voice + */ +enum uapsd_access_cat { + UAPSD_AC_BE, + UAPSD_AC_BK, + UAPSD_AC_VI, + UAPSD_AC_VO +}; + +/** + * enum tspec_dir_type - TSPEC Direction type + * @TX_DIR: uplink + * @RX_DIR: downlink + * @BI_DIR: bidirectional + */ +enum tspec_dir_type { + TX_DIR = 0, + RX_DIR = 1, + BI_DIR = 2, +}; + +/** + * struct sta_uapsd_params - uapsd auto trig params + * @wmm_ac: WMM access category from 0 to 3 + * @user_priority: User priority to use in trigger frames + * @service_interval: service interval + * @suspend_interval: suspend interval + * @delay_interval: delay interval + */ +struct sta_uapsd_params { + uint32_t wmm_ac; + uint32_t user_priority; + uint32_t service_interval; + uint32_t suspend_interval; + uint32_t delay_interval; +}; + +/** + * struct sta_uapsd_trig_params - uapsd trigger parameter + * @vdevid: vdev id + * @peer_addr: peer address + * @auto_triggerparam: trigger parameters + * @num_ac: no of access category + */ +struct sta_uapsd_trig_params { + uint32_t vdevid; + uint8_t peer_addr[QDF_MAC_ADDR_SIZE]; + struct sta_uapsd_params *auto_triggerparam; + uint32_t num_ac; +}; + /** * struct tdls_event_info - firmware tdls event * @vdev_id: vdev id diff --git a/umac/tdls/dispatcher/inc/wlan_tdls_tgt_api.h b/umac/tdls/dispatcher/inc/wlan_tdls_tgt_api.h index 78454e0829f4..dbc8c0683f50 100644 --- a/umac/tdls/dispatcher/inc/wlan_tdls_tgt_api.h +++ b/umac/tdls/dispatcher/inc/wlan_tdls_tgt_api.h @@ -21,3 +21,94 @@ * * TDLS south bound interface declaration */ + +#ifndef _WLAN_TDLS_TGT_API_H_ +#define _WLAN_TDLS_TGT_API_H_ +#include +#include "../../core/src/wlan_tdls_main.h" + +/** + * tgt_tdls_set_fw_state() - invoke lmac tdls update fw + * @psoc: soc object + * @tdls_param: update tdls state parameters + * + * Return: QDF_STATUS + */ +QDF_STATUS tgt_tdls_set_fw_state(struct wlan_objmgr_psoc *psoc, + struct tdls_info *tdls_param); + +/** + * tgt_tdls_set_peer_state() - invoke lmac tdls update peer state + * @psoc: soc object + * @peer_param: update tdls peer parameters + * + * Return: QDF_STATUS + */ +QDF_STATUS tgt_tdls_set_peer_state(struct wlan_objmgr_psoc *psoc, + struct tdls_peer_update_state *peer_param); + +/** + * tgt_tdls_set_offchan_mode() - invoke lmac tdls set off-channel mode + * @psoc: soc object + * @param: set tdls off channel parameters + * + * Return: QDF_STATUS + */ +QDF_STATUS tgt_tdls_set_offchan_mode(struct wlan_objmgr_psoc *psoc, + struct tdls_channel_switch_params *param); + +/** + * tgt_tdls_set_uapsd()- invoke lamc tdls set uapsd function + * @psoc: soc object + * @params: uapsd parameters + * + * Return: QDF_STATUS + */ +QDF_STATUS tgt_tdls_set_uapsd(struct wlan_objmgr_psoc *psoc, + struct sta_uapsd_trig_params *params); + +/** + * tgt_tdls_del_peer_rsp() - handle TDLS del peer response + * @pmsg: sheduler msg + * + * Return: QDF_STATUS + */ +QDF_STATUS tgt_tdls_del_peer_rsp(struct scheduler_msg *pmsg); + +/** + * tgt_tdls_add_peer_rsp() - handle TDLS add peer response + * @pmsg: sheduler msg + * + * Return: QDF_STATUS + */ +QDF_STATUS tgt_tdls_add_peer_rsp(struct scheduler_msg *pmsg); + +/** + * tgt_tdls_register_ev_handler() - invoke lmac register tdls event handler + * @psoc: soc object + * + * Return: QDF_STATUS_SUCCESS for success or error code. + */ +QDF_STATUS tgt_tdls_register_ev_handler(struct wlan_objmgr_psoc *psoc); + +/** + * tgt_tdls_unregister_ev_handler() - invoke lmac unregister tdls event handler + * @psoc: soc object + * + * Return: QDF_STATUS_SUCCESS for success or error code. + */ +QDF_STATUS tgt_tdls_unregister_ev_handler(struct wlan_objmgr_psoc *psoc); + +/** + * tgt_tdls_event_handler() - The callback registered to WMI for tdls events + * @psoc: psoc object + * @info: tdls event info + * + * The callback is registered by tgt as tdls rx ops handler. + * + * Return: 0 for success or err code. + */ +QDF_STATUS +tgt_tdls_event_handler(struct wlan_objmgr_psoc *psoc, + struct tdls_event_info *info); +#endif diff --git a/umac/tdls/dispatcher/src/wlan_tdls_tgt_api.c b/umac/tdls/dispatcher/src/wlan_tdls_tgt_api.c index 864886bb4bb9..78a198b2a71f 100644 --- a/umac/tdls/dispatcher/src/wlan_tdls_tgt_api.c +++ b/umac/tdls/dispatcher/src/wlan_tdls_tgt_api.c @@ -21,3 +21,165 @@ * * TDLS south bound interface definitions */ + +#include "qdf_status.h" +#include +#include "../../core/src/wlan_tdls_main.h" +#include "../../core/src/wlan_tdls_cmds_process.h" + +static inline struct wlan_lmac_if_tdls_tx_ops * +wlan_psoc_get_tdls_txops(struct wlan_objmgr_psoc *psoc) +{ + return &psoc->soc_cb.tx_ops.tdls_tx_ops; +} + +static inline struct wlan_lmac_if_tdls_rx_ops * +wlan_psoc_get_tdls_rxops(struct wlan_objmgr_psoc *psoc) +{ + return &psoc->soc_cb.rx_ops.tdls_rx_ops; +} + +QDF_STATUS tgt_tdls_set_fw_state(struct wlan_objmgr_psoc *psoc, + struct tdls_info *tdls_param) +{ + struct wlan_lmac_if_tdls_tx_ops *tdls_ops = NULL; + + tdls_ops = wlan_psoc_get_tdls_txops(psoc); + if (tdls_ops && tdls_ops->update_fw_state) + return tdls_ops->update_fw_state(psoc, tdls_param); + else + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS tgt_tdls_set_peer_state(struct wlan_objmgr_psoc *psoc, + struct tdls_peer_update_state *peer_param) +{ + struct wlan_lmac_if_tdls_tx_ops *tdls_ops = NULL; + + tdls_ops = wlan_psoc_get_tdls_txops(psoc); + if (tdls_ops && tdls_ops->update_peer_state) + return tdls_ops->update_peer_state(psoc, peer_param); + else + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS tgt_tdls_set_offchan_mode(struct wlan_objmgr_psoc *psoc, + struct tdls_channel_switch_params *param) +{ + struct wlan_lmac_if_tdls_tx_ops *tdls_ops = NULL; + + tdls_ops = wlan_psoc_get_tdls_txops(psoc); + if (tdls_ops && tdls_ops->set_offchan_mode) + return tdls_ops->set_offchan_mode(psoc, param); + else + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS tgt_tdls_set_uapsd(struct wlan_objmgr_psoc *psoc, + struct sta_uapsd_trig_params *params) +{ + struct wlan_lmac_if_tdls_tx_ops *tdls_ops = NULL; + + tdls_ops = wlan_psoc_get_tdls_txops(psoc); + if (tdls_ops && tdls_ops->tdls_set_uapsd) + return tdls_ops->tdls_set_uapsd(psoc, params); + else + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS tgt_tdls_add_peer_rsp(struct scheduler_msg *pmsg) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + + if (!pmsg || !pmsg->bodyptr) { + tdls_err("msg: 0x%p", pmsg); + QDF_ASSERT(0); + return QDF_STATUS_E_NULL_VALUE; + } + + status = tdls_process_add_peer_rsp(pmsg->bodyptr); + + return status; +} + +QDF_STATUS tgt_tdls_del_peer_rsp(struct scheduler_msg *pmsg) +{ + QDF_STATUS status = QDF_STATUS_SUCCESS; + + if (!pmsg || !pmsg->bodyptr) { + tdls_err("msg: 0x%p", pmsg); + QDF_ASSERT(0); + return QDF_STATUS_E_NULL_VALUE; + } + + status = tdls_process_del_peer_rsp(pmsg->bodyptr); + + return status; +} + +QDF_STATUS tgt_tdls_register_ev_handler(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_lmac_if_tdls_tx_ops *tdls_ops = NULL; + + tdls_ops = wlan_psoc_get_tdls_txops(psoc); + if (tdls_ops && tdls_ops->tdls_reg_ev_handler) + return tdls_ops->tdls_reg_ev_handler(psoc, NULL); + else + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS tgt_tdls_unregister_ev_handler(struct wlan_objmgr_psoc *psoc) +{ + struct wlan_lmac_if_tdls_tx_ops *tdls_ops = NULL; + + tdls_ops = wlan_psoc_get_tdls_txops(psoc); + if (tdls_ops->tdls_unreg_ev_handler) + return tdls_ops->tdls_unreg_ev_handler(psoc, NULL); + else + return QDF_STATUS_SUCCESS; +} + +QDF_STATUS +tgt_tdls_event_handler(struct wlan_objmgr_psoc *psoc, + struct tdls_event_info *info) +{ + struct scheduler_msg msg = {0,}; + struct tdls_event_notify *notify; + uint8_t vdev_id; + QDF_STATUS status; + + if (!psoc || !info) { + tdls_err("psoc: 0x%p, info: 0x%p", psoc, info); + return QDF_STATUS_E_NULL_VALUE; + } + tdls_debug("vdev: %d, type: %d, reason: %d" QDF_MAC_ADDRESS_STR, + info->vdev_id, info->message_type, info->peer_reason, + QDF_MAC_ADDR_ARRAY(info->peermac.bytes)); + notify = qdf_mem_malloc(sizeof(*notify)); + if (!notify) { + tdls_err("mem allocate fail"); + return QDF_STATUS_E_NOMEM; + } + + vdev_id = info->vdev_id; + notify->vdev = + wlan_objmgr_get_vdev_by_id_from_psoc(psoc, + vdev_id, WLAN_TDLS_SB_ID); + if (!notify->vdev) { + tdls_err("null vdev, vdev_id: %d, psoc: 0x%p", vdev_id, psoc); + return QDF_STATUS_E_INVAL; + } + qdf_mem_copy(¬ify->event, info, sizeof(*info)); + + msg.bodyptr = notify; + msg.callback = tdls_process_evt; + + status = scheduler_post_msg(QDF_MODULE_ID_TARGET_IF, &msg); + if (QDF_IS_STATUS_ERROR(status)) { + tdls_err("can't post msg to handle tdls event"); + wlan_objmgr_vdev_release_ref(notify->vdev, WLAN_TDLS_SB_ID); + qdf_mem_free(notify); + } + + return status; +}