From 9e2bd0589d6114149330f7d0817590c71e40e413 Mon Sep 17 00:00:00 2001 From: Neha Bisht Date: Thu, 5 Mar 2020 12:57:04 +0530 Subject: [PATCH] qcacmn: lmac header exclusion from wlan_objmgr_psoc_obj.h Avoid inclusion of wlan_lmac_if_def headerfile in wlan_objmgr_psoc_obj.h which led to inclusion of several other components header files, so handling dependencies by adding a forward declaration. Change-Id: I9ad231152789a1d8d9c01fd772abe4a8b06ad0b4 --- global_lmac_if/src/wlan_global_lmac_if.c | 51 ++++++++- .../obj_mgr/inc/wlan_objmgr_psoc_obj.h | 100 ++++++++++++++---- 2 files changed, 126 insertions(+), 25 deletions(-) diff --git a/global_lmac_if/src/wlan_global_lmac_if.c b/global_lmac_if/src/wlan_global_lmac_if.c index 0fb9baf035..032d26b809 100644 --- a/global_lmac_if/src/wlan_global_lmac_if.c +++ b/global_lmac_if/src/wlan_global_lmac_if.c @@ -25,6 +25,7 @@ #ifdef WLAN_CONV_SPECTRAL_ENABLE #include #endif + /* Function pointer to call DA/OL specific tx_ops registration function */ QDF_STATUS (*wlan_global_lmac_if_tx_ops_register[MAX_DEV_TYPE]) (struct wlan_lmac_if_tx_ops *tx_ops); @@ -124,7 +125,7 @@ wlan_global_lmac_if_rx_ops_register(struct wlan_lmac_if_rx_ops *rx_ops) * Ex: rx_ops->fp = function; */ if (!rx_ops) { - qdf_print("%s: lmac if rx ops pointer is NULL", __func__); + qdf_err("lmac if rx ops pointer is NULL"); return QDF_STATUS_E_INVAL; } /* Registeration for UMAC componets */ @@ -152,19 +153,45 @@ QDF_STATUS wlan_global_lmac_if_open(struct wlan_objmgr_psoc *psoc) { WLAN_DEV_TYPE dev_type; + struct wlan_lmac_if_tx_ops *tx_ops; + struct wlan_lmac_if_rx_ops *rx_ops; + + if (!psoc) { + qdf_err("psoc is NULL"); + return QDF_STATUS_E_INVAL; + } + + tx_ops = qdf_mem_malloc(sizeof(*tx_ops)); + if (!tx_ops) { + qdf_err("tx_ops is NULL"); + return QDF_STATUS_E_NOMEM; + } + + rx_ops = qdf_mem_malloc(sizeof(*rx_ops)); + if (!rx_ops) { + qdf_err("rx_ops is NULL"); + qdf_mem_free(tx_ops); + return QDF_STATUS_E_NOMEM; + } + + wlan_psoc_set_lmac_if_txops(psoc, tx_ops); + wlan_psoc_set_lmac_if_rxops(psoc, rx_ops); + dev_type = psoc->soc_nif.phy_type; if (dev_type == WLAN_DEV_DA || dev_type == WLAN_DEV_OL) { wlan_global_lmac_if_tx_ops_register[dev_type] - (&psoc->soc_cb.tx_ops); + (tx_ops); } else { /* Control should ideally not reach here */ qdf_print("Invalid device type"); + qdf_mem_free(tx_ops); + qdf_mem_free(rx_ops); return QDF_STATUS_E_INVAL; } /* Function call to register rx-ops handlers */ - wlan_global_lmac_if_rx_ops_register(&psoc->soc_cb.rx_ops); + wlan_global_lmac_if_rx_ops_register(rx_ops); return QDF_STATUS_SUCCESS; } @@ -180,8 +207,22 @@ qdf_export_symbol(wlan_global_lmac_if_open); */ QDF_STATUS wlan_global_lmac_if_close(struct wlan_objmgr_psoc *psoc) { - qdf_mem_zero(&psoc->soc_cb.tx_ops, sizeof(psoc->soc_cb.tx_ops)); - qdf_mem_zero(&psoc->soc_cb.rx_ops, sizeof(psoc->soc_cb.rx_ops)); + struct wlan_lmac_if_tx_ops *tx_ops; + struct wlan_lmac_if_rx_ops *rx_ops; + + if (!psoc) { + qdf_err("psoc is NULL"); + return QDF_STATUS_E_INVAL; + } + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + + wlan_psoc_set_lmac_if_txops(psoc, NULL); + wlan_psoc_set_lmac_if_rxops(psoc, NULL); + + qdf_mem_free(tx_ops); + qdf_mem_free(rx_ops); return QDF_STATUS_SUCCESS; } diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h index 59f6d4de71..25ce022ba1 100644 --- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h +++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h @@ -23,7 +23,7 @@ #define _WLAN_OBJMGR_PSOC_OBJ_H_ #include "wlan_objmgr_cmn.h" -#include "wlan_lmac_if_def.h" +#include "wlan_objmgr_debug.h" #define REG_DMN_CH144 0x0001 #define REG_DMN_ENTREPRISE 0x0002 @@ -318,8 +318,8 @@ struct wlan_objmgr_psoc_objmgr { * @rx_ops: contains southbound rx callbacks */ struct wlan_soc_southbound_cb { - struct wlan_lmac_if_tx_ops tx_ops; - struct wlan_lmac_if_rx_ops rx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; + struct wlan_lmac_if_rx_ops *rx_ops; }; /** @@ -1371,7 +1371,7 @@ static inline uint8_t *wlan_psoc_get_hw_macaddr(struct wlan_objmgr_psoc *psoc) } /** - * wlan_objmgr_psoc_get_comp_private_obj(): API to retrieve component object + * wlan_objmgr_psoc_get_comp_private_obj() - API to retrieve component object * @psoc: Psoc pointer * @id: component id * @@ -1399,7 +1399,79 @@ static inline uint8_t wlan_psoc_get_pdev_count(struct wlan_objmgr_psoc *psoc) } /** - * wlan_psoc_set_tgt_if_handle(): API to set target if handle in psoc object + * wlan_psoc_set_lmac_if_txops() - API to set tx ops handle in psoc object + * @psoc: Psoc pointer + * @tx_ops: tx callbacks handle + * + * API to set tx callbacks handle in psoc object + * + * Return: None + */ +static inline +void wlan_psoc_set_lmac_if_txops(struct wlan_objmgr_psoc *psoc, + struct wlan_lmac_if_tx_ops *tx_ops) +{ + if (!psoc) + return; + + psoc->soc_cb.tx_ops = tx_ops; +} + +/** + * wlan_psoc_get_lmac_if_txops() - API to get tx ops handle + * @psoc: Psoc pointer + * + * API to get tx callbacks handle from psoc object + * + * Return: tx callbacks handle + */ +static inline +struct wlan_lmac_if_tx_ops *wlan_psoc_get_lmac_if_txops(struct wlan_objmgr_psoc *psoc) +{ + if (!psoc) + return NULL; + + return psoc->soc_cb.tx_ops; +} + +/** + * wlan_psoc_set_lmac_if_rxops() - API to set rx ops handle in psoc object + * @psoc: Psoc pointer + * @tgt_if_handle: rx callbacks handle + * + * API to set rx callbacks handle in psoc object + * + * Return: None + */ +static inline +void wlan_psoc_set_lmac_if_rxops(struct wlan_objmgr_psoc *psoc, struct + wlan_lmac_if_rx_ops *rx_ops) +{ + if (!psoc) + return; + + psoc->soc_cb.rx_ops = rx_ops; +} + +/** + * wlan_psoc_get_lmac_if_rxops() - API to get rx ops handle + * @psoc: Psoc pointer + * + * API to get rx callbacks handle from psoc object + * + * Return: rx callbacks handle + */ +static inline +struct wlan_lmac_if_rx_ops *wlan_psoc_get_lmac_if_rxops(struct wlan_objmgr_psoc *psoc) +{ + if (!psoc) + return NULL; + + return psoc->soc_cb.rx_ops; +} + +/** + * wlan_psoc_set_tgt_if_handle() - API to set target if handle in psoc object * @psoc: Psoc pointer * @tgt_if_handle: target interface handle * @@ -1418,7 +1490,7 @@ void wlan_psoc_set_tgt_if_handle(struct wlan_objmgr_psoc *psoc, } /** - * wlan_psoc_get_tgt_if_handle(): API to get target interface handle + * wlan_psoc_get_tgt_if_handle() - API to get target interface handle * @psoc: Psoc pointer * * API to get target interface handle from psoc object @@ -1436,7 +1508,7 @@ struct target_psoc_info *wlan_psoc_get_tgt_if_handle( } /** - * wlan_psoc_get_qdf_dev(): API to get qdf device + * wlan_psoc_get_qdf_dev() - API to get qdf device * @psoc: Psoc pointer * * API to get qdf device from psoc object @@ -1453,7 +1525,7 @@ static inline qdf_device_t wlan_psoc_get_qdf_dev( } /** - * wlan_psoc_set_qdf_dev(): API to get qdf device + * wlan_psoc_set_qdf_dev() - API to get qdf device * @psoc: Psoc pointer * dev: qdf device * @@ -1715,18 +1787,6 @@ struct wlan_logically_del_peer { struct wlan_objmgr_peer *peer; }; -/** - * wlan_psoc_get_lmac_if_txops() - get lmac if txops for the psoc - * @psoc: psoc object pointer - * - * Return: Pointer to wlan_lmac_if_tx_ops - */ -static inline struct wlan_lmac_if_tx_ops * -wlan_psoc_get_lmac_if_txops(struct wlan_objmgr_psoc *psoc) -{ - return &((psoc->soc_cb.tx_ops)); -} - /** * wlan_psoc_get_id() - get psoc id * @psoc: PSOC object