diff --git a/Kbuild b/Kbuild index 157c6961fb19..d1a6154f0bc3 100644 --- a/Kbuild +++ b/Kbuild @@ -1365,19 +1365,19 @@ CP_STATS_OBJS := $(CP_STATS_TGT_SRC)/target_if_mc_cp_stats.o \ endif ######################### NAN ######################### -NAN_CORE_DIR := $(WLAN_COMMON_ROOT)/umac/nan/core/src -NAN_CORE_INC := -I$(WLAN_COMMON_INC)/umac/nan/core/inc -NAN_UCFG_DIR := $(WLAN_COMMON_ROOT)/umac/nan/dispatcher/src -NAN_UCFG_INC := -I$(WLAN_COMMON_INC)/umac/nan/dispatcher/inc -NAN_TGT_DIR := $(WLAN_COMMON_ROOT)/target_if/nan/src -NAN_TGT_INC := -I$(WLAN_COMMON_INC)/target_if/nan/inc -NAN_OS_IF_DIR := $(WLAN_COMMON_ROOT)/os_if/linux/nan/src -NAN_OS_IF_INC := -I$(WLAN_COMMON_INC)/os_if/linux/nan/inc +NAN_CORE_DIR := components/nan/core/src +NAN_CORE_INC := -I$(WLAN_ROOT)/components/nan/core/inc +NAN_UCFG_DIR := components/nan/dispatcher/src +NAN_UCFG_INC := -I$(WLAN_ROOT)/components/nan/dispatcher/inc +NAN_TGT_DIR := components/target_if/nan/src +NAN_TGT_INC := -I$(WLAN_ROOT)/components/target_if/nan/inc + +NAN_OS_IF_DIR := os_if/nan/src +NAN_OS_IF_INC := -I$(WLAN_ROOT)/os_if/nan/inc ifeq ($(CONFIG_NAN_CONVERGENCE), y) WLAN_NAN_OBJS := $(NAN_CORE_DIR)/nan_main.o \ $(NAN_CORE_DIR)/nan_api.o \ - $(NAN_CORE_DIR)/nan_utils.o \ $(NAN_UCFG_DIR)/nan_ucfg_api.o \ $(NAN_UCFG_DIR)/cfg_nan.o \ $(NAN_TGT_DIR)/target_if_nan.o \ diff --git a/components/nan/core/inc/nan_public_structs.h b/components/nan/core/inc/nan_public_structs.h index 2a32ffd49dd1..2af9af935fd3 100644 --- a/components/nan/core/inc/nan_public_structs.h +++ b/components/nan/core/inc/nan_public_structs.h @@ -26,6 +26,7 @@ #include "qdf_types.h" #include "qdf_status.h" +#include "scheduler_api.h" struct wlan_objmgr_psoc; struct wlan_objmgr_vdev; @@ -133,7 +134,6 @@ enum nan_datapath_reason_code { * @NAN_DATAPATH_RESPONSE_REJECT: ndp request rejected * @NAN_DATAPATH_RESPONSE_DEFER: ndp request deferred until later (response to * follow any time later) - * */ enum nan_datapath_response_code { NAN_DATAPATH_RESPONSE_ACCEPT = 0, @@ -145,7 +145,6 @@ enum nan_datapath_response_code { * enum nan_datapath_accept_policy - nan data path accept policy * @NAN_DATAPATH_ACCEPT_POLICY_NONE: the framework will decide the policy * @NAN_DATAPATH_ACCEPT_POLICY_ALL: accept policy offloaded to fw - * */ enum nan_datapath_accept_policy { NAN_DATAPATH_ACCEPT_POLICY_NONE = 0, @@ -156,7 +155,6 @@ enum nan_datapath_accept_policy { * enum nan_datapath_self_role - nan data path role * @NAN_DATAPATH_ROLE_INITIATOR: initiator of nan data path request * @NAN_DATAPATH_ROLE_RESPONDER: responder to nan data path request - * */ enum nan_datapath_self_role { NAN_DATAPATH_ROLE_INITIATOR = 0, @@ -168,7 +166,6 @@ enum nan_datapath_self_role { * @NAN_DATAPATH_END_TYPE_UNSPECIFIED: type is unspecified * @NAN_DATAPATH_END_TYPE_PEER_UNAVAILABLE: type is peer unavailable * @NAN_DATAPATH_END_TYPE_OTA_FRAME: NDP end frame received from peer - * */ enum nan_datapath_end_type { NAN_DATAPATH_END_TYPE_UNSPECIFIED = 0x00, @@ -182,7 +179,6 @@ enum nan_datapath_end_type { * @NAN_DATAPATH_END_REASON_INACTIVITY: reason is peer inactivity * @NAN_DATAPATH_END_REASON_PEER_DATA_END: data end indication received from * peer - * */ enum nan_datapath_end_reason_code { NAN_DATAPATH_END_REASON_UNSPECIFIED = 0x00, @@ -190,7 +186,8 @@ enum nan_datapath_end_reason_code { NAN_DATAPATH_END_REASON_PEER_DATA_END = 0x02, }; -/** enum nan_datapath_state - NAN datapath states +/** + * enum nan_datapath_state - NAN datapath states * @NAN_DATA_NDI_CREATING_STATE: NDI create is in progress * @NAN_DATA_NDI_CREATED_STATE: NDI successfully crated * @NAN_DATA_NDI_DELETING_STATE: NDI delete is in progress @@ -220,7 +217,6 @@ enum nan_datapath_state { * struct nan_datapath_app_info - application info shared during ndp setup * @ndp_app_info_len: ndp app info length * @ndp_app_info: variable length application information - * */ struct nan_datapath_app_info { uint32_t ndp_app_info_len; @@ -231,7 +227,6 @@ struct nan_datapath_app_info { * struct nan_datapath_cfg - ndp configuration * @ndp_cfg_len: ndp configuration length * @ndp_cfg: variable length ndp configuration - * */ struct nan_datapath_cfg { uint32_t ndp_cfg_len; @@ -242,7 +237,6 @@ struct nan_datapath_cfg { * struct nan_datapath_pmk - structure to hold pairwise master key * @pmk_len: length of pairwise master key * @pmk: buffer containing pairwise master key - * */ struct nan_datapath_pmk { uint32_t pmk_len; @@ -253,7 +247,6 @@ struct nan_datapath_pmk { * struct nan_datapath_scid - structure to hold sceurity context identifier * @scid_len: length of scid * @scid: scid - * */ struct nan_datapath_scid { uint32_t scid_len; @@ -264,7 +257,6 @@ struct nan_datapath_scid { * struct ndp_passphrase - structure to hold passphrase * @passphrase_len: length of passphrase * @passphrase: buffer containing passphrase - * */ struct ndp_passphrase { uint32_t passphrase_len; @@ -275,7 +267,6 @@ struct ndp_passphrase { * struct ndp_service_name - structure to hold service_name * @service_name_len: length of service_name * @service_name: buffer containing service_name - * */ struct ndp_service_name { uint32_t service_name_len; @@ -290,7 +281,6 @@ struct ndp_service_name { * @type: NDP end indication type * @reason_code: NDP end indication reason code * @ndp_instance_id: NDP instance ID - * */ struct peer_nan_datapath_map { uint32_t vdev_id; @@ -306,7 +296,6 @@ struct peer_nan_datapath_map { * @channel: channel freq in mhz of the ndp connection * @ch_width: channel width (wmi_channel_width) of the ndp connection * @nss: nss used for ndp connection - * */ struct nan_datapath_channel_info { uint32_t channel; @@ -321,18 +310,16 @@ struct nan_datapath_channel_info { * struct nan_datapath_inf_create_req - ndi create request params * @transaction_id: unique identifier * @iface_name: interface name - * */ struct nan_datapath_inf_create_req { uint32_t transaction_id; char iface_name[IFACE_NAME_SIZE]; }; -/* +/** * struct nan_datapath_inf_create_rsp - ndi create response params * @status: request status * @reason: reason if any - * */ struct nan_datapath_inf_create_rsp { uint32_t status; @@ -344,7 +331,6 @@ struct nan_datapath_inf_create_rsp { * struct nan_datapath_inf_delete_rsp - ndi delete response params * @status: request status * @reason: reason if any - * */ struct nan_datapath_inf_delete_rsp { uint32_t status; @@ -394,7 +380,6 @@ struct nan_datapath_initiator_req { * @ndp_instance_id: locally created NDP instance ID * @status: status of the ndp request * @reason: reason for failure if any - * */ struct nan_datapath_initiator_rsp { struct wlan_objmgr_vdev *vdev; @@ -423,7 +408,6 @@ struct nan_datapath_initiator_rsp { * @port: port specified by for this NDP * @is_protocol_present: indicates if following protocol is valid * @protocol: protocol used by this NDP - * */ struct nan_datapath_responder_req { struct wlan_objmgr_vdev *vdev; @@ -468,7 +452,6 @@ struct nan_datapath_responder_rsp { * @transaction_id: unique transaction identifier * @num_ndp_instances: number of ndp instances to be terminated * @ndp_ids: array of ndp_instance_id to be terminated - * */ struct nan_datapath_end_req { struct wlan_objmgr_vdev *vdev; @@ -483,7 +466,6 @@ struct nan_datapath_end_req { * @transaction_id: unique identifier for the request * @status: status of operation * @reason: reason(opaque to host driver) - * */ struct nan_datapath_end_rsp_event { struct wlan_objmgr_vdev *vdev; @@ -498,7 +480,6 @@ struct nan_datapath_end_rsp_event { * @vdev: pointer to vdev object * @num_ndp_ids: number of NDP ids * @ndp_map: mapping of NDP instances to peer and vdev - * */ struct nan_datapath_end_indication_event { struct wlan_objmgr_vdev *vdev; @@ -523,7 +504,6 @@ struct nan_datapath_end_indication_event { * @port: port specified by for this NDP * @is_protocol_present: indicates if following protocol is valid * @protocol: protocol used by this NDP - * */ struct nan_datapath_confirm_event { struct wlan_objmgr_vdev *vdev; @@ -559,7 +539,6 @@ struct nan_datapath_confirm_event { * @scid: security context identifier * @is_ipv6_addr_present: indicates if following ipv6 address is valid * @ipv6_addr: ipv6 address address used by ndp - * */ struct nan_datapath_indication_event { struct wlan_objmgr_vdev *vdev; @@ -597,7 +576,6 @@ struct nan_datapath_peer_ind { * @num_ndp_instances: num of ndp instances * @ch: channel info array * @ndp_instances: array of ndp instances - * */ struct nan_datapath_sch_update_event { struct wlan_objmgr_vdev *vdev; @@ -611,7 +589,19 @@ struct nan_datapath_sch_update_event { /** * struct nan_callbacks - struct containing callback to non-converged driver - * + * @os_if_event_handler: OS IF Callback for handling the events + * @ndi_open: HDD callback for creating the NAN Datapath Interface + * @ndi_start: HDD callback for starting the NAN Datapath Interface + * @ndi_close: HDD callback for closing the NAN Datapath Interface + * @ndi_delete: HDD callback for deleting the NAN Datapath Interface + * @drv_ndi_create_rsp_handler: HDD callback for handling NDI interface creation + * @drv_ndi_delete_rsp_handler: HDD callback for handling NDI interface deletion + * @new_peer_ind: HDD callback for handling new NDP peer + * @get_peer_idx: HDD callback for getting NDP peer index + * @add_ndi_peer: LIM callback for adding NDP peer + * @peer_departed_ind: HDD callback for handling departing of NDP peer + * @ndp_delete_peers: LIM callback for deleting NDP peer + * @delete_peers_by_addr: LIM callback for deleting peer by MAC address */ struct nan_callbacks { /* callback to os_if layer from umac */ @@ -635,5 +625,21 @@ struct nan_callbacks { void (*delete_peers_by_addr)(uint8_t, struct qdf_mac_addr); }; +/** + * struct wlan_nan_tx_ops - structure of tx function pointers for nan component + * @nan_req_tx: Message handler for TX operations for the NAN Datapath + */ +struct wlan_nan_tx_ops { + QDF_STATUS (*nan_req_tx)(void *req, uint32_t req_id); +}; + +/** + * struct wlan_nan_rx_ops - structure of rx function pointers for nan component + * @nan_event_rx: Event handler for RX operations for the NAN Datapath + */ +struct wlan_nan_rx_ops { + QDF_STATUS (*nan_event_rx)(struct scheduler_msg *event); +}; + #endif #endif /* WLAN_FEATURE_NAN_CONVERGENCE */ diff --git a/components/nan/core/inc/wlan_nan_api.h b/components/nan/core/inc/wlan_nan_api.h index e2bc40f3fcde..09f2c6c3b156 100644 --- a/components/nan/core/inc/wlan_nan_api.h +++ b/components/nan/core/inc/wlan_nan_api.h @@ -22,8 +22,12 @@ #ifndef _WLAN_NAN_API_H_ #define _WLAN_NAN_API_H_ +#ifdef WLAN_FEATURE_NAN_CONVERGENCE +#include "wlan_objmgr_vdev_obj.h" +#include "wlan_objmgr_psoc_obj.h" #include "qdf_status.h" +#include "../src/nan_main_i.h" struct wlan_objmgr_psoc; @@ -57,4 +61,115 @@ QDF_STATUS nan_psoc_enable(struct wlan_objmgr_psoc *psoc); */ QDF_STATUS nan_psoc_disable(struct wlan_objmgr_psoc *psoc); -#endif +/** + * nan_get_vdev_priv_obj: get NAN priv object from vdev object + * @vdev: pointer to vdev object + * + * Return: pointer to NAN vdev private object + */ +static inline +struct nan_vdev_priv_obj *nan_get_vdev_priv_obj(struct wlan_objmgr_vdev *vdev) +{ + struct nan_vdev_priv_obj *obj; + + if (!vdev) { + nan_err("vdev is null"); + return NULL; + } + obj = wlan_objmgr_vdev_get_comp_private_obj(vdev, WLAN_UMAC_COMP_NAN); + + return obj; +} + +/** + * nan_get_psoc_priv_obj: get NAN priv object from psoc object + * @psoc: pointer to psoc object + * + * Return: pointer to NAN psoc private object + */ +static inline +struct nan_psoc_priv_obj *nan_get_psoc_priv_obj(struct wlan_objmgr_psoc *psoc) +{ + struct nan_psoc_priv_obj *obj; + + if (!psoc) { + nan_err("psoc is null"); + return NULL; + } + obj = wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_NAN); + + return obj; +} + +/** + * nan_psoc_get_tx_ops: get TX ops from the NAN private object + * @psoc: pointer to psoc object + * + * Return: pointer to TX op callback + */ +static inline +struct wlan_nan_tx_ops *nan_psoc_get_tx_ops(struct wlan_objmgr_psoc *psoc) +{ + struct nan_psoc_priv_obj *nan_priv; + + if (!psoc) { + nan_err("psoc is null"); + return NULL; + } + + nan_priv = nan_get_psoc_priv_obj(psoc); + if (!nan_priv) { + nan_err("psoc private object is null"); + return NULL; + } + + return &nan_priv->tx_ops; +} + +/** + * nan_psoc_get_rx_ops: get RX ops from the NAN private object + * @psoc: pointer to psoc object + * + * Return: pointer to RX op callback + */ +static inline +struct wlan_nan_rx_ops *nan_psoc_get_rx_ops(struct wlan_objmgr_psoc *psoc) +{ + struct nan_psoc_priv_obj *nan_priv; + + if (!psoc) { + nan_err("psoc is null"); + return NULL; + } + + nan_priv = nan_get_psoc_priv_obj(psoc); + if (!nan_priv) { + nan_err("psoc private object is null"); + return NULL; + } + + return &nan_priv->rx_ops; +} +#else /* WLAN_FEATURE_NAN_CONVERGENCE */ +static inline QDF_STATUS nan_init(void) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS nan_deinit(void) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS nan_psoc_enable(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS nan_psoc_disable(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} + +#endif /* WLAN_FEATURE_NAN_CONVERGENCE */ +#endif /* _WLAN_NAN_API_H_ */ diff --git a/components/nan/core/src/nan_api.c b/components/nan/core/src/nan_api.c index 4e03a12dbf86..8e435faa120a 100644 --- a/components/nan/core/src/nan_api.c +++ b/components/nan/core/src/nan_api.c @@ -105,6 +105,8 @@ static QDF_STATUS nan_psoc_obj_created_notification( nan_cfg_init(psoc, nan_obj); nan_cfg_dp_init(psoc, nan_obj); + target_if_nan_register_tx_ops(&nan_obj->tx_ops); + target_if_nan_register_rx_ops(&nan_obj->rx_ops); return QDF_STATUS_SUCCESS; diff --git a/components/nan/core/src/nan_main.c b/components/nan/core/src/nan_main.c index eef744fd80f5..daf0bbe8c9a2 100644 --- a/components/nan/core/src/nan_main.c +++ b/components/nan/core/src/nan_main.c @@ -20,7 +20,6 @@ * DOC: contains core nan function definitions */ -#include "nan_main_i.h" #include "nan_ucfg_api.h" #include "wlan_nan_api.h" #include "target_if_nan.h" @@ -32,33 +31,6 @@ #include "wlan_objmgr_pdev_obj.h" #include "wlan_objmgr_vdev_obj.h" -struct nan_vdev_priv_obj *nan_get_vdev_priv_obj( - struct wlan_objmgr_vdev *vdev) -{ - struct nan_vdev_priv_obj *obj; - - if (!vdev) { - nan_err("vdev is null"); - return NULL; - } - obj = wlan_objmgr_vdev_get_comp_private_obj(vdev, WLAN_UMAC_COMP_NAN); - - return obj; -} - -struct nan_psoc_priv_obj *nan_get_psoc_priv_obj( - struct wlan_objmgr_psoc *psoc) -{ - struct nan_psoc_priv_obj *obj; - - if (!psoc) { - nan_err("psoc is null"); - return NULL; - } - obj = wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_NAN); - - return obj; -} void nan_release_cmd(void *in_req, uint32_t cmdtype) { @@ -109,7 +81,8 @@ static void nan_req_activated(void *in_req, uint32_t cmdtype) uint32_t req_type; struct wlan_objmgr_psoc *psoc; struct wlan_objmgr_vdev *vdev; - struct wlan_lmac_if_nan_tx_ops *tx_ops; + struct wlan_nan_tx_ops *tx_ops; + struct nan_psoc_priv_obj *psoc_nan_obj; switch (cmdtype) { case WLAN_SER_CMD_NDP_INIT_REQ: { @@ -149,7 +122,13 @@ static void nan_req_activated(void *in_req, uint32_t cmdtype) return; } - tx_ops = target_if_nan_get_tx_ops(psoc); + psoc_nan_obj = nan_get_psoc_priv_obj(psoc); + if (!psoc_nan_obj) { + nan_err("psoc_nan_obj is null"); + return; + } + + tx_ops = &psoc_nan_obj->tx_ops; if (!tx_ops) { nan_alert("tx_ops is null"); return; diff --git a/components/nan/core/src/nan_main_i.h b/components/nan/core/src/nan_main_i.h index 07f1619951ed..d19d66d92d7d 100644 --- a/components/nan/core/src/nan_main_i.h +++ b/components/nan/core/src/nan_main_i.h @@ -21,6 +21,7 @@ * used in NAN modules */ +#ifdef WLAN_FEATURE_NAN_CONVERGENCE #ifndef _WLAN_NAN_MAIN_I_H_ #define _WLAN_NAN_MAIN_I_H_ @@ -88,6 +89,8 @@ struct nan_psoc_priv_obj { qdf_spinlock_t lock; struct nan_callbacks cb_obj; struct nan_cfg_params cfg_param; + struct wlan_nan_tx_ops tx_ops; + struct wlan_nan_rx_ops rx_ops; }; /** @@ -113,22 +116,6 @@ struct nan_vdev_priv_obj { uint32_t ndi_delete_rsp_status; }; -/** - * nan_get_vdev_priv_obj: get NAN priv object from vdev object - * @vdev: pointer to vdev object - * - * Return: pointer to NAN vdev private object - */ -struct nan_vdev_priv_obj *nan_get_vdev_priv_obj(struct wlan_objmgr_vdev *vdev); - -/** - * nan_get_psoc_priv_obj: get NAN priv object from psoc object - * @psoc: pointer to psoc object - * - * Return: pointer to NAN psoc private object - */ -struct nan_psoc_priv_obj *nan_get_psoc_priv_obj(struct wlan_objmgr_psoc *psoc); - /** * nan_release_cmd: frees resources for NAN command. * @in_req: pointer to msg buffer to be freed @@ -155,4 +142,5 @@ QDF_STATUS nan_scheduled_msg_handler(struct scheduler_msg *msg); */ QDF_STATUS nan_event_handler(struct scheduler_msg *msg); -#endif +#endif /* _WLAN_NAN_MAIN_I_H_ */ +#endif /* WLAN_FEATURE_NAN_CONVERGENCE */ diff --git a/components/nan/dispatcher/src/nan_ucfg_api.c b/components/nan/dispatcher/src/nan_ucfg_api.c index b196ae30bfba..b92e5713b163 100644 --- a/components/nan/dispatcher/src/nan_ucfg_api.c +++ b/components/nan/dispatcher/src/nan_ucfg_api.c @@ -22,6 +22,7 @@ #include "nan_ucfg_api.h" #include "nan_public_structs.h" +#include "wlan_nan_api.h" #include "../../core/src/nan_main_i.h" #include "scheduler_api.h" #include "wlan_objmgr_psoc_obj.h" diff --git a/components/target_if/nan/inc/target_if_nan.h b/components/target_if/nan/inc/target_if_nan.h index 45109e3869f3..b23a6a8e6c6c 100644 --- a/components/target_if/nan/inc/target_if_nan.h +++ b/components/target_if/nan/inc/target_if_nan.h @@ -33,12 +33,9 @@ #include #include #include -#include +#include "nan_public_structs.h" struct wlan_objmgr_psoc; -struct wlan_lmac_if_rx_ops; -struct wlan_lmac_if_tx_ops; -struct wlan_lmac_if_nan_rx_ops; /** * target_if_nan_get_tx_ops() - retrieve the nan tx_ops @@ -48,8 +45,7 @@ struct wlan_lmac_if_nan_rx_ops; * * Return: nan tx_ops pointer */ -struct wlan_lmac_if_nan_tx_ops *target_if_nan_get_tx_ops( - struct wlan_objmgr_psoc *psoc); +struct wlan_nan_tx_ops *target_if_nan_get_tx_ops(struct wlan_objmgr_psoc *psoc); /** * target_if_nan_get_rx_ops() - retrieve the nan rx_ops @@ -59,8 +55,7 @@ struct wlan_lmac_if_nan_tx_ops *target_if_nan_get_tx_ops( * * Return: nan rx_ops pointer */ -struct wlan_lmac_if_nan_rx_ops *target_if_nan_get_rx_ops( - struct wlan_objmgr_psoc *psoc); +struct wlan_nan_rx_ops *target_if_nan_get_rx_ops(struct wlan_objmgr_psoc *psoc); /** * target_if_nan_register_tx_ops() - registers nan tx ops @@ -68,7 +63,7 @@ struct wlan_lmac_if_nan_rx_ops *target_if_nan_get_rx_ops( * * Return: none */ -void target_if_nan_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); +void target_if_nan_register_tx_ops(struct wlan_nan_tx_ops *tx_ops); /** * target_if_nan_register_rx_ops() - registers nan rx ops @@ -76,7 +71,7 @@ void target_if_nan_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); * * Return: none */ -void target_if_nan_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops); +void target_if_nan_register_rx_ops(struct wlan_nan_rx_ops *rx_ops); /** * target_if_nan_register_events() - registers with NDP events diff --git a/components/target_if/nan/src/target_if_nan.c b/components/target_if/nan/src/target_if_nan.c index abb5eec245a9..02da1518f69a 100644 --- a/components/target_if/nan/src/target_if_nan.c +++ b/components/target_if/nan/src/target_if_nan.c @@ -20,10 +20,11 @@ * DOC: contains nan target if functions */ -#include "../../../umac/nan/core/src/nan_main_i.h" +#include "../../../nan/core/src/nan_main_i.h" #include "nan_public_structs.h" #include "nan_ucfg_api.h" #include "target_if_nan.h" +#include "wlan_nan_api.h" #include "wmi_unified_api.h" #include "scheduler_api.h" @@ -72,7 +73,7 @@ static QDF_STATUS target_if_nan_event_dispatcher(struct scheduler_msg *msg) void *ptr = msg->bodyptr; struct wlan_objmgr_psoc *psoc; struct wlan_objmgr_vdev *vdev = NULL; - struct wlan_lmac_if_nan_rx_ops *nan_rx_ops; + struct wlan_nan_rx_ops *nan_rx_ops; switch (msg->type) { case NDP_INITIATOR_RSP: @@ -115,7 +116,7 @@ static QDF_STATUS target_if_nan_event_dispatcher(struct scheduler_msg *msg) goto free_res; } - nan_rx_ops = target_if_nan_get_rx_ops(psoc); + nan_rx_ops = nan_psoc_get_rx_ops(psoc); if (!nan_rx_ops) { target_if_err("nan_rx_ops is null"); status = QDF_STATUS_E_NULL_VALUE; @@ -138,7 +139,7 @@ static QDF_STATUS target_if_nan_ndp_initiator_req( struct wmi_unified *wmi_handle; struct wlan_objmgr_psoc *psoc; struct scheduler_msg pe_msg = {0}; - struct wlan_lmac_if_nan_rx_ops *nan_rx_ops; + struct wlan_nan_rx_ops *nan_rx_ops; struct nan_datapath_initiator_rsp ndp_rsp = {0}; if (!ndp_req) { @@ -158,7 +159,7 @@ static QDF_STATUS target_if_nan_ndp_initiator_req( return QDF_STATUS_E_INVAL; } - nan_rx_ops = target_if_nan_get_rx_ops(psoc); + nan_rx_ops = nan_psoc_get_rx_ops(psoc); if (!nan_rx_ops) { target_if_err("nan_rx_ops is null."); return QDF_STATUS_E_INVAL; @@ -340,7 +341,7 @@ static QDF_STATUS target_if_nan_ndp_responder_req( struct wmi_unified *wmi_handle; struct wlan_objmgr_psoc *psoc; struct scheduler_msg pe_msg = {0}; - struct wlan_lmac_if_nan_rx_ops *nan_rx_ops; + struct wlan_nan_rx_ops *nan_rx_ops; struct nan_datapath_responder_rsp rsp = {0}; if (!req) { @@ -360,7 +361,7 @@ static QDF_STATUS target_if_nan_ndp_responder_req( return QDF_STATUS_E_NULL_VALUE; } - nan_rx_ops = target_if_nan_get_rx_ops(psoc); + nan_rx_ops = nan_psoc_get_rx_ops(psoc); if (!nan_rx_ops) { target_if_err("nan_rx_ops is null."); return QDF_STATUS_E_NULL_VALUE; @@ -439,7 +440,7 @@ static QDF_STATUS target_if_nan_ndp_end_req(struct nan_datapath_end_req *req) struct wmi_unified *wmi_handle; struct wlan_objmgr_psoc *psoc; struct scheduler_msg msg = {0}; - struct wlan_lmac_if_nan_rx_ops *nan_rx_ops; + struct wlan_nan_rx_ops *nan_rx_ops; struct nan_datapath_end_rsp_event end_rsp = {0}; if (!req) { @@ -459,7 +460,7 @@ static QDF_STATUS target_if_nan_ndp_end_req(struct nan_datapath_end_req *req) return QDF_STATUS_E_NULL_VALUE; } - nan_rx_ops = target_if_nan_get_rx_ops(psoc); + nan_rx_ops = nan_psoc_get_rx_ops(psoc); if (!nan_rx_ops) { target_if_err("nan_rx_ops is null."); return QDF_STATUS_E_NULL_VALUE; @@ -656,36 +657,14 @@ static QDF_STATUS target_if_nan_req(void *req, uint32_t req_type) return QDF_STATUS_SUCCESS; } -void target_if_nan_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) +void target_if_nan_register_tx_ops(struct wlan_nan_tx_ops *tx_ops) { - tx_ops->nan_tx_ops.nan_req_tx = target_if_nan_req; + tx_ops->nan_req_tx = target_if_nan_req; } -void target_if_nan_register_rx_ops(struct wlan_lmac_if_rx_ops *rx_ops) +void target_if_nan_register_rx_ops(struct wlan_nan_rx_ops *rx_ops) { - rx_ops->nan_rx_ops.nan_event_rx = nan_event_handler; -} - -inline struct wlan_lmac_if_nan_tx_ops *target_if_nan_get_tx_ops( - struct wlan_objmgr_psoc *psoc) -{ - if (!psoc) { - target_if_err("psoc is null"); - return NULL; - } - - return &psoc->soc_cb.tx_ops.nan_tx_ops; -} - -inline struct wlan_lmac_if_nan_rx_ops *target_if_nan_get_rx_ops( - struct wlan_objmgr_psoc *psoc) -{ - if (!psoc) { - target_if_err("psoc is null"); - return NULL; - } - - return &psoc->soc_cb.rx_ops.nan_rx_ops; + rx_ops->nan_event_rx = nan_event_handler; } QDF_STATUS target_if_nan_register_events(struct wlan_objmgr_psoc *psoc) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index b0ad68fc1934..7f5b17d330ee 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -108,6 +108,7 @@ #include #include "wlan_hdd_lpass.h" #include "nan_api.h" +#include "wlan_nan_api.h" #include #include "wlan_hdd_disa.h" #include @@ -12905,8 +12906,14 @@ static QDF_STATUS hdd_component_init(void) if (QDF_IS_STATUS_ERROR(status)) goto ipa_deinit; + status = nan_init(); + if (QDF_IS_STATUS_ERROR(status)) + goto action_oui_deinit; + return QDF_STATUS_SUCCESS; +action_oui_deinit: + ucfg_action_oui_deinit(); ipa_deinit: ipa_deinit(); ocb_deinit: @@ -12933,6 +12940,7 @@ dispatcher_deinit: static void hdd_component_deinit(void) { /* deinitialize non-converged components */ + nan_deinit(); ucfg_action_oui_deinit(); ipa_deinit(); ucfg_ocb_deinit(); @@ -12989,10 +12997,12 @@ void hdd_component_psoc_enable(struct wlan_objmgr_psoc *psoc) { ocb_psoc_enable(psoc); disa_psoc_enable(psoc); + nan_psoc_enable(psoc); } void hdd_component_psoc_disable(struct wlan_objmgr_psoc *psoc) { + nan_psoc_disable(psoc); disa_psoc_disable(psoc); ocb_psoc_disable(psoc); } diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index 40c76284259e..1d0b7339d004 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -138,6 +138,8 @@ typedef uint8_t tSirVersionString[SIR_VERSION_STRING_LEN]; #endif +struct scheduler_msg; + /** * enum sir_roam_op_code - Operation to be done by the callback. * @SIR_ROAM_SYNCH_PROPAGATION: Propagate the new BSS info after roaming.