diff --git a/ftm/core/src/wlan_ftm_svc.c b/ftm/core/src/wlan_ftm_svc.c index fc8f0de8cc..57726d86d1 100644 --- a/ftm/core/src/wlan_ftm_svc.c +++ b/ftm/core/src/wlan_ftm_svc.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -28,7 +28,15 @@ static inline struct wlan_lmac_if_ftm_tx_ops * wlan_psoc_get_ftm_txops(struct wlan_objmgr_psoc *psoc) { - return &((psoc->soc_cb.tx_ops.ftm_tx_ops)); + struct wlan_lmac_if_tx_ops *tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + ftm_err("tx_ops is NULL"); + return NULL; + } + + return &tx_ops->ftm_tx_ops; } static QDF_STATUS @@ -122,6 +130,10 @@ wlan_ftm_testmode_attach(struct wlan_objmgr_psoc *psoc) struct wlan_lmac_if_ftm_tx_ops *ftm_tx_ops; ftm_tx_ops = wlan_psoc_get_ftm_txops(psoc); + if (!ftm_tx_ops) { + ftm_err("ftm_tx_ops is NULL"); + return QDF_STATUS_E_FAULT; + } if (ftm_tx_ops->ftm_attach) return ftm_tx_ops->ftm_attach(psoc); @@ -135,6 +147,10 @@ wlan_ftm_testmode_detach(struct wlan_objmgr_psoc *psoc) struct wlan_lmac_if_ftm_tx_ops *ftm_tx_ops; ftm_tx_ops = wlan_psoc_get_ftm_txops(psoc); + if (!ftm_tx_ops) { + ftm_err("ftm_tx_ops is NULL"); + return QDF_STATUS_E_FAULT; + } if (ftm_tx_ops->ftm_detach) return ftm_tx_ops->ftm_detach(psoc); @@ -154,6 +170,10 @@ wlan_ftm_cmd_send(struct wlan_objmgr_pdev *pdev, uint8_t *buf, return QDF_STATUS_E_NOENT; ftm_tx_ops = wlan_psoc_get_ftm_txops(psoc); + if (!ftm_tx_ops) { + ftm_err("ftm_tx_ops is NULL"); + return QDF_STATUS_E_FAULT; + } if (ftm_tx_ops->ftm_cmd_send) return ftm_tx_ops->ftm_cmd_send(pdev, buf, len, pdev_id); diff --git a/init_deinit/dispatcher/src/dispatcher_init_deinit.c b/init_deinit/dispatcher/src/dispatcher_init_deinit.c index 7859f5abb3..828688347d 100644 --- a/init_deinit/dispatcher/src/dispatcher_init_deinit.c +++ b/init_deinit/dispatcher/src/dispatcher_init_deinit.c @@ -736,6 +736,11 @@ static QDF_STATUS dispatcher_dbr_psoc_enable(struct wlan_objmgr_psoc *psoc) struct wlan_lmac_if_tx_ops *tx_ops; tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + qdf_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + if (tx_ops->dbr_tx_ops.direct_buf_rx_register_events) return tx_ops->dbr_tx_ops.direct_buf_rx_register_events(psoc); @@ -747,6 +752,11 @@ static QDF_STATUS dispatcher_dbr_psoc_disable(struct wlan_objmgr_psoc *psoc) struct wlan_lmac_if_tx_ops *tx_ops; tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + qdf_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + if (tx_ops->dbr_tx_ops.direct_buf_rx_unregister_events) return tx_ops->dbr_tx_ops.direct_buf_rx_unregister_events(psoc); diff --git a/target_if/cfr/src/target_if_cfr.c b/target_if/cfr/src/target_if_cfr.c index 52065019a5..9cdd420762 100644 --- a/target_if/cfr/src/target_if_cfr.c +++ b/target_if/cfr/src/target_if_cfr.c @@ -162,8 +162,14 @@ int target_if_cfr_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) { + cfr_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); @@ -468,8 +474,15 @@ void target_if_cfr_tx_ops_register(struct wlan_lmac_if_tx_ops *tx_ops) void target_if_cfr_set_cfr_support(struct wlan_objmgr_psoc *psoc, uint8_t value) { - if (psoc->soc_cb.rx_ops.cfr_rx_ops.cfr_support_set) - psoc->soc_cb.rx_ops.cfr_rx_ops.cfr_support_set(psoc, value); + struct wlan_lmac_if_rx_ops *rx_ops; + + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + cfr_err("rx_ops is NULL"); + return; + } + if (rx_ops->cfr_rx_ops.cfr_support_set) + rx_ops->cfr_rx_ops.cfr_support_set(psoc, value); } void target_if_cfr_info_send(struct wlan_objmgr_pdev *pdev, void *head, @@ -477,11 +490,16 @@ void target_if_cfr_info_send(struct wlan_objmgr_pdev *pdev, void *head, size_t tlen) { struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_rx_ops *rx_ops; psoc = wlan_pdev_get_psoc(pdev); - if (psoc->soc_cb.rx_ops.cfr_rx_ops.cfr_info_send) - psoc->soc_cb.rx_ops.cfr_rx_ops.cfr_info_send(pdev, head, hlen, - data, dlen, tail, - tlen); + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + cfr_err("rx_ops is NULL"); + return; + } + if (rx_ops->cfr_rx_ops.cfr_info_send) + rx_ops->cfr_rx_ops.cfr_info_send(pdev, head, hlen, data, dlen, + tail, tlen); } diff --git a/target_if/cfr/src/target_if_cfr_6018.c b/target_if/cfr/src/target_if_cfr_6018.c index fd28c704e2..c1ddf2948c 100644 --- a/target_if/cfr/src/target_if_cfr_6018.c +++ b/target_if/cfr/src/target_if_cfr_6018.c @@ -598,6 +598,7 @@ void target_if_cfr_rx_tlv_process(struct wlan_objmgr_pdev *pdev, void *nbuf) struct wlan_lmac_if_cfr_rx_ops *cfr_rx_ops = NULL; struct cfr_metadata_version_3 *meta = NULL; uint8_t srng_id = 0; + struct wlan_lmac_if_rx_ops *rx_ops; if (qdf_unlikely(!pdev)) { cfr_err("pdev is null\n"); @@ -631,7 +632,12 @@ void target_if_cfr_rx_tlv_process(struct wlan_objmgr_pdev *pdev, void *nbuf) goto relref; } - cfr_rx_ops = &psoc->soc_cb.rx_ops.cfr_rx_ops; + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + cfr_err("rx_ops is NULL"); + goto relref; + } + cfr_rx_ops = &rx_ops->cfr_rx_ops; buf_addr_extn = cfr_info->rtt_che_buffer_pointer_high8 & 0xF; buf_addr = (cfr_info->rtt_che_buffer_pointer_low32 | ((uint64_t)buf_addr_extn << 32)); @@ -802,6 +808,7 @@ static bool enh_cfr_dbr_event_handler(struct wlan_objmgr_pdev *pdev, uint8_t *peer_macaddr = NULL; struct wlan_lmac_if_cfr_rx_ops *cfr_rx_ops = NULL; struct cfr_metadata_version_3 *meta = NULL; + struct wlan_lmac_if_rx_ops *rx_ops; if ((!pdev) || (!payload)) { cfr_err("pdev or payload is null"); @@ -814,7 +821,12 @@ static bool enh_cfr_dbr_event_handler(struct wlan_objmgr_pdev *pdev, return true; } - cfr_rx_ops = &psoc->soc_cb.rx_ops.cfr_rx_ops; + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + cfr_err("rx_ops is NULL"); + return true; + } + cfr_rx_ops = &rx_ops->cfr_rx_ops; pcfr = wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_CFR); @@ -932,9 +944,15 @@ target_if_register_to_dbr_enh(struct wlan_objmgr_pdev *pdev) struct wlan_objmgr_psoc *psoc; struct wlan_lmac_if_direct_buf_rx_tx_ops *dbr_tx_ops = NULL; struct dbr_module_config dbr_config; + 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; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + cfr_err("tx_ops is NULL"); + return QDF_STATUS_SUCCESS; + } + dbr_tx_ops = &tx_ops->dbr_tx_ops; dbr_config.num_resp_per_event = DBR_NUM_RESP_PER_EVENT_CFR; dbr_config.event_timeout_in_ms = DBR_EVENT_TIMEOUT_IN_MS_CFR; if (dbr_tx_ops->direct_buf_rx_module_register) { @@ -957,9 +975,15 @@ target_if_unregister_to_dbr_enh(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_tx_ops *tx_ops; psoc = wlan_pdev_get_psoc(pdev); - dbr_tx_ops = &psoc->soc_cb.tx_ops.dbr_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + cfr_err("tx_ops is NULL"); + return QDF_STATUS_SUCCESS; + } + dbr_tx_ops = &tx_ops->dbr_tx_ops; if (dbr_tx_ops->direct_buf_rx_module_unregister) { return dbr_tx_ops->direct_buf_rx_module_unregister (pdev, DBR_MODULE_CFR); @@ -1057,6 +1081,7 @@ target_if_peer_capture_event(ol_scn_t sc, uint8_t *data, uint32_t datalen) int status; struct wlan_channel *bss_chan; struct wlan_lmac_if_cfr_rx_ops *cfr_rx_ops = NULL; + struct wlan_lmac_if_rx_ops *rx_ops; if (!sc || !data) { cfr_err("sc or data is null"); @@ -1069,7 +1094,12 @@ target_if_peer_capture_event(ol_scn_t sc, uint8_t *data, uint32_t datalen) return -EINVAL; } - cfr_rx_ops = &psoc->soc_cb.rx_ops.cfr_rx_ops; + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + cfr_err("rx_ops is NULL"); + return -EINVAL; + } + cfr_rx_ops = &rx_ops->cfr_rx_ops; retval = wlan_objmgr_psoc_try_get_ref(psoc, WLAN_CFR_ID); if (QDF_IS_STATUS_ERROR(retval)) { diff --git a/target_if/cp_stats/inc/target_if_cp_stats.h b/target_if/cp_stats/inc/target_if_cp_stats.h index 58d940a654..8b238fbedd 100644 --- a/target_if/cp_stats/inc/target_if_cp_stats.h +++ b/target_if/cp_stats/inc/target_if_cp_stats.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018, 2020 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 @@ -41,7 +41,15 @@ static inline struct wlan_lmac_if_cp_stats_rx_ops * target_if_cp_stats_get_rx_ops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.rx_ops.cp_stats_rx_ops; + struct wlan_lmac_if_rx_ops *rx_ops; + + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + cp_stats_err("rx_ops is NULL"); + return NULL; + } + + return &rx_ops->cp_stats_rx_ops; } /** @@ -53,7 +61,15 @@ target_if_cp_stats_get_rx_ops(struct wlan_objmgr_psoc *psoc) static inline struct wlan_lmac_if_cp_stats_tx_ops * target_if_cp_stats_get_tx_ops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.tx_ops.cp_stats_tx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + cp_stats_err("tx_ops is NULL"); + return NULL; + } + + return &tx_ops->cp_stats_tx_ops; } /** diff --git a/target_if/dcs/inc/target_if_dcs.h b/target_if/dcs/inc/target_if_dcs.h index 9520878f26..801d8d1d27 100644 --- a/target_if/dcs/inc/target_if_dcs.h +++ b/target_if/dcs/inc/target_if_dcs.h @@ -38,7 +38,14 @@ static inline struct wlan_target_if_dcs_rx_ops * target_if_dcs_get_rx_ops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.rx_ops.dcs_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->dcs_rx_ops; } /** @@ -52,7 +59,14 @@ target_if_dcs_get_rx_ops(struct wlan_objmgr_psoc *psoc) static inline struct wlan_target_if_dcs_tx_ops * target_if_dcs_get_tx_ops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.tx_ops.dcs_tx_ops; + struct wlan_lmac_if_tx_ops *tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + target_if_err("tx_ops is NULL"); + return NULL; + } + return &tx_ops->dcs_tx_ops; } /** diff --git a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c index cf9e7eabf2..eb64c1a28b 100644 --- a/target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c +++ b/target_if/direct_buf_rx/src/target_if_direct_buf_rx_api.c @@ -24,6 +24,7 @@ #include #include "target_if_direct_buf_rx_main.h" #include +#include #if defined(WLAN_DEBUGFS) && defined(DIRECT_BUF_RX_DEBUG) /* Base debugfs entry for DBR module */ diff --git a/target_if/ftm/src/target_if_ftm.c b/target_if/ftm/src/target_if_ftm.c index 0e4e765632..cd776f055c 100644 --- a/target_if/ftm/src/target_if_ftm.c +++ b/target_if/ftm/src/target_if_ftm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018, 2020 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -32,7 +32,15 @@ static inline struct wlan_lmac_if_ftm_rx_ops * target_if_ftm_get_rx_ops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.rx_ops.ftm_rx_ops; + struct wlan_lmac_if_rx_ops *rx_ops; + + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + ftm_err("rx_ops is NULL"); + return NULL; + } + + return &rx_ops->ftm_rx_ops; } static int @@ -89,7 +97,10 @@ target_if_ftm_process_utf_event(ol_scn_t sc, uint8_t *event_buf, uint32_t len) } ftm_rx_ops = target_if_ftm_get_rx_ops(psoc); - + if (!ftm_rx_ops) { + ftm_err("ftm_rx_ops is NULL"); + return QDF_STATUS_E_INVAL; + } if (ftm_rx_ops->ftm_ev_handler) { status = ftm_rx_ops->ftm_ev_handler(pdev, event.data, event.datalen); diff --git a/target_if/mlme/vdev_mgr/inc/target_if_vdev_mgr_rx_ops.h b/target_if/mlme/vdev_mgr/inc/target_if_vdev_mgr_rx_ops.h index 7cda52628d..9d15575f36 100644 --- a/target_if/mlme/vdev_mgr/inc/target_if_vdev_mgr_rx_ops.h +++ b/target_if/mlme/vdev_mgr/inc/target_if_vdev_mgr_rx_ops.h @@ -114,7 +114,15 @@ static inline bool target_if_vdev_mgr_is_panic_on_bug(void) static inline struct wlan_lmac_if_mlme_rx_ops * target_if_vdev_mgr_get_rx_ops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.rx_ops.mops; + struct wlan_lmac_if_rx_ops *rx_ops; + + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + qdf_err("rx_ops is NULL"); + return NULL; + } + + return &rx_ops->mops; } /** diff --git a/target_if/mlme/vdev_mgr/inc/target_if_vdev_mgr_tx_ops.h b/target_if/mlme/vdev_mgr/inc/target_if_vdev_mgr_tx_ops.h index 14fd51c639..ea9bae8f80 100644 --- a/target_if/mlme/vdev_mgr/inc/target_if_vdev_mgr_tx_ops.h +++ b/target_if/mlme/vdev_mgr/inc/target_if_vdev_mgr_tx_ops.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2019-2020 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 @@ -48,7 +48,15 @@ struct wmi_unified *target_if_vdev_mgr_wmi_handle_get( static inline struct wlan_lmac_if_mlme_tx_ops * target_if_vdev_mgr_get_tx_ops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.tx_ops.mops; + struct wlan_lmac_if_tx_ops *tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + mlme_err("tx_ops is NULL"); + return NULL; + } + + return &tx_ops->mops; } /** diff --git a/target_if/scan/src/target_if_scan.c b/target_if/scan/src/target_if_scan.c index a3b825bfac..7e1e0f3f67 100644 --- a/target_if/scan/src/target_if_scan.c +++ b/target_if/scan/src/target_if_scan.c @@ -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 * any purpose with or without fee is hereby granted, provided that the @@ -32,7 +32,15 @@ static inline struct wlan_lmac_if_scan_rx_ops * target_if_scan_get_rx_ops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.rx_ops.scan; + 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->scan; } static int @@ -73,6 +81,11 @@ target_if_scan_event_handler(ol_scn_t scn, uint8_t *data, uint32_t datalen) } scan_rx_ops = target_if_scan_get_rx_ops(psoc); + if (!scan_rx_ops) { + target_if_err("scan_rx_ops is NULL"); + return -EINVAL; + } + if (scan_rx_ops->scan_ev_handler) { status = scan_rx_ops->scan_ev_handler(psoc, event_info); if (status != QDF_STATUS_SUCCESS) { @@ -130,6 +143,11 @@ int target_if_nlo_complete_handler(ol_scn_t scn, uint8_t *data, event_info->event.vdev_id); scan_rx_ops = target_if_scan_get_rx_ops(psoc); + if (!scan_rx_ops) { + target_if_err("scan_rx_ops is NULL"); + return -EINVAL; + } + if (scan_rx_ops->scan_ev_handler) { status = scan_rx_ops->scan_ev_handler(psoc, event_info); if (status != QDF_STATUS_SUCCESS) { @@ -185,6 +203,11 @@ int target_if_nlo_match_event_handler(ol_scn_t scn, uint8_t *data, event_info->event.vdev_id); scan_rx_ops = target_if_scan_get_rx_ops(psoc); + if (!scan_rx_ops) { + target_if_err("scan_rx_ops is NULL"); + return -EINVAL; + } + if (scan_rx_ops->scan_ev_handler) { status = scan_rx_ops->scan_ev_handler(psoc, event_info); if (status != QDF_STATUS_SUCCESS) { @@ -444,6 +467,11 @@ target_if_scan_set_max_active_scans(struct wlan_objmgr_psoc *psoc, QDF_STATUS status; scan_rx_ops = target_if_scan_get_rx_ops(psoc); + if (!scan_rx_ops) { + target_if_err("scan_rx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + if (scan_rx_ops->scan_set_max_active_scans) { status = scan_rx_ops->scan_set_max_active_scans(psoc, max_active_scans); diff --git a/target_if/wifi_pos/src/target_if_wifi_pos.c b/target_if/wifi_pos/src/target_if_wifi_pos.c index e1aa7640a8..83d35e113f 100644 --- a/target_if/wifi_pos/src/target_if_wifi_pos.c +++ b/target_if/wifi_pos/src/target_if_wifi_pos.c @@ -321,12 +321,20 @@ void target_if_wifi_pos_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) inline struct wlan_lmac_if_wifi_pos_rx_ops *target_if_wifi_pos_get_rxops( struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_rx_ops *rx_ops; + if (!psoc) { target_if_err("passed psoc is NULL"); return NULL; } - return &psoc->soc_cb.rx_ops.wifi_pos_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->wifi_pos_rx_ops; } QDF_STATUS target_if_wifi_pos_register_events(struct wlan_objmgr_psoc *psoc) diff --git a/umac/cfr/dispatcher/src/wlan_cfr_tgt_api.c b/umac/cfr/dispatcher/src/wlan_cfr_tgt_api.c index 3504ee5abd..65df049c4b 100644 --- a/umac/cfr/dispatcher/src/wlan_cfr_tgt_api.c +++ b/umac/cfr/dispatcher/src/wlan_cfr_tgt_api.c @@ -76,15 +76,28 @@ void tgt_cfr_support_set(struct wlan_objmgr_psoc *psoc, uint32_t value) static inline struct wlan_lmac_if_cfr_tx_ops * wlan_psoc_get_cfr_txops(struct wlan_objmgr_psoc *psoc) { - return &((psoc->soc_cb.tx_ops.cfr_tx_ops)); + struct wlan_lmac_if_tx_ops *tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + cfr_err("tx_ops is NULL"); + return NULL; + } + return &tx_ops->cfr_tx_ops; } int tgt_cfr_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) { + cfr_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); diff --git a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h index 11240ad0e3..221806d7f1 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_def_i.h +++ b/umac/cmn_services/crypto/src/wlan_crypto_def_i.h @@ -161,18 +161,18 @@ static inline void wlan_crypto_put_be64(u8 *a, u64 val) a[7] = val & 0xff; } -#define WLAN_CRYPTO_TX_OPS_ALLOCKEY(psoc) \ - (psoc->soc_cb.tx_ops.crypto_tx_ops.allockey) -#define WLAN_CRYPTO_TX_OPS_SETKEY(psoc) \ - (psoc->soc_cb.tx_ops.crypto_tx_ops.setkey) -#define WLAN_CRYPTO_TX_OPS_DELKEY(psoc) \ - (psoc->soc_cb.tx_ops.crypto_tx_ops.delkey) -#define WLAN_CRYPTO_TX_OPS_DEFAULTKEY(psoc) \ - (psoc->soc_cb.tx_ops.crypto_tx_ops.defaultkey) -#define WLAN_CRYPTO_TX_OPS_SET_KEY(psoc) \ - ((psoc)->soc_cb.tx_ops.crypto_tx_ops.set_key) -#define WLAN_CRYPTO_TX_OPS_GETPN(psoc) \ - ((psoc)->soc_cb.tx_ops.crypto_tx_ops.getpn) +#define WLAN_CRYPTO_TX_OPS_ALLOCKEY(tx_ops) \ + ((tx_ops)->crypto_tx_ops.allockey) +#define WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops) \ + ((tx_ops)->crypto_tx_ops.setkey) +#define WLAN_CRYPTO_TX_OPS_DELKEY(tx_ops) \ + ((tx_ops)->crypto_tx_ops.delkey) +#define WLAN_CRYPTO_TX_OPS_DEFAULTKEY(tx_ops) \ + ((tx_ops)->crypto_tx_ops.defaultkey) +#define WLAN_CRYPTO_TX_OPS_SET_KEY(tx_ops) \ + ((tx_ops)->crypto_tx_ops.set_key) +#define WLAN_CRYPTO_TX_OPS_GETPN(tx_ops) \ + ((tx_ops)->crypto_tx_ops.getpn) /* unalligned little endian access */ #ifndef LE_READ_2 diff --git a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c index f21d686d2e..4eab5e7dcf 100644 --- a/umac/cmn_services/crypto/src/wlan_crypto_global_api.c +++ b/umac/cmn_services/crypto/src/wlan_crypto_global_api.c @@ -641,6 +641,7 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev, enum QDF_OPMODE vdev_mode; uint8_t igtk_idx = 0; uint8_t bigtk_idx = 0; + struct wlan_lmac_if_tx_ops *tx_ops; if (!vdev || !req_key || req_key->keylen > (sizeof(req_key->keydata))) { crypto_err("Invalid params vdev%pK, req_key%pK", vdev, req_key); @@ -935,14 +936,20 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev, } } + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + crypto_err("tx_ops is NULL"); + return QDF_STATUS_E_INVAL; + } + qdf_mem_copy(key->keyval, req_key->keydata, sizeof(key->keyval)); key->valid = 1; if ((IS_MGMT_CIPHER(req_key->type))) { if (HAS_CIPHER_CAP(crypto_params, WLAN_CRYPTO_CAP_PMF_OFFLOAD) || is_bigtk(req_key->keyix)) { - if (WLAN_CRYPTO_TX_OPS_SETKEY(psoc)) { - WLAN_CRYPTO_TX_OPS_SETKEY(psoc)(vdev, + if (WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops)) { + WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops)(vdev, key, macaddr, req_key->type); } } @@ -953,9 +960,9 @@ QDF_STATUS wlan_crypto_setkey(struct wlan_objmgr_vdev *vdev, /* Take request key object to FILS setkey */ key->private = req_key; } else { - if (WLAN_CRYPTO_TX_OPS_SETKEY(psoc)) { - WLAN_CRYPTO_TX_OPS_SETKEY(psoc)(vdev, key, - macaddr, req_key->type); + if (WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops)) { + WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops)(vdev, key, macaddr, + req_key->type); } } status = cipher->setkey(key); @@ -1094,6 +1101,7 @@ QDF_STATUS wlan_crypto_getkey(struct wlan_objmgr_vdev *vdev, struct wlan_crypto_cipher *cipher_table; struct wlan_crypto_key *key; struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_tx_ops *tx_ops; uint8_t macaddr[QDF_MAC_ADDR_SIZE] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; @@ -1129,10 +1137,17 @@ QDF_STATUS wlan_crypto_getkey(struct wlan_objmgr_vdev *vdev, return QDF_STATUS_E_NOENT; } key = wlan_crypto_peer_getkey(peer, req_key->keyix); - if (WLAN_CRYPTO_TX_OPS_GETPN(psoc) && + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + crypto_err("tx_ops is NULL"); + return QDF_STATUS_E_INVAL; + } + + if (WLAN_CRYPTO_TX_OPS_GETPN(tx_ops) && (req_key->flags & WLAN_CRYPTO_KEY_GET_PN)) - WLAN_CRYPTO_TX_OPS_GETPN(psoc)(vdev, mac_addr, - req_key->type); + WLAN_CRYPTO_TX_OPS_GETPN(tx_ops)(vdev, mac_addr, + req_key->type); wlan_objmgr_peer_release_ref(peer, WLAN_CRYPTO_ID); if (!key) return QDF_STATUS_E_INVAL; @@ -1187,6 +1202,7 @@ QDF_STATUS wlan_crypto_delkey(struct wlan_objmgr_vdev *vdev, struct wlan_crypto_key *key; struct wlan_crypto_cipher *cipher_table; struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_tx_ops *tx_ops; uint8_t bssid_mac[QDF_MAC_ADDR_SIZE]; if (!vdev || !macaddr || @@ -1266,10 +1282,16 @@ QDF_STATUS wlan_crypto_delkey(struct wlan_objmgr_vdev *vdev, cipher_table = (struct wlan_crypto_cipher *)key->cipher_table; qdf_mem_zero(key->keyval, sizeof(key->keyval)); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + crypto_err("tx_ops is NULL"); + return QDF_STATUS_E_INVAL; + } + if (!IS_FILS_CIPHER(cipher_table->cipher) && - WLAN_CRYPTO_TX_OPS_DELKEY(psoc)) { - WLAN_CRYPTO_TX_OPS_DELKEY(psoc)(vdev, key, - macaddr, cipher_table->cipher); + WLAN_CRYPTO_TX_OPS_DELKEY(tx_ops)) { + WLAN_CRYPTO_TX_OPS_DELKEY(tx_ops)(vdev, key, macaddr, + cipher_table->cipher); } else if (IS_FILS_CIPHER(cipher_table->cipher)) { if (key->private) qdf_mem_free(key->private); @@ -1294,17 +1316,23 @@ static QDF_STATUS wlan_crypto_set_default_key(struct wlan_objmgr_vdev *vdev, uint8_t key_idx, uint8_t *macaddr) { struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_vdev_get_psoc(vdev); if (!psoc) { crypto_err("psoc is NULL"); return QDF_STATUS_E_INVAL; } - if (WLAN_CRYPTO_TX_OPS_DEFAULTKEY(psoc)) { - WLAN_CRYPTO_TX_OPS_DEFAULTKEY(psoc)(vdev, key_idx, - macaddr); + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + crypto_err("tx_ops is NULL"); + return QDF_STATUS_E_INVAL; } + if (WLAN_CRYPTO_TX_OPS_DEFAULTKEY(tx_ops)) + WLAN_CRYPTO_TX_OPS_DEFAULTKEY(tx_ops)(vdev, key_idx, macaddr); + return QDF_STATUS_SUCCESS; } #endif @@ -3318,6 +3346,7 @@ QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev, struct wlan_crypto_key *sta_key; struct wlan_crypto_cipher *cipher_table; struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_tx_ops *tx_ops; uint8_t *mac_addr; int i; enum QDF_OPMODE opmode; @@ -3379,6 +3408,12 @@ QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev, key->cipher_table; if (cipher_table->cipher == WLAN_CRYPTO_CIPHER_WEP) { + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + crypto_err("tx_ops is NULL"); + return QDF_STATUS_E_INVAL; + } + sta_key = qdf_mem_malloc( sizeof(struct wlan_crypto_key)); if (!sta_key) { @@ -3401,19 +3436,21 @@ QDF_STATUS wlan_crypto_set_peer_wep_keys(struct wlan_objmgr_vdev *vdev, /* setting the broadcast/multicast key for sta*/ if (opmode == QDF_STA_MODE || opmode == QDF_IBSS_MODE){ - if (WLAN_CRYPTO_TX_OPS_SETKEY(psoc)) { - WLAN_CRYPTO_TX_OPS_SETKEY(psoc)( - vdev, sta_key, mac_addr, + if (WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops)) { + WLAN_CRYPTO_TX_OPS_SETKEY( + tx_ops)(vdev, sta_key, + mac_addr, cipher_table->cipher); } } /* setting unicast key */ sta_key->flags &= ~WLAN_CRYPTO_KEY_GROUP; - if (WLAN_CRYPTO_TX_OPS_SETKEY(psoc)) { - WLAN_CRYPTO_TX_OPS_SETKEY(psoc)(vdev, - sta_key, mac_addr, - cipher_table->cipher); + if (WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops)) { + WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops)( + vdev, sta_key, + mac_addr, + cipher_table->cipher); } } } @@ -3456,8 +3493,16 @@ QDF_STATUS wlan_crypto_register_crypto_rx_ops( struct wlan_lmac_if_crypto_rx_ops *wlan_crypto_get_crypto_rx_ops( struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_rx_ops *rx_ops; - return &(psoc->soc_cb.rx_ops.crypto_rx_ops); + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + + if (!rx_ops) { + crypto_err("rx_ops is NULL"); + return NULL; + } + + return &rx_ops->crypto_rx_ops; } qdf_export_symbol(wlan_crypto_get_crypto_rx_ops); @@ -3755,6 +3800,7 @@ static void crypto_plumb_peer_keys(struct wlan_objmgr_vdev *vdev, struct wlan_crypto_comp_priv *crypto_priv; struct wlan_crypto_params *crypto_params; struct wlan_crypto_key *key = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; int i; if ((!peer) || (!vdev) || (!psoc)) { @@ -3773,8 +3819,14 @@ static void crypto_plumb_peer_keys(struct wlan_objmgr_vdev *vdev, for (i = 0; i < WLAN_CRYPTO_MAXKEYIDX; i++) { key = crypto_priv->key[i]; if (key && key->valid) { - if (WLAN_CRYPTO_TX_OPS_SETKEY(psoc)) { - WLAN_CRYPTO_TX_OPS_SETKEY(psoc) + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + + if (!tx_ops) { + crypto_err("tx_ops is NULL"); + return; + } + if (WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops)) { + WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops) ( vdev, key, @@ -3805,6 +3857,7 @@ void wlan_crypto_restore_keys(struct wlan_objmgr_vdev *vdev) {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; struct wlan_objmgr_pdev *pdev = NULL; struct wlan_objmgr_psoc *psoc = NULL; + struct wlan_lmac_if_tx_ops *tx_ops; pdev = wlan_vdev_get_pdev(vdev); psoc = wlan_vdev_get_psoc(vdev); @@ -3833,8 +3886,13 @@ void wlan_crypto_restore_keys(struct wlan_objmgr_vdev *vdev) } key = crypto_priv->key[i]; if (key && key->valid) { - if (WLAN_CRYPTO_TX_OPS_SETKEY(psoc)) { - WLAN_CRYPTO_TX_OPS_SETKEY(psoc) + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + crypto_err("tx_ops is NULL"); + return; + } + if (WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops)) { + WLAN_CRYPTO_TX_OPS_SETKEY(tx_ops) ( vdev, key, @@ -4317,10 +4375,18 @@ QDF_STATUS wlan_crypto_set_key_req(struct wlan_objmgr_vdev *vdev, enum wlan_crypto_key_type key_type) { struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_tx_ops *tx_ops; psoc = wlan_vdev_get_psoc(vdev); - if (psoc && WLAN_CRYPTO_TX_OPS_SET_KEY(psoc)) - WLAN_CRYPTO_TX_OPS_SET_KEY(psoc)(vdev, req, key_type); + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + crypto_err("tx_ops is NULL"); + return QDF_STATUS_E_FAILURE; + } + + if (psoc && WLAN_CRYPTO_TX_OPS_SET_KEY(tx_ops)) + WLAN_CRYPTO_TX_OPS_SET_KEY(tx_ops)(vdev, req, key_type); else return QDF_STATUS_E_FAILURE; diff --git a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c index 4682701cfc..88c6af38ec 100644 --- a/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c +++ b/umac/cmn_services/mgmt_txrx/dispatcher/src/wlan_mgmt_txrx_utils_api.c @@ -370,6 +370,8 @@ QDF_STATUS wlan_mgmt_txrx_mgmt_frame_tx(struct wlan_objmgr_peer *peer, struct mgmt_txrx_priv_pdev_context *txrx_ctx; struct wlan_objmgr_vdev *vdev; QDF_STATUS status; + struct wlan_lmac_if_tx_ops *tx_ops; + struct wlan_lmac_if_rx_ops *rx_ops; if (!peer) { mgmt_txrx_err("peer passed is NULL"); @@ -428,18 +430,28 @@ QDF_STATUS wlan_mgmt_txrx_mgmt_frame_tx(struct wlan_objmgr_peer *peer, desc->vdev_id = wlan_vdev_get_id(vdev); desc->context = context; - if (psoc->soc_cb.rx_ops.iot_sim_rx_ops.iot_sim_cmd_handler) { - status = psoc->soc_cb.rx_ops.iot_sim_rx_ops.iot_sim_cmd_handler( - vdev, buf); + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + mgmt_txrx_err("rx_ops is NULL"); + return QDF_STATUS_E_NULL_VALUE; + } + + if (rx_ops->iot_sim_rx_ops.iot_sim_cmd_handler) { + status = rx_ops->iot_sim_rx_ops.iot_sim_cmd_handler(vdev, buf); if (status) { mgmt_txrx_err("iot_sim_cmd_handler returned failure, dropping the frame"); return QDF_STATUS_E_FAILURE; } } - if (!psoc->soc_cb.tx_ops.mgmt_txrx_tx_ops.mgmt_tx_send) { - mgmt_txrx_err( - "mgmt txrx txop to send mgmt frame is NULL for psoc: %pK", + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + mgmt_txrx_err("tx_ops is NULL"); + return QDF_STATUS_E_NULL_VALUE; + } + + if (!tx_ops->mgmt_txrx_tx_ops.mgmt_tx_send) { + mgmt_txrx_err("mgmt txrx txop to send mgmt frame is NULL for psoc: %pK", psoc); wlan_objmgr_peer_release_ref(peer, WLAN_MGMT_NB_ID); desc->nbuf = NULL; @@ -447,7 +459,7 @@ QDF_STATUS wlan_mgmt_txrx_mgmt_frame_tx(struct wlan_objmgr_peer *peer, return QDF_STATUS_E_FAILURE; } - if (psoc->soc_cb.tx_ops.mgmt_txrx_tx_ops.mgmt_tx_send( + if (tx_ops->mgmt_txrx_tx_ops.mgmt_tx_send( vdev, buf, desc->desc_id, mgmt_tx_params)) { mgmt_txrx_err("Mgmt send fail for peer %pK psoc %pK pdev: %pK", peer, psoc, pdev); @@ -465,6 +477,7 @@ QDF_STATUS wlan_mgmt_txrx_beacon_frame_tx(struct wlan_objmgr_peer *peer, { struct wlan_objmgr_vdev *vdev; struct wlan_objmgr_psoc *psoc; + struct wlan_lmac_if_tx_ops *tx_ops; vdev = wlan_peer_get_vdev(peer); if (!vdev) { @@ -478,13 +491,19 @@ QDF_STATUS wlan_mgmt_txrx_beacon_frame_tx(struct wlan_objmgr_peer *peer, return QDF_STATUS_E_NULL_VALUE; } - if (!psoc->soc_cb.tx_ops.mgmt_txrx_tx_ops.beacon_send) { + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + mgmt_txrx_err("tx_ops is NULL"); + return QDF_STATUS_E_NULL_VALUE; + } + + if (!tx_ops->mgmt_txrx_tx_ops.beacon_send) { mgmt_txrx_err("mgmt txrx tx op to send beacon frame is NULL for psoc: %pK", psoc); return QDF_STATUS_E_FAILURE; } - if (psoc->soc_cb.tx_ops.mgmt_txrx_tx_ops.beacon_send(vdev, buf)) { + if (tx_ops->mgmt_txrx_tx_ops.beacon_send(vdev, buf)) { mgmt_txrx_err("Beacon send fail for peer %pK psoc %pK", peer, psoc); return QDF_STATUS_E_FAILURE; @@ -500,6 +519,7 @@ wlan_mgmt_txrx_fd_action_frame_tx(struct wlan_objmgr_vdev *vdev, { struct wlan_objmgr_psoc *psoc; uint32_t vdev_id; + struct wlan_lmac_if_tx_ops *tx_ops; if (!vdev) { mgmt_txrx_err("Invalid vdev"); @@ -512,12 +532,18 @@ wlan_mgmt_txrx_fd_action_frame_tx(struct wlan_objmgr_vdev *vdev, return QDF_STATUS_E_NULL_VALUE; } - if (!psoc->soc_cb.tx_ops.mgmt_txrx_tx_ops.fd_action_frame_send) { + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + mgmt_txrx_err("tx_ops is NULL"); + return QDF_STATUS_E_NULL_VALUE; + } + + if (!tx_ops->mgmt_txrx_tx_ops.fd_action_frame_send) { mgmt_txrx_err("mgmt txrx txop to send fd action frame is NULL"); return QDF_STATUS_E_FAILURE; } - if (psoc->soc_cb.tx_ops.mgmt_txrx_tx_ops.fd_action_frame_send( + if (tx_ops->mgmt_txrx_tx_ops.fd_action_frame_send( vdev, buf)) { mgmt_txrx_err("FD send fail for vdev %d", vdev_id); return QDF_STATUS_E_FAILURE; @@ -744,6 +770,7 @@ QDF_STATUS wlan_mgmt_txrx_pdev_close(struct wlan_objmgr_pdev *pdev) struct mgmt_txrx_desc_elem_t *mgmt_desc; uint32_t pool_size; uint32_t index; + struct wlan_lmac_if_tx_ops *tx_ops; if (!pdev) { mgmt_txrx_err("pdev context is NULL"); @@ -756,6 +783,12 @@ QDF_STATUS wlan_mgmt_txrx_pdev_close(struct wlan_objmgr_pdev *pdev) return QDF_STATUS_E_NULL_VALUE; } + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + mgmt_txrx_err("tx_ops is NULL"); + return QDF_STATUS_E_NULL_VALUE; + } + mgmt_txrx_pdev_ctx = (struct mgmt_txrx_priv_pdev_context *) wlan_objmgr_pdev_get_comp_private_obj(pdev, WLAN_UMAC_COMP_MGMT_TXRX); @@ -777,9 +810,9 @@ QDF_STATUS wlan_mgmt_txrx_pdev_close(struct wlan_objmgr_pdev *pdev) "mgmt descriptor with desc id: %d not in freelist", index); mgmt_desc = &mgmt_txrx_pdev_ctx->mgmt_desc_pool.pool[index]; - if (psoc->soc_cb.tx_ops.mgmt_txrx_tx_ops. + if (tx_ops->mgmt_txrx_tx_ops. tx_drain_nbuf_op) - psoc->soc_cb.tx_ops.mgmt_txrx_tx_ops. + tx_ops->mgmt_txrx_tx_ops. tx_drain_nbuf_op(pdev, mgmt_desc->nbuf); qdf_nbuf_free(mgmt_desc->nbuf); wlan_objmgr_peer_release_ref(mgmt_desc->peer, diff --git a/umac/coex/dispatcher/src/wlan_coex_tgt_api.c b/umac/coex/dispatcher/src/wlan_coex_tgt_api.c index 4022a7c13e..a53a5fd740 100644 --- a/umac/coex/dispatcher/src/wlan_coex_tgt_api.c +++ b/umac/coex/dispatcher/src/wlan_coex_tgt_api.c @@ -26,7 +26,15 @@ static inline struct wlan_lmac_if_coex_tx_ops * wlan_psoc_get_coex_txops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.tx_ops.coex_ops; + struct wlan_lmac_if_tx_ops *tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + coex_err("tx_ops is NULL"); + return NULL; + } + + return &tx_ops->coex_ops; } static inline struct wlan_lmac_if_coex_tx_ops * diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_api.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_api.h index 578a6fcaaf..dc42ee1f7d 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_api.h +++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2018, 2020 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -61,10 +61,18 @@ QDF_STATUS wlan_lmac_if_set_umac_txops_registration_cb static inline struct wlan_lmac_if_mgmt_txrx_rx_ops * wlan_lmac_if_get_mgmt_txrx_rx_ops(struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_rx_ops *rx_ops; + if (!psoc) return NULL; - return &psoc->soc_cb.rx_ops.mgmt_txrx_rx_ops; + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + qdf_err("rx_ops is NULL"); + return NULL; + } + + return &rx_ops->mgmt_txrx_rx_ops; } /** @@ -78,10 +86,18 @@ wlan_lmac_if_get_mgmt_txrx_rx_ops(struct wlan_objmgr_psoc *psoc) static inline struct wlan_lmac_if_dfs_rx_ops * wlan_lmac_if_get_dfs_rx_ops(struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_rx_ops *rx_ops; + if (!psoc) return NULL; - return &psoc->soc_cb.rx_ops.dfs_rx_ops; + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + qdf_err("rx_ops is NULL"); + return NULL; + } + + return &rx_ops->dfs_rx_ops; } /** @@ -95,10 +111,18 @@ wlan_lmac_if_get_dfs_rx_ops(struct wlan_objmgr_psoc *psoc) static inline struct wlan_lmac_if_reg_rx_ops * wlan_lmac_if_get_reg_rx_ops(struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_rx_ops *rx_ops; + if (!psoc) return NULL; - return &psoc->soc_cb.rx_ops.reg_rx_ops; + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + qdf_err("rx_ops is NULL"); + return NULL; + } + + return &rx_ops->reg_rx_ops; } #ifdef WLAN_SUPPORT_GREEN_AP @@ -113,10 +137,18 @@ wlan_lmac_if_get_reg_rx_ops(struct wlan_objmgr_psoc *psoc) static inline struct wlan_lmac_if_green_ap_rx_ops * wlan_lmac_if_get_green_ap_rx_ops(struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_rx_ops *rx_ops; + if (!psoc) return NULL; - return &psoc->soc_cb.rx_ops.green_ap_rx_ops; + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + qdf_err("rx_ops is NULL"); + return NULL; + } + + return &rx_ops->green_ap_rx_ops; } #endif diff --git a/umac/green_ap/core/src/wlan_green_ap_main.c b/umac/green_ap/core/src/wlan_green_ap_main.c index f0fc6b768d..1a0ed4ee38 100644 --- a/umac/green_ap/core/src/wlan_green_ap_main.c +++ b/umac/green_ap/core/src/wlan_green_ap_main.c @@ -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 * any purpose with or without fee is hereby granted, provided that the @@ -70,6 +70,7 @@ wlan_psoc_get_green_ap_tx_ops(struct wlan_pdev_green_ap_ctx *green_ap_ctx) { struct wlan_objmgr_psoc *psoc; struct wlan_objmgr_pdev *pdev = green_ap_ctx->pdev; + struct wlan_lmac_if_tx_ops *tx_ops; if (!pdev) { green_ap_err("pdev context obtained is NULL"); @@ -82,7 +83,13 @@ wlan_psoc_get_green_ap_tx_ops(struct wlan_pdev_green_ap_ctx *green_ap_ctx) return NULL; } - return &((psoc->soc_cb.tx_ops.green_ap_tx_ops)); + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + green_ap_err("tx_ops is NULL"); + return NULL; + } + + return &tx_ops->green_ap_tx_ops; } bool wlan_is_egap_enabled(struct wlan_pdev_green_ap_ctx *green_ap_ctx) diff --git a/umac/mlme/mlme_objmgr/dispatcher/inc/wlan_vdev_mlme_main.h b/umac/mlme/mlme_objmgr/dispatcher/inc/wlan_vdev_mlme_main.h index e13bcddf00..78aa40381f 100644 --- a/umac/mlme/mlme_objmgr/dispatcher/inc/wlan_vdev_mlme_main.h +++ b/umac/mlme/mlme_objmgr/dispatcher/inc/wlan_vdev_mlme_main.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2020 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 @@ -33,7 +33,15 @@ static inline struct wlan_lmac_if_mlme_tx_ops * wlan_mlme_get_lmac_tx_ops(struct wlan_objmgr_psoc *psoc) { - return &psoc->soc_cb.tx_ops.mops; + struct wlan_lmac_if_tx_ops *tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + qdf_err("tx_ops is NULL"); + return NULL; + } + + return &tx_ops->mops; } /** diff --git a/umac/scan/dispatcher/src/wlan_scan_tgt_api.c b/umac/scan/dispatcher/src/wlan_scan_tgt_api.c index 8f098f6975..a1b13caec6 100644 --- a/umac/scan/dispatcher/src/wlan_scan_tgt_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_tgt_api.c @@ -36,7 +36,15 @@ static inline struct wlan_lmac_if_scan_tx_ops * wlan_psoc_get_scan_txops(struct wlan_objmgr_psoc *psoc) { - return &((psoc->soc_cb.tx_ops.scan)); + struct wlan_lmac_if_tx_ops *tx_ops; + + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + scm_err("tx_ops is NULL"); + return NULL; + } + + return &tx_ops->scan; } static inline struct wlan_lmac_if_scan_tx_ops * @@ -57,6 +65,7 @@ static inline struct wlan_lmac_if_scan_rx_ops * wlan_vdev_get_scan_rxops(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) { @@ -64,7 +73,13 @@ wlan_vdev_get_scan_rxops(struct wlan_objmgr_vdev *vdev) return NULL; } - return &((psoc->soc_cb.rx_ops.scan)); + rx_ops = wlan_psoc_get_lmac_if_rxops(psoc); + if (!rx_ops) { + scm_err("rx_ops is NULL"); + return NULL; + } + + return &rx_ops->scan; } #ifdef FEATURE_WLAN_SCAN_PNO @@ -141,6 +156,11 @@ tgt_scan_start(struct scan_start_request *req) } scan_ops = wlan_psoc_get_scan_txops(psoc); + if (!scan_ops) { + scm_err("NULL scan_ops"); + return QDF_STATUS_E_NULL_VALUE; + } + /* invoke wmi_unified_scan_start_cmd_send() */ QDF_ASSERT(scan_ops->scan_start); if (scan_ops->scan_start) @@ -169,6 +189,11 @@ tgt_scan_cancel(struct scan_cancel_request *req) return QDF_STATUS_E_NULL_VALUE; } scan_ops = wlan_psoc_get_scan_txops(psoc); + if (!scan_ops) { + scm_err("NULL scan_ops"); + return QDF_STATUS_E_NULL_VALUE; + } + /* invoke wmi_unified_scan_stop_cmd_send() */ QDF_ASSERT(scan_ops->scan_cancel); if (scan_ops->scan_cancel) @@ -183,6 +208,11 @@ tgt_scan_register_ev_handler(struct wlan_objmgr_psoc *psoc) struct wlan_lmac_if_scan_tx_ops *scan_ops = NULL; scan_ops = wlan_psoc_get_scan_txops(psoc); + if (!scan_ops) { + scm_err("NULL scan_ops"); + return QDF_STATUS_E_FAILURE; + } + /* invoke wmi_unified_register_event_handler() * since event id, handler function and context is * already known to offload lmac, passing NULL as argument. @@ -202,6 +232,11 @@ tgt_scan_unregister_ev_handler(struct wlan_objmgr_psoc *psoc) struct wlan_lmac_if_scan_tx_ops *scan_ops = NULL; scan_ops = wlan_psoc_get_scan_txops(psoc); + if (!scan_ops) { + scm_err("NULL scan_ops"); + return QDF_STATUS_E_FAILURE; + } + /* invoke wmi_unified_register_event_handler() * since event id, handler function and context is * already known to offload lmac, passing NULL as argument. diff --git a/umac/wifi_pos/src/wifi_pos_api.c b/umac/wifi_pos/src/wifi_pos_api.c index 60e714cfa6..06fccc638f 100644 --- a/umac/wifi_pos/src/wifi_pos_api.c +++ b/umac/wifi_pos/src/wifi_pos_api.c @@ -28,6 +28,7 @@ #include "wlan_objmgr_cmn.h" #include "wlan_objmgr_global_obj.h" #include "wlan_objmgr_psoc_obj.h" +#include "wlan_lmac_if_def.h" QDF_STATUS wifi_pos_init(void) { diff --git a/umac/wifi_pos/src/wifi_pos_main.c b/umac/wifi_pos/src/wifi_pos_main.c index 4707fbaa58..17babc57ee 100644 --- a/umac/wifi_pos/src/wifi_pos_main.c +++ b/umac/wifi_pos/src/wifi_pos_main.c @@ -80,12 +80,20 @@ static bool wifi_pos_get_tlv_support(struct wlan_objmgr_psoc *psoc) struct wlan_lmac_if_wifi_pos_tx_ops * wifi_pos_get_tx_ops(struct wlan_objmgr_psoc *psoc) { + struct wlan_lmac_if_tx_ops *tx_ops; + if (!psoc) { wifi_pos_err("psoc is null"); return NULL; } - return &psoc->soc_cb.tx_ops.wifi_pos_tx_ops; + tx_ops = wlan_psoc_get_lmac_if_txops(psoc); + if (!tx_ops) { + wifi_pos_err("tx_ops is NULL"); + return NULL; + } + + return &tx_ops->wifi_pos_tx_ops; } #ifdef CNSS_GENL diff --git a/wmi/inc/wmi_unified_api.h b/wmi/inc/wmi_unified_api.h index 9806ae1305..9555af867b 100644 --- a/wmi/inc/wmi_unified_api.h +++ b/wmi/inc/wmi_unified_api.h @@ -30,6 +30,8 @@ #include "service_ready_param.h" #include "wlan_objmgr_psoc_obj.h" #include "wlan_mgmt_txrx_utils_api.h" +#include +#include #ifdef WLAN_POWER_MANAGEMENT_OFFLOAD #include "wmi_unified_pmo_api.h" #endif diff --git a/wmi/inc/wmi_unified_param.h b/wmi/inc/wmi_unified_param.h index edc0a711d1..c27a2696bb 100644 --- a/wmi/inc/wmi_unified_param.h +++ b/wmi/inc/wmi_unified_param.h @@ -31,6 +31,8 @@ #ifdef WLAN_CONV_SPECTRAL_ENABLE #include #endif /* WLAN_CONV_SPECTRAL_ENABLE */ +#include +#include #define MAC_MAX_KEY_LENGTH 32 #define MAC_PN_LENGTH 8