diff --git a/os_if/linux/spectral/inc/os_if_spectral_netlink.h b/os_if/linux/spectral/inc/os_if_spectral_netlink.h index 9028654621..be265b09fe 100644 --- a/os_if/linux/spectral/inc/os_if_spectral_netlink.h +++ b/os_if/linux/spectral/inc/os_if_spectral_netlink.h @@ -25,6 +25,7 @@ #include #include #include +#include /* NETLINK related declarations */ #if (KERNEL_VERSION(2, 6, 31) > LINUX_VERSION_CODE) diff --git a/spectral/dispatcher/src/wlan_spectral_tgt_api.c b/spectral/dispatcher/src/wlan_spectral_tgt_api.c index 4749b02885..7db316dd24 100644 --- a/spectral/dispatcher/src/wlan_spectral_tgt_api.c +++ b/spectral/dispatcher/src/wlan_spectral_tgt_api.c @@ -89,42 +89,70 @@ void * tgt_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_pdev_spectral_init( - pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return NULL; + } + + return tx_ops->sptrl_tx_ops.sptrlto_pdev_spectral_init(pdev); } void tgt_pdev_spectral_deinit(struct wlan_objmgr_pdev *pdev) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_pdev_spectral_deinit(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return; + } + + tx_ops->sptrl_tx_ops.sptrlto_pdev_spectral_deinit(pdev); } void * tgt_psoc_spectral_init(struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_tx_ops *tx_ops; + if (!psoc) { spectral_err("psoc is null"); return NULL; } - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_psoc_spectral_init( - psoc); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return NULL; + } + + return tx_ops->sptrl_tx_ops.sptrlto_psoc_spectral_init(psoc); } void tgt_psoc_spectral_deinit(struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_tx_ops *tx_ops; + if (!psoc) { spectral_err("psoc is null"); return; } - psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_psoc_spectral_deinit(psoc); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return; + } + + tx_ops->sptrl_tx_ops.sptrlto_psoc_spectral_deinit(psoc); } QDF_STATUS @@ -134,10 +162,17 @@ tgt_set_spectral_config(struct wlan_objmgr_pdev *pdev, enum spectral_cp_error_code *err) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_spectral_config( - pdev, param, smode, err); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + return tx_ops->sptrl_tx_ops.sptrlto_set_spectral_config(pdev, param, + smode, err); } QDF_STATUS @@ -146,10 +181,16 @@ tgt_get_spectral_config(struct wlan_objmgr_pdev *pdev, const enum spectral_scan_mode smode) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_config( - pdev, + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + return tx_ops->sptrl_tx_ops.sptrlto_get_spectral_config(pdev, sptrl_config, smode); } @@ -160,10 +201,17 @@ tgt_start_spectral_scan(struct wlan_objmgr_pdev *pdev, enum spectral_cp_error_code *err) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_start_spectral_scan( - pdev, smode, err); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + return tx_ops->sptrl_tx_ops.sptrlto_start_spectral_scan(pdev, smode, + err); } QDF_STATUS @@ -172,10 +220,17 @@ tgt_stop_spectral_scan(struct wlan_objmgr_pdev *pdev, enum spectral_cp_error_code *err) { struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_stop_spectral_scan( - pdev, smode, err); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + return tx_ops->sptrl_tx_ops.sptrlto_stop_spectral_scan(pdev, smode, + err); } bool @@ -183,10 +238,16 @@ tgt_is_spectral_active(struct wlan_objmgr_pdev *pdev, enum spectral_scan_mode smode) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_is_spectral_active( - pdev, smode); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return false; + } + + return tx_ops->sptrl_tx_ops.sptrlto_is_spectral_active(pdev, smode); } bool @@ -194,30 +255,48 @@ tgt_is_spectral_enabled(struct wlan_objmgr_pdev *pdev, enum spectral_scan_mode smode) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_is_spectral_enabled( - pdev, smode); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return false; + } + + return tx_ops->sptrl_tx_ops.sptrlto_is_spectral_enabled(pdev, smode); } QDF_STATUS tgt_set_debug_level(struct wlan_objmgr_pdev *pdev, u_int32_t debug_level) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_debug_level( - pdev, - debug_level); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + return tx_ops->sptrl_tx_ops.sptrlto_set_debug_level(pdev, debug_level); } u_int32_t tgt_get_debug_level(struct wlan_objmgr_pdev *pdev) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_debug_level(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return -EINVAL; + } + + return tx_ops->sptrl_tx_ops.sptrlto_get_debug_level(pdev); } QDF_STATUS @@ -225,10 +304,16 @@ tgt_get_spectral_capinfo(struct wlan_objmgr_pdev *pdev, struct spectral_caps *scaps) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_capinfo( - pdev, scaps); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + return tx_ops->sptrl_tx_ops.sptrlto_get_spectral_capinfo(pdev, scaps); } QDF_STATUS @@ -236,10 +321,16 @@ tgt_get_spectral_diagstats(struct wlan_objmgr_pdev *pdev, struct spectral_diag_stats *stats) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_get_spectral_diagstats( - pdev, stats); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + return tx_ops->sptrl_tx_ops.sptrlto_get_spectral_diagstats(pdev, stats); } QDF_STATUS @@ -247,6 +338,7 @@ tgt_register_spectral_wmi_ops(struct wlan_objmgr_psoc *psoc, struct spectral_wmi_ops *wmi_ops) { struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; if (!psoc) { spectral_err("psoc is null"); @@ -258,7 +350,13 @@ tgt_register_spectral_wmi_ops(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_INVAL; } - psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_INVAL; + } + + psptrl_tx_ops = &tx_ops->sptrl_tx_ops; return psptrl_tx_ops->sptrlto_register_spectral_wmi_ops(psoc, wmi_ops); } @@ -268,6 +366,7 @@ tgt_register_spectral_tgt_ops(struct wlan_objmgr_psoc *psoc, struct spectral_tgt_ops *tgt_ops) { struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; if (!psoc) { spectral_err("psoc is null"); @@ -279,30 +378,40 @@ tgt_register_spectral_tgt_ops(struct wlan_objmgr_psoc *psoc, return QDF_STATUS_E_INVAL; } - psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_INVAL; + } - return psptrl_tx_ops->sptrlto_register_spectral_tgt_ops(psoc, - tgt_ops); + psptrl_tx_ops = &tx_ops->sptrl_tx_ops; + + return psptrl_tx_ops->sptrlto_register_spectral_tgt_ops(psoc, tgt_ops); } void tgt_spectral_register_nl_cb( - struct wlan_objmgr_pdev *pdev, - struct spectral_nl_cb *nl_cb) + struct wlan_objmgr_pdev *pdev, + struct spectral_nl_cb *nl_cb) { struct wlan_objmgr_psoc *psoc = NULL; struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; if (!pdev) { spectral_err("PDEV is NULL!"); return; } psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return; + } - psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; + psptrl_tx_ops = &tx_ops->sptrl_tx_ops; - return psptrl_tx_ops->sptrlto_register_netlink_cb(pdev, - nl_cb); + return psptrl_tx_ops->sptrlto_register_netlink_cb(pdev, nl_cb); } bool @@ -310,10 +419,16 @@ tgt_spectral_use_nl_bcast(struct wlan_objmgr_pdev *pdev) { struct wlan_objmgr_psoc *psoc = NULL; struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return false; + } - psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; + psptrl_tx_ops = &tx_ops->sptrl_tx_ops; return psptrl_tx_ops->sptrlto_use_nl_bcast(pdev); } @@ -322,14 +437,20 @@ void tgt_spectral_deregister_nl_cb(struct wlan_objmgr_pdev *pdev) { struct wlan_objmgr_psoc *psoc = NULL; struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; if (!pdev) { spectral_err("PDEV is NULL!"); return; } psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return; + } - psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; + psptrl_tx_ops = &tx_ops->sptrl_tx_ops; psptrl_tx_ops->sptrlto_deregister_netlink_cb(pdev); } @@ -340,10 +461,16 @@ tgt_spectral_process_report(struct wlan_objmgr_pdev *pdev, { struct wlan_objmgr_psoc *psoc = NULL; struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return -EINVAL; + } - psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; + psptrl_tx_ops = &tx_ops->sptrl_tx_ops; return psptrl_tx_ops->sptrlto_process_spectral_report(pdev, payload); } @@ -353,8 +480,15 @@ tgt_spectral_get_target_type(struct wlan_objmgr_psoc *psoc) { uint32_t target_type = 0; struct wlan_lmac_if_target_tx_ops *target_type_tx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; - target_type_tx_ops = &psoc->soc_cb.tx_ops.target_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return target_type; + } + + target_type_tx_ops = &tx_ops->target_tx_ops; if (target_type_tx_ops->tgt_get_tgt_type) target_type = target_type_tx_ops->tgt_get_tgt_type(psoc); @@ -370,10 +504,17 @@ tgt_spectral_register_to_dbr(struct wlan_objmgr_pdev *pdev) struct wlan_lmac_if_direct_buf_rx_tx_ops *dbr_tx_ops = NULL; struct wlan_lmac_if_sptrl_tx_ops *sptrl_tx_ops = NULL; struct dbr_module_config dbr_config = {0}; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - dbr_tx_ops = &psoc->soc_cb.tx_ops.dbr_tx_ops; - sptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + dbr_tx_ops = &tx_ops->dbr_tx_ops; + sptrl_tx_ops = &tx_ops->sptrl_tx_ops; dbr_config.num_resp_per_event = DBR_NUM_RESP_PER_EVENT_SPECTRAL; dbr_config.event_timeout_in_ms = DBR_EVENT_TIMEOUT_IN_MS_SPECTRAL; @@ -398,10 +539,17 @@ tgt_spectral_unregister_to_dbr(struct wlan_objmgr_pdev *pdev) struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_direct_buf_rx_tx_ops *dbr_tx_ops = NULL; struct wlan_lmac_if_sptrl_tx_ops *sptrl_tx_ops = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - dbr_tx_ops = &psoc->soc_cb.tx_ops.dbr_tx_ops; - sptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + dbr_tx_ops = &tx_ops->dbr_tx_ops; + sptrl_tx_ops = &tx_ops->sptrl_tx_ops; if ((sptrl_tx_ops->sptrlto_direct_dma_support) && (sptrl_tx_ops->sptrlto_direct_dma_support(pdev))) { @@ -442,17 +590,21 @@ QDF_STATUS tgt_set_spectral_dma_debug(struct wlan_objmgr_pdev *pdev, bool dma_debug_enable) { struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - if (!psoc) { spectral_err("psoc is NULL!"); return QDF_STATUS_E_FAILURE; } - return psoc->soc_cb.tx_ops.sptrl_tx_ops.sptrlto_set_dma_debug( - pdev, - dma_debug_type, + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + return tx_ops->sptrl_tx_ops.sptrlto_set_dma_debug(pdev, dma_debug_type, dma_debug_enable); } #else @@ -467,6 +619,7 @@ QDF_STATUS tgt_set_spectral_dma_debug(struct wlan_objmgr_pdev *pdev, QDF_STATUS tgt_spectral_register_events(struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_tx_ops *tx_ops; struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops; if (!psoc) { @@ -474,7 +627,13 @@ tgt_spectral_register_events(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_INVAL; } - psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_INVAL; + } + + psptrl_tx_ops = &tx_ops->sptrl_tx_ops; return psptrl_tx_ops->sptrlto_register_events(psoc); } @@ -482,6 +641,7 @@ tgt_spectral_register_events(struct wlan_objmgr_psoc *psoc) QDF_STATUS tgt_spectral_unregister_events(struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_tx_ops *tx_ops; struct wlan_lmac_if_sptrl_tx_ops *psptrl_tx_ops; if (!psoc) { @@ -489,7 +649,13 @@ tgt_spectral_unregister_events(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_INVAL; } - psptrl_tx_ops = &psoc->soc_cb.tx_ops.sptrl_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_INVAL; + } + + psptrl_tx_ops = &tx_ops->sptrl_tx_ops; return psptrl_tx_ops->sptrlto_unregister_events(psoc); } diff --git a/target_if/dfs/inc/target_if_dfs.h b/target_if/dfs/inc/target_if_dfs.h index c903cd0baa..90e0f00f67 100644 --- a/target_if/dfs/inc/target_if_dfs.h +++ b/target_if/dfs/inc/target_if_dfs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2018, 2020 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -41,6 +41,14 @@ QDF_STATUS target_if_register_dfs_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); static inline struct wlan_lmac_if_dfs_rx_ops * target_if_dfs_get_rx_ops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.rx_ops.dfs_rx_ops; + struct wlan_lmac_if_rx_ops *rx_ops; + + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + target_if_err("rx_ops is NULL"); + return NULL; + } + + return &rx_ops->dfs_rx_ops; } diff --git a/target_if/regulatory/src/target_if_reg.c b/target_if/regulatory/src/target_if_reg.c index 928a4e55d5..8c6083d41c 100644 --- a/target_if/regulatory/src/target_if_reg.c +++ b/target_if/regulatory/src/target_if_reg.c @@ -51,10 +51,15 @@ static inline uint32_t get_chan_list_cc_event_id(void) */ static bool tgt_if_regulatory_is_regdb_offloaded(struct wlan_objmgr_psoc *psoc) { - wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); struct wlan_lmac_if_reg_rx_ops *reg_rx_ops; + wmi_unified_t wmi_handle = get_wmi_unified_hdl_from_psoc(psoc); + reg_rx_ops = target_if_regulatory_get_rx_ops(psoc); + if (!reg_rx_ops) { + target_if_err("reg_rx_ops is NULL"); + return false; + } if (!wmi_handle) return false; @@ -111,7 +116,15 @@ static bool tgt_if_regulatory_is_there_serv_ready_extn( struct wlan_lmac_if_reg_rx_ops * target_if_regulatory_get_rx_ops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.rx_ops.reg_rx_ops; + struct wlan_lmac_if_rx_ops *rx_ops; + + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + target_if_err("rx_ops is NULL"); + return NULL; + } + + return &rx_ops->reg_rx_ops; } QDF_STATUS target_if_reg_set_offloaded_info(struct wlan_objmgr_psoc *psoc) @@ -181,6 +194,11 @@ static int tgt_reg_chan_list_update_handler(ol_scn_t handle, uint8_t *event_buf, } reg_rx_ops = target_if_regulatory_get_rx_ops(psoc); + if (!reg_rx_ops) { + target_if_err("reg_rx_ops is NULL"); + return -EINVAL; + } + if (!reg_rx_ops->master_list_handler) { target_if_err("master_list_handler is NULL"); return -EINVAL; diff --git a/target_if/spectral/target_if_spectral.c b/target_if/spectral/target_if_spectral.c index a0c3435803..b58ef00dce 100644 --- a/target_if/spectral/target_if_spectral.c +++ b/target_if/spectral/target_if_spectral.c @@ -2267,9 +2267,10 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) uint32_t target_type; uint32_t target_revision; struct wlan_objmgr_psoc *psoc; - struct wlan_lmac_if_target_tx_ops *tx_ops; + struct wlan_lmac_if_target_tx_ops *tgt_tx_ops; enum spectral_scan_mode smode = SPECTRAL_SCAN_MODE_NORMAL; QDF_STATUS status; + struct wlan_lmac_if_tx_ops *tx_ops; if (!pdev) { spectral_err("SPECTRAL: pdev is NULL!"); @@ -2286,17 +2287,24 @@ target_if_pdev_spectral_init(struct wlan_objmgr_pdev *pdev) psoc = wlan_pdev_get_psoc(pdev); - tx_ops = &psoc->soc_cb.tx_ops.target_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + qdf_mem_free(spectral); + return NULL; + } - if (tx_ops->tgt_get_tgt_type) { - target_type = tx_ops->tgt_get_tgt_type(psoc); + tgt_tx_ops = &tx_ops->target_tx_ops; + + if (tgt_tx_ops->tgt_get_tgt_type) { + target_type = tgt_tx_ops->tgt_get_tgt_type(psoc); } else { qdf_mem_free(spectral); return NULL; } - if (tx_ops->tgt_get_tgt_revision) { - target_revision = tx_ops->tgt_get_tgt_revision(psoc); + if (tgt_tx_ops->tgt_get_tgt_revision) { + target_revision = tgt_tx_ops->tgt_get_tgt_revision(psoc); } else { qdf_mem_free(spectral); return NULL; @@ -4378,7 +4386,12 @@ target_if_spectral_do_dbr_ring_debug(struct wlan_objmgr_pdev *pdev, bool enable) spectral_err("psoc is null"); return QDF_STATUS_E_INVAL; } - tx_ops = &psoc->soc_cb.tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_INVAL; + } spectral = get_target_if_spectral_handle_from_pdev(pdev); if (!spectral) { @@ -4424,7 +4437,12 @@ target_if_spectral_do_dbr_buff_debug(struct wlan_objmgr_pdev *pdev, bool enable) spectral_err("psoc is null"); return QDF_STATUS_E_INVAL; } - tx_ops = &psoc->soc_cb.tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_INVAL; + } spectral = get_target_if_spectral_handle_from_pdev(pdev); if (!spectral) { @@ -4531,7 +4549,12 @@ target_if_spectral_set_dma_debug( spectral_err("psoc is null"); return QDF_STATUS_E_INVAL; } - tx_ops = &psoc->soc_cb.tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + spectral_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } if (!tx_ops->target_tx_ops.tgt_get_tgt_type) { spectral_err("Unable to fetch target type"); @@ -4831,8 +4854,10 @@ target_if_process_spectral_report(struct wlan_objmgr_pdev *pdev, static inline void target_if_sptrl_debug_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) { - if (!tx_ops) + if (!tx_ops) { + spectral_err("tx_ops is NULL"); return; + } tx_ops->sptrl_tx_ops.sptrlto_set_dma_debug = target_if_spectral_set_dma_debug; diff --git a/target_if/spectral/target_if_spectral.h b/target_if/spectral/target_if_spectral.h index 50cee54ba6..949b322eb1 100644 --- a/target_if/spectral/target_if_spectral.h +++ b/target_if/spectral/target_if_spectral.h @@ -1428,6 +1428,7 @@ struct target_if_spectral *get_target_if_spectral_handle_from_pdev( { struct target_if_spectral *spectral; struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_rx_ops *rx_ops; if (!pdev) { spectral_err("pdev is null"); @@ -1440,9 +1441,15 @@ struct target_if_spectral *get_target_if_spectral_handle_from_pdev( return NULL; } + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + spectral_err("rx_ops is null"); + return NULL; + } + spectral = (struct target_if_spectral *) - psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_get_pdev_target_handle( - pdev); + rx_ops->sptrl_rx_ops.sptrlro_get_pdev_target_handle(pdev); + return spectral; } @@ -1458,6 +1465,7 @@ static inline struct target_if_psoc_spectral *get_target_if_spectral_handle_from_psoc( struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_rx_ops *rx_ops; struct target_if_psoc_spectral *psoc_spectral; if (!psoc) { @@ -1465,9 +1473,14 @@ struct target_if_psoc_spectral *get_target_if_spectral_handle_from_psoc( return NULL; } + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + spectral_err("rx_ops is null"); + return NULL; + } + psoc_spectral = (struct target_if_psoc_spectral *) - psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_get_psoc_target_handle( - psoc); + rx_ops->sptrl_rx_ops.sptrlro_get_psoc_target_handle(psoc); return psoc_spectral; } @@ -1485,14 +1498,20 @@ static inline int16_t target_if_vdev_get_chan_freq(struct wlan_objmgr_vdev *vdev) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_rx_ops *rx_ops; psoc = wlan_vdev_get_psoc(vdev); if (!psoc) { spectral_err("psoc is NULL"); return -EINVAL; } + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + spectral_err("rx_ops is null"); + return -EINVAL; + } - return psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_vdev_get_chan_freq( + return rx_ops->sptrl_rx_ops.sptrlro_vdev_get_chan_freq( vdev); } @@ -1509,6 +1528,7 @@ static inline int16_t target_if_vdev_get_chan_freq_seg2(struct wlan_objmgr_vdev *vdev) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_rx_ops *rx_ops; psoc = wlan_vdev_get_psoc(vdev); if (!psoc) { @@ -1516,8 +1536,13 @@ int16_t target_if_vdev_get_chan_freq_seg2(struct wlan_objmgr_vdev *vdev) return -EINVAL; } - return psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_vdev_get_chan_freq_seg2( - vdev); + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + spectral_err("rx_ops is null"); + return -EINVAL; + } + + return rx_ops->sptrl_rx_ops.sptrlro_vdev_get_chan_freq_seg2(vdev); } /** @@ -1534,6 +1559,7 @@ enum phy_ch_width target_if_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev) { struct wlan_objmgr_psoc *psoc = NULL; enum phy_ch_width ch_width; + struct wlan_lmac_if_rx_ops *rx_ops; psoc = wlan_vdev_get_psoc(vdev); if (!psoc) { @@ -1541,8 +1567,13 @@ enum phy_ch_width target_if_vdev_get_ch_width(struct wlan_objmgr_vdev *vdev) return CH_WIDTH_INVALID; } - ch_width = psoc->soc_cb.rx_ops.sptrl_rx_ops.sptrlro_vdev_get_ch_width( - vdev); + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + spectral_err("rx_ops is null"); + return CH_WIDTH_INVALID; + } + + ch_width = rx_ops->sptrl_rx_ops.sptrlro_vdev_get_ch_width(vdev); if (ch_width == CH_WIDTH_160MHZ) { int16_t cfreq2; @@ -1576,6 +1607,7 @@ int target_if_vdev_get_sec20chan_freq_mhz( uint16_t *sec20chan_freq) { struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_rx_ops *rx_ops; psoc = wlan_vdev_get_psoc(vdev); if (!psoc) { @@ -1583,7 +1615,13 @@ int target_if_vdev_get_sec20chan_freq_mhz( return -EINVAL; } - return psoc->soc_cb.rx_ops.sptrl_rx_ops. + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + spectral_err("rx_ops is null"); + return -EINVAL; + } + + return rx_ops->sptrl_rx_ops. sptrlro_vdev_get_sec20chan_freq_mhz(vdev, sec20chan_freq); } @@ -1601,6 +1639,7 @@ void target_if_spectral_set_rxchainmask(struct wlan_objmgr_pdev *pdev, struct wlan_objmgr_psoc *psoc = NULL; struct target_if_spectral *spectral = NULL; enum spectral_scan_mode smode = SPECTRAL_SCAN_MODE_NORMAL; + struct wlan_lmac_if_rx_ops *rx_ops; psoc = wlan_pdev_get_psoc(pdev); if (!psoc) { @@ -1608,12 +1647,18 @@ void target_if_spectral_set_rxchainmask(struct wlan_objmgr_pdev *pdev, return; } + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + spectral_err("rx_ops is null"); + return; + } + if (smode >= SPECTRAL_SCAN_MODE_MAX) { spectral_err("Invalid Spectral mode %u", smode); return; } - if (psoc->soc_cb.rx_ops.sptrl_rx_ops. + if (rx_ops->sptrl_rx_ops. sptrlro_spectral_is_feature_disabled(psoc)) { spectral_info("Spectral is disabled"); return; diff --git a/umac/dfs/core/src/dfs.h b/umac/dfs/core/src/dfs.h index 33c41a192a..bb30313c15 100644 --- a/umac/dfs/core/src/dfs.h +++ b/umac/dfs/core/src/dfs.h @@ -45,6 +45,8 @@ #ifdef QCA_SUPPORT_ADFS_RCAC #include /* for struct wlan_sm */ #endif +#include +#include /* File Line and Submodule String */ #define FLSM(x, str) #str " : " FL(x) diff --git a/umac/dfs/core/src/dfs_random_chan_sel.h b/umac/dfs/core/src/dfs_random_chan_sel.h index 346b8cf1d1..560650696e 100644 --- a/umac/dfs/core/src/dfs_random_chan_sel.h +++ b/umac/dfs/core/src/dfs_random_chan_sel.h @@ -16,6 +16,9 @@ * PERFORMANCE OF THIS SOFTWARE. */ +#include +#include + /* dfs regions definitions */ /* un-initialized region */ #define DFS_UNINIT_REGION_VAL 0 diff --git a/umac/dfs/core/src/filtering/dfs_partial_offload_radar.c b/umac/dfs/core/src/filtering/dfs_partial_offload_radar.c index c45686d203..c5717f7185 100644 --- a/umac/dfs/core/src/filtering/dfs_partial_offload_radar.c +++ b/umac/dfs/core/src/filtering/dfs_partial_offload_radar.c @@ -302,11 +302,18 @@ static void dfs_set_adrastea_rf_thrshold( struct wlan_dfs_radar_tab_info *rinfo) { int i; - struct wlan_lmac_if_target_tx_ops *tx_ops; + struct wlan_lmac_if_target_tx_ops *tgt_tx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; - tx_ops = &psoc->soc_cb.tx_ops.target_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return; + } - if (tx_ops->tgt_is_tgt_type_adrastea(target_type) && + tgt_tx_ops = &tx_ops->target_tx_ops; + + if (tgt_tx_ops->tgt_is_tgt_type_adrastea(target_type) && dfsdomain == DFS_ETSI_DOMAIN) { for (i = 0; i < rinfo->numradars; i++) { rinfo->dfs_radars[i].rp_rssithresh = @@ -385,15 +392,15 @@ void dfs_update_radar_info(struct wlan_dfs_radar_tab_info *rinfo, static void dfs_assign_mkk_bin5_radars(struct wlan_dfs_radar_tab_info *rinfo, uint32_t target_type, - struct wlan_lmac_if_target_tx_ops *tx_ops) + struct wlan_lmac_if_target_tx_ops *tgt_tx_ops) { - if (tx_ops->tgt_is_tgt_type_ar900b(target_type) || - tx_ops->tgt_is_tgt_type_ipq4019(target_type)) { + if (tgt_tx_ops->tgt_is_tgt_type_ar900b(target_type) || + tgt_tx_ops->tgt_is_tgt_type_ipq4019(target_type)) { rinfo->b5pulses = dfs_jpn_bin5pulses_ar900b; rinfo->numb5radars = QDF_ARRAY_SIZE( dfs_jpn_bin5pulses_ar900b); - } else if (tx_ops->tgt_is_tgt_type_qca9984(target_type) || - tx_ops->tgt_is_tgt_type_qca9888(target_type)) { + } else if (tgt_tx_ops->tgt_is_tgt_type_qca9984(target_type) || + tgt_tx_ops->tgt_is_tgt_type_qca9888(target_type)) { rinfo->b5pulses = dfs_jpn_bin5pulses_qca9984; rinfo->numb5radars = QDF_ARRAY_SIZE (dfs_jpn_bin5pulses_qca9984); @@ -408,12 +415,13 @@ void dfs_get_po_radars(struct wlan_dfs *dfs) { struct wlan_dfs_radar_tab_info rinfo; struct wlan_objmgr_psoc *psoc; - struct wlan_lmac_if_target_tx_ops *tx_ops; + struct wlan_lmac_if_target_tx_ops *tgt_tx_ops; int i; uint32_t target_type; int dfsdomain = DFS_FCC_DOMAIN; struct dfs_pulse *external_radars, *merged_radars = NULL; uint8_t num_ext_radars; + struct wlan_lmac_if_tx_ops *tx_ops; /* Fetch current radar patterns from the lmac */ qdf_mem_zero(&rinfo, sizeof(rinfo)); @@ -431,12 +439,18 @@ void dfs_get_po_radars(struct wlan_dfs *dfs) return; } - tx_ops = &(psoc->soc_cb.tx_ops.target_tx_ops); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(dfs, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return; + } + + tgt_tx_ops = &tx_ops->target_tx_ops; switch (dfsdomain) { case DFS_FCC_DOMAIN: dfs_debug(dfs, WLAN_DEBUG_DFS_ALWAYS, "FCC domain"); rinfo.dfsdomain = DFS_FCC_DOMAIN; - dfs_assign_fcc_pulse_table(&rinfo, target_type, tx_ops); + dfs_assign_fcc_pulse_table(&rinfo, target_type, tgt_tx_ops); dfs->dfs_lowest_pri_limit = DFS_INVALID_PRI_LIMIT; break; case DFS_CN_DOMAIN: @@ -497,7 +511,7 @@ void dfs_get_po_radars(struct wlan_dfs *dfs) rinfo.dfsdomain = DFS_MKKN_DOMAIN; rinfo.dfs_radars = dfs_mkk4_radars; rinfo.numradars = QDF_ARRAY_SIZE(dfs_mkk4_radars); - dfs_assign_mkk_bin5_radars(&rinfo, target_type, tx_ops); + dfs_assign_mkk_bin5_radars(&rinfo, target_type, tgt_tx_ops); dfs->dfs_lowest_pri_limit = DFS_INVALID_PRI_LIMIT_MKKN; break; case DFS_MKK4_DOMAIN: @@ -505,7 +519,7 @@ void dfs_get_po_radars(struct wlan_dfs *dfs) rinfo.dfsdomain = DFS_MKK4_DOMAIN; rinfo.dfs_radars = dfs_mkk4_radars; rinfo.numradars = QDF_ARRAY_SIZE(dfs_mkk4_radars); - dfs_assign_mkk_bin5_radars(&rinfo, target_type, tx_ops); + dfs_assign_mkk_bin5_radars(&rinfo, target_type, tgt_tx_ops); dfs->dfs_lowest_pri_limit = DFS_INVALID_PRI_LIMIT; break; default: @@ -528,10 +542,10 @@ void dfs_get_po_radars(struct wlan_dfs *dfs) num_ext_radars); } - if (tx_ops->tgt_is_tgt_type_ar900b(target_type) || - tx_ops->tgt_is_tgt_type_ipq4019(target_type) || - tx_ops->tgt_is_tgt_type_qca9984(target_type) || - tx_ops->tgt_is_tgt_type_qca9888(target_type)) { + if (tgt_tx_ops->tgt_is_tgt_type_ar900b(target_type) || + tgt_tx_ops->tgt_is_tgt_type_ipq4019(target_type) || + tgt_tx_ops->tgt_is_tgt_type_qca9984(target_type) || + tgt_tx_ops->tgt_is_tgt_type_qca9888(target_type)) { /* Beeliner WAR: lower RSSI threshold to improve detection of * certian radar types */ diff --git a/umac/dfs/core/src/misc/dfs.c b/umac/dfs/core/src/misc/dfs.c index d08308d4d6..f2c15bbd63 100644 --- a/umac/dfs/core/src/misc/dfs.c +++ b/umac/dfs/core/src/misc/dfs.c @@ -967,13 +967,19 @@ void dfs_complete_deferred_tasks(struct wlan_dfs *dfs) bool dfs_is_true_160mhz_supported(struct wlan_dfs *dfs) { struct wlan_objmgr_psoc *psoc = dfs->dfs_soc_obj->psoc; - struct wlan_lmac_if_target_tx_ops *tx_ops; + struct wlan_lmac_if_target_tx_ops *tgt_tx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; uint32_t target_type; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_info(dfs, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is NULL"); + return false; + } target_type = lmac_get_target_type(dfs->dfs_pdev_obj); - tx_ops = &psoc->soc_cb.tx_ops.target_tx_ops; - if (tx_ops->tgt_is_tgt_type_qcn9000) - return tx_ops->tgt_is_tgt_type_qcn9000(target_type); + tgt_tx_ops = &tx_ops->target_tx_ops; + if (tgt_tx_ops->tgt_is_tgt_type_qcn9000) + return tgt_tx_ops->tgt_is_tgt_type_qcn9000(target_type); return false; } diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_lmac_api.h b/umac/dfs/dispatcher/inc/wlan_dfs_lmac_api.h index 5ed030da21..e250649682 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_lmac_api.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_lmac_api.h @@ -27,6 +27,7 @@ #include #include +#include /** * lmac_get_caps() - Get DFS capabilities. diff --git a/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h b/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h index 3a6e45f845..3eed6c15de 100644 --- a/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h +++ b/umac/dfs/dispatcher/inc/wlan_dfs_ucfg_api.h @@ -28,6 +28,7 @@ #include #include #include +#include /** * struct dfs_to_mlme - These are MLME function pointer used by DFS component. diff --git a/umac/dfs/dispatcher/src/wlan_dfs_lmac_api.c b/umac/dfs/dispatcher/src/wlan_dfs_lmac_api.c index 48c0bb454d..cad1646961 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_lmac_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_lmac_api.c @@ -24,16 +24,23 @@ #include "wlan_dfs_lmac_api.h" #include "../../core/src/dfs_internal.h" #include +#include void lmac_get_caps(struct wlan_objmgr_pdev *pdev, struct wlan_dfs_caps *dfs_caps) { struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return; + } - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + dfs_tx_ops = &tx_ops->dfs_tx_ops; if (dfs_tx_ops->dfs_get_caps) dfs_tx_ops->dfs_get_caps(pdev, dfs_caps); @@ -44,10 +51,16 @@ uint64_t lmac_get_tsf64(struct wlan_objmgr_pdev *pdev) struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; uint64_t tsf64 = 0; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return tsf64; + } - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + dfs_tx_ops = &tx_ops->dfs_tx_ops; if (dfs_tx_ops->dfs_gettsf64) dfs_tx_ops->dfs_gettsf64(pdev, &tsf64); @@ -59,10 +72,16 @@ void lmac_dfs_disable(struct wlan_objmgr_pdev *pdev, int no_cac) { struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return; + } - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + dfs_tx_ops = &tx_ops->dfs_tx_ops; if (dfs_tx_ops->dfs_disable) dfs_tx_ops->dfs_disable(pdev, no_cac); @@ -75,10 +94,16 @@ void lmac_dfs_enable(struct wlan_objmgr_pdev *pdev, { struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return; + } - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + dfs_tx_ops = &tx_ops->dfs_tx_ops; if (dfs_tx_ops->dfs_enable) dfs_tx_ops->dfs_enable(pdev, @@ -92,10 +117,16 @@ void lmac_dfs_get_thresholds(struct wlan_objmgr_pdev *pdev, { struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return; + } - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + dfs_tx_ops = &tx_ops->dfs_tx_ops; if (dfs_tx_ops->dfs_get_thresholds) dfs_tx_ops->dfs_get_thresholds(pdev, param); @@ -106,10 +137,16 @@ uint16_t lmac_get_ah_devid(struct wlan_objmgr_pdev *pdev) struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; uint16_t devid = 0; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return devid; + } - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + dfs_tx_ops = &tx_ops->dfs_tx_ops; if (dfs_tx_ops->dfs_get_ah_devid) dfs_tx_ops->dfs_get_ah_devid(pdev, &devid); @@ -122,10 +159,16 @@ uint32_t lmac_get_ext_busy(struct wlan_objmgr_pdev *pdev) struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; uint32_t ext_chan_busy = 0; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return ext_chan_busy; + } - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + dfs_tx_ops = &tx_ops->dfs_tx_ops; if (dfs_tx_ops->dfs_get_ext_busy) dfs_tx_ops->dfs_get_ext_busy(pdev, &ext_chan_busy); @@ -137,10 +180,16 @@ void lmac_set_use_cac_prssi(struct wlan_objmgr_pdev *pdev) { struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return; + } - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + dfs_tx_ops = &tx_ops->dfs_tx_ops; if (dfs_tx_ops->dfs_set_use_cac_prssi) dfs_tx_ops->dfs_set_use_cac_prssi(pdev); @@ -151,10 +200,16 @@ uint32_t lmac_get_target_type(struct wlan_objmgr_pdev *pdev) struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; uint32_t target_type = 0; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return target_type; + } - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + dfs_tx_ops = &tx_ops->dfs_tx_ops; if (dfs_tx_ops->dfs_get_target_type) dfs_tx_ops->dfs_get_target_type(pdev, &target_type); @@ -168,10 +223,16 @@ uint32_t lmac_get_phymode_info(struct wlan_objmgr_pdev *pdev, struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; uint32_t mode_info = 0; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return mode_info; + } - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + dfs_tx_ops = &tx_ops->dfs_tx_ops; /* since dfs never comes into 2G, hardcode is_2gvht_en flag to false */ if (dfs_tx_ops->dfs_get_phymode_info) @@ -187,9 +248,16 @@ bool lmac_is_host_dfs_check_support_enabled(struct wlan_objmgr_pdev *pdev) struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; bool enabled = false; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return enabled; + } + + dfs_tx_ops = &tx_ops->dfs_tx_ops; if (dfs_tx_ops->dfs_host_dfs_check_support) dfs_tx_ops->dfs_host_dfs_check_support(pdev, &enabled); @@ -203,9 +271,16 @@ bool lmac_dfs_is_hw_mode_switch_in_progress(struct wlan_objmgr_pdev *pdev) struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_dfs_tx_ops *dfs_tx_ops; bool is_hw_mode_switch_in_progress = false; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - dfs_tx_ops = &psoc->soc_cb.tx_ops.dfs_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return is_hw_mode_switch_in_progress; + } + + dfs_tx_ops = &tx_ops->dfs_tx_ops; if (dfs_tx_ops->dfs_check_mode_switch_state) dfs_tx_ops->dfs_check_mode_switch_state( diff --git a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c index 72883cf976..b76b5a0ae4 100644 --- a/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c +++ b/umac/dfs/dispatcher/src/wlan_dfs_tgt_api.c @@ -40,7 +40,15 @@ struct wlan_lmac_if_dfs_tx_ops * wlan_psoc_get_dfs_txops(struct wlan_objmgr_psoc *psoc) { - return &((psoc->soc_cb.tx_ops.dfs_tx_ops)); + struct wlan_lmac_if_tx_ops *tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + dfs_err(NULL, WLAN_DEBUG_DFS_ALWAYS, "tx_ops is null"); + return NULL; + } + + return &tx_ops->dfs_tx_ops; } bool tgt_dfs_is_pdev_5ghz(struct wlan_objmgr_pdev *pdev) diff --git a/umac/regulatory/core/src/reg_priv_objs.h b/umac/regulatory/core/src/reg_priv_objs.h index 9bbb2046ad..698aa5d524 100644 --- a/umac/regulatory/core/src/reg_priv_objs.h +++ b/umac/regulatory/core/src/reg_priv_objs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -25,6 +25,8 @@ #ifndef __REG_PRIV_OBJS_H #define __REG_PRIV_OBJS_H +#include + #define reg_alert(params...) \ QDF_TRACE_FATAL(QDF_MODULE_ID_REGULATORY, params) #define reg_err(params...) \ diff --git a/umac/regulatory/core/src/reg_services_common.c b/umac/regulatory/core/src/reg_services_common.c index fa88abec77..c53482260f 100644 --- a/umac/regulatory/core/src/reg_services_common.c +++ b/umac/regulatory/core/src/reg_services_common.c @@ -1050,7 +1050,15 @@ uint16_t reg_get_bw_value(enum phy_ch_width bw) struct wlan_lmac_if_reg_tx_ops *reg_get_psoc_tx_ops( struct wlan_objmgr_psoc *psoc) { - return &((psoc->soc_cb.tx_ops.reg_ops)); + struct wlan_lmac_if_tx_ops *tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + reg_err("tx_ops is NULL"); + return NULL; + } + + return &tx_ops->reg_ops; } #ifdef CONFIG_CHAN_NUM_API diff --git a/umac/regulatory/core/src/reg_utils.h b/umac/regulatory/core/src/reg_utils.h index 059c1b3240..b4d79c7884 100644 --- a/umac/regulatory/core/src/reg_utils.h +++ b/umac/regulatory/core/src/reg_utils.h @@ -25,6 +25,8 @@ #ifndef __REG_UTILS_H_ #define __REG_UTILS_H_ +#include + #ifdef WLAN_FEATURE_DSRC #define REG_DSRC_START_FREQ channel_map[MIN_DSRC_CHANNEL].center_freq #define REG_DSRC_END_FREQ channel_map[MAX_DSRC_CHANNEL].center_freq diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h index 5c76b8494c..f6e7824ba6 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_services_api.h @@ -26,6 +26,8 @@ #ifndef __WLAN_REG_SERVICES_API_H #define __WLAN_REG_SERVICES_API_H +#include + #ifdef CONFIG_CHAN_NUM_API /** * wlan_reg_min_24ghz_ch_num() - Get minimum 2.4GHz channel number diff --git a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h index c98f728f18..71b04c3f71 100644 --- a/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h +++ b/umac/regulatory/dispatcher/inc/wlan_reg_ucfg_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -26,6 +26,8 @@ #ifndef __WLAN_REG_UCFG_API_H #define __WLAN_REG_UCFG_API_H +#include + typedef QDF_STATUS (*reg_event_cb)(void *status_struct); /**