From c4a6b8480b9d4a828b76f140652b28eddb5f812f Mon Sep 17 00:00:00 2001 From: Venkata Sharath Chandra Manchala Date: Wed, 25 Oct 2017 12:18:08 -0700 Subject: [PATCH] qcacmn: Add Null checks in CDP Layer Part-2: Add Null checks for all the API's in CDP Layer. Change-Id: I8a4628f79880aff1212dee132016e8e48fe721fc CRs-Fixed: 2136173 --- dp/inc/cdp_txrx_host_stats.h | 290 ++++++++++++++++++++++++++++------- dp/inc/cdp_txrx_me.h | 106 ++++++++++--- dp/inc/cdp_txrx_misc.h | 14 +- dp/inc/cdp_txrx_mon.h | 110 ++++++++++--- dp/inc/cdp_txrx_ocb.h | 3 +- dp/inc/cdp_txrx_pflow.h | 15 +- dp/inc/cdp_txrx_raw.h | 30 +++- dp/inc/cdp_txrx_stats.h | 31 +++- 8 files changed, 475 insertions(+), 124 deletions(-) diff --git a/dp/inc/cdp_txrx_host_stats.h b/dp/inc/cdp_txrx_host_stats.h index 67722dedb7..03dcba2b4b 100644 --- a/dp/inc/cdp_txrx_host_stats.h +++ b/dp/inc/cdp_txrx_host_stats.h @@ -43,9 +43,18 @@ static inline int cdp_host_stats_get(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, struct ol_txrx_stats_req *req) { - if (soc->ops->host_stats_ops->txrx_host_stats_get) - return soc->ops->host_stats_ops->txrx_host_stats_get(vdev, req); - return 0; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_host_stats_get) + return 0; + + return soc->ops->host_stats_ops->txrx_host_stats_get(vdev, req); } /** @@ -57,27 +66,55 @@ static inline int cdp_host_stats_get(ol_txrx_soc_handle soc, static inline void cdp_host_stats_clr(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->host_stats_ops->txrx_host_stats_clr) - return soc->ops->host_stats_ops->txrx_host_stats_clr(vdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_host_stats_clr) + return; + + soc->ops->host_stats_ops->txrx_host_stats_clr(vdev); } static inline void cdp_host_ce_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->host_stats_ops->txrx_host_ce_stats) - return soc->ops->host_stats_ops->txrx_host_ce_stats(vdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_host_ce_stats) + return; + + soc->ops->host_stats_ops->txrx_host_ce_stats(vdev); } static inline int cdp_stats_publish (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, struct ol_txrx_stats *buf) { - if (soc->ops->host_stats_ops->txrx_stats_publish) - return soc->ops->host_stats_ops->txrx_stats_publish(pdev, buf); - return 0; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_stats_publish) + return 0; + + return soc->ops->host_stats_ops->txrx_stats_publish(pdev, buf); } + /** * @brief Enable enhanced stats functionality. * @@ -87,10 +124,19 @@ static inline int cdp_stats_publish static inline void cdp_enable_enhanced_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) { - if (soc->ops->host_stats_ops->txrx_enable_enhanced_stats) - return soc->ops->host_stats_ops->txrx_enable_enhanced_stats + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_enable_enhanced_stats) + return; + + soc->ops->host_stats_ops->txrx_enable_enhanced_stats (pdev); - return; } /** @@ -102,10 +148,19 @@ cdp_enable_enhanced_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) static inline void cdp_disable_enhanced_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) { - if (soc->ops->host_stats_ops->txrx_disable_enhanced_stats) - return soc->ops->host_stats_ops->txrx_disable_enhanced_stats + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_disable_enhanced_stats) + return; + + soc->ops->host_stats_ops->txrx_disable_enhanced_stats (pdev); - return; } /** @@ -120,113 +175,230 @@ static inline uint32_t *cdp_get_stats_base (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, uint32_t *stats_base, uint32_t msg_len, uint8_t type) { - if (soc->ops->host_stats_ops->txrx_get_stats_base) - return (uint32_t *)soc->ops->host_stats_ops->txrx_get_stats_base + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_get_stats_base) + return 0; + + return (uint32_t *)soc->ops->host_stats_ops->txrx_get_stats_base (pdev, stats_base, msg_len, type); - return 0; } + static inline void cdp_tx_print_tso_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->host_stats_ops->tx_print_tso_stats) - return soc->ops->host_stats_ops->tx_print_tso_stats(vdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->tx_print_tso_stats) + return; + + soc->ops->host_stats_ops->tx_print_tso_stats(vdev); } static inline void cdp_tx_rst_tso_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->host_stats_ops->tx_rst_tso_stats) - return soc->ops->host_stats_ops->tx_rst_tso_stats(vdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->tx_rst_tso_stats) + return; + + soc->ops->host_stats_ops->tx_rst_tso_stats(vdev); } static inline void cdp_tx_print_sg_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->host_stats_ops->tx_print_sg_stats) - return soc->ops->host_stats_ops->tx_print_sg_stats(vdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->tx_print_sg_stats) + return; + + soc->ops->host_stats_ops->tx_print_sg_stats(vdev); } static inline void cdp_tx_rst_sg_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->host_stats_ops->tx_rst_sg_stats) - return soc->ops->host_stats_ops->tx_rst_sg_stats(vdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->tx_rst_sg_stats) + return; + + soc->ops->host_stats_ops->tx_rst_sg_stats(vdev); } static inline void cdp_print_rx_cksum_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->host_stats_ops->print_rx_cksum_stats) - return soc->ops->host_stats_ops->print_rx_cksum_stats(vdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->print_rx_cksum_stats) + return; + + soc->ops->host_stats_ops->print_rx_cksum_stats(vdev); } static inline void cdp_rst_rx_cksum_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->host_stats_ops->rst_rx_cksum_stats) - return soc->ops->host_stats_ops->rst_rx_cksum_stats(vdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->rst_rx_cksum_stats) + return; + + soc->ops->host_stats_ops->rst_rx_cksum_stats(vdev); } static inline A_STATUS cdp_host_me_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->host_stats_ops->txrx_host_me_stats) - return soc->ops->host_stats_ops->txrx_host_me_stats(vdev); - return 0; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_host_me_stats) + return 0; + + return soc->ops->host_stats_ops->txrx_host_me_stats(vdev); } + static inline void cdp_per_peer_stats (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, char *addr) { - if (soc->ops->host_stats_ops->txrx_per_peer_stats) - return soc->ops->host_stats_ops->txrx_per_peer_stats + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_per_peer_stats) + return; + + soc->ops->host_stats_ops->txrx_per_peer_stats (pdev, addr); - return; } static inline int cdp_host_msdu_ttl_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, struct ol_txrx_stats_req *req) { - if (soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats) - return soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats) + return 0; + + return soc->ops->host_stats_ops->txrx_host_msdu_ttl_stats (vdev, req); - return 0; } - - static inline void cdp_print_lro_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->host_stats_ops->print_lro_stats) - return soc->ops->host_stats_ops->print_lro_stats(vdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->print_lro_stats) + return; + + soc->ops->host_stats_ops->print_lro_stats(vdev); } static inline void cdp_reset_lro_stats(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->host_stats_ops->reset_lro_stats) - return soc->ops->host_stats_ops->reset_lro_stats(vdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->reset_lro_stats) + return; + + soc->ops->host_stats_ops->reset_lro_stats(vdev); } static inline void cdp_get_dp_fw_peer_stats(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, uint8_t *mac, uint32_t caps) { - if (soc->ops->host_stats_ops->get_fw_peer_stats) - return soc->ops->host_stats_ops->get_fw_peer_stats + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->host_stats_ops || + !soc->ops->host_stats_ops->get_fw_peer_stats) + return; + + soc->ops->host_stats_ops->get_fw_peer_stats (pdev, mac, caps); - return; } /** diff --git a/dp/inc/cdp_txrx_me.h b/dp/inc/cdp_txrx_me.h index 855b91f4b5..712d75457a 100644 --- a/dp/inc/cdp_txrx_me.h +++ b/dp/inc/cdp_txrx_me.h @@ -40,59 +40,114 @@ static inline u_int16_t cdp_tx_desc_alloc_and_mark_for_mcast_clone(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int16_t buf_count) { - if (soc->ops->me_ops->tx_desc_alloc_and_mark_for_mcast_clone) - return soc->ops->me_ops-> + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->me_ops || + !soc->ops->me_ops->tx_desc_alloc_and_mark_for_mcast_clone) + return 0; + + return soc->ops->me_ops-> tx_desc_alloc_and_mark_for_mcast_clone (pdev, buf_count); - return 0; } static inline u_int16_t cdp_tx_desc_free_and_unmark_for_mcast_clone(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int16_t buf_count) { - if (soc->ops->me_ops->tx_desc_free_and_unmark_for_mcast_clone) - return soc->ops->me_ops-> + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->me_ops || + !soc->ops->me_ops->tx_desc_free_and_unmark_for_mcast_clone) + return 0; + + return soc->ops->me_ops-> tx_desc_free_and_unmark_for_mcast_clone (pdev, buf_count); - return 0; } static inline u_int16_t cdp_tx_get_mcast_buf_allocated_marked(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) { - if (soc->ops->me_ops->tx_get_mcast_buf_allocated_marked) - return soc->ops->me_ops->tx_get_mcast_buf_allocated_marked + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->me_ops || + !soc->ops->me_ops->tx_get_mcast_buf_allocated_marked) + return 0; + + return soc->ops->me_ops->tx_get_mcast_buf_allocated_marked (pdev); - return 0; } static inline void cdp_tx_me_alloc_descriptor(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) { - if (soc->ops->me_ops->tx_me_alloc_descriptor) - return soc->ops->me_ops->tx_me_alloc_descriptor(pdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->me_ops || + !soc->ops->me_ops->tx_me_alloc_descriptor) + return; + + soc->ops->me_ops->tx_me_alloc_descriptor(pdev); } static inline void cdp_tx_me_free_descriptor(ol_txrx_soc_handle soc, struct cdp_pdev *pdev) { - if (soc->ops->me_ops->tx_me_free_descriptor) - return soc->ops->me_ops->tx_me_free_descriptor(pdev); - return; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->me_ops || + !soc->ops->me_ops->tx_me_free_descriptor) + return; + + soc->ops->me_ops->tx_me_free_descriptor(pdev); } static inline uint16_t cdp_tx_me_convert_ucast(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, qdf_nbuf_t wbuf, u_int8_t newmac[][6], uint8_t newmaccnt) { - if (soc->ops->me_ops->tx_me_convert_ucast) - return soc->ops->me_ops->tx_me_convert_ucast + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->me_ops || + !soc->ops->me_ops->tx_me_convert_ucast) + return 0; + + return soc->ops->me_ops->tx_me_convert_ucast (vdev, wbuf, newmac, newmaccnt); - return 0; } + /* Should be a function pointer in ol_txrx_osif_ops{} */ /** * @brief notify mcast frame indication from FW. @@ -108,8 +163,17 @@ cdp_tx_me_convert_ucast(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, static inline int cdp_mcast_notify(ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t vdev_id, qdf_nbuf_t msdu) { - if (soc->ops->me_ops->mcast_notify) - return soc->ops->me_ops->mcast_notify(pdev, vdev_id, msdu); - return 0; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->me_ops || + !soc->ops->me_ops->mcast_notify) + return 0; + + return soc->ops->me_ops->mcast_notify(pdev, vdev_id, msdu); } #endif diff --git a/dp/inc/cdp_txrx_misc.h b/dp/inc/cdp_txrx_misc.h index 4ddd88507c..c7f906d324 100644 --- a/dp/inc/cdp_txrx_misc.h +++ b/dp/inc/cdp_txrx_misc.h @@ -61,7 +61,7 @@ cdp_tx_non_std(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, enum ol_tx_spec tx_spec, qdf_nbuf_t msdu_list) { if (!soc || !soc->ops || !soc->ops->misc_ops) { - QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_DEBUG, "%s invalid instance", __func__); return NULL; } @@ -180,12 +180,18 @@ cdp_post_data_stall_event(ol_txrx_soc_handle soc, uint32_t pdev_id, uint32_t vdev_id_bitmap, enum data_stall_log_recovery_type recovery_type) { - if (!soc || !soc->ops || !soc->ops->misc_ops) + if (!soc || !soc->ops) { QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, "%s invalid instance", __func__); + QDF_BUG(0); + return; + } - if (soc->ops->misc_ops->txrx_post_data_stall_event) - soc->ops->misc_ops->txrx_post_data_stall_event( + if (!soc->ops->misc_ops || + !soc->ops->misc_ops->txrx_post_data_stall_event) + return; + + soc->ops->misc_ops->txrx_post_data_stall_event( indicator, data_stall_type, pdev_id, vdev_id_bitmap, recovery_type); } diff --git a/dp/inc/cdp_txrx_mon.h b/dp/inc/cdp_txrx_mon.h index 02c9cff802..2c5b167b24 100644 --- a/dp/inc/cdp_txrx_mon.h +++ b/dp/inc/cdp_txrx_mon.h @@ -36,57 +36,125 @@ static inline void cdp_monitor_set_filter_ucast_data (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val) { - if (soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data) - return soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->mon_ops || + !soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data) + return; + + soc->ops->mon_ops->txrx_monitor_set_filter_ucast_data (pdev, val); - return; } + static inline void cdp_monitor_set_filter_mcast_data (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val) { - if (soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data) - return soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->mon_ops || + !soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data) + return; + + soc->ops->mon_ops->txrx_monitor_set_filter_mcast_data (pdev, val); - return; } + static inline void cdp_monitor_set_filter_non_data (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, u_int8_t val) { - if (soc->ops->mon_ops->txrx_monitor_set_filter_non_data) - return soc->ops->mon_ops->txrx_monitor_set_filter_non_data + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->mon_ops || + !soc->ops->mon_ops->txrx_monitor_set_filter_non_data) + return; + + soc->ops->mon_ops->txrx_monitor_set_filter_non_data (pdev, val); - return; } static inline u_int8_t cdp_monitor_get_filter_ucast_data(ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle) { - if (soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data) - return soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->mon_ops || + !soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data) + return 0; + + return soc->ops->mon_ops->txrx_monitor_get_filter_ucast_data (vdev_txrx_handle); - return 0; } + static inline u_int8_t cdp_monitor_get_filter_mcast_data(ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle) { - if (soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data) - return soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->mon_ops || + !soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data) + return 0; + + return soc->ops->mon_ops->txrx_monitor_get_filter_mcast_data (vdev_txrx_handle); - return 0; } + static inline u_int8_t cdp_monitor_get_filter_non_data(ol_txrx_soc_handle soc, struct cdp_vdev *vdev_txrx_handle) { - if (soc->ops->mon_ops->txrx_monitor_get_filter_non_data) - return soc->ops->mon_ops->txrx_monitor_get_filter_non_data + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->mon_ops || + !soc->ops->mon_ops->txrx_monitor_get_filter_non_data) + return 0; + + return soc->ops->mon_ops->txrx_monitor_get_filter_non_data (vdev_txrx_handle); - return 0; } + static inline int cdp_reset_monitor_mode (ol_txrx_soc_handle soc, struct cdp_pdev *pdev) { - if (soc->ops->mon_ops->txrx_reset_monitor_mode) - return soc->ops->mon_ops->txrx_reset_monitor_mode(pdev); - return 0; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->mon_ops || + !soc->ops->mon_ops->txrx_reset_monitor_mode) + return 0; + + return soc->ops->mon_ops->txrx_reset_monitor_mode(pdev); } #endif diff --git a/dp/inc/cdp_txrx_ocb.h b/dp/inc/cdp_txrx_ocb.h index 02dffc7f76..e929187e7a 100644 --- a/dp/inc/cdp_txrx_ocb.h +++ b/dp/inc/cdp_txrx_ocb.h @@ -48,10 +48,9 @@ cdp_set_ocb_chan_info(ol_txrx_soc_handle soc, struct cdp_vdev *vdev, } if (soc->ops->ocb_ops->set_ocb_chan_info) - return soc->ops->ocb_ops->set_ocb_chan_info(vdev, + soc->ops->ocb_ops->set_ocb_chan_info(vdev, ocb_set_chan); - return; } /** * cdp_get_ocb_chan_info() - return handle to vdev ocb_channel_info diff --git a/dp/inc/cdp_txrx_pflow.h b/dp/inc/cdp_txrx_pflow.h index 67a81fb92a..84b19b0c03 100644 --- a/dp/inc/cdp_txrx_pflow.h +++ b/dp/inc/cdp_txrx_pflow.h @@ -40,9 +40,18 @@ static inline uint32_t cdp_pflow_update_pdev_params (ol_txrx_soc_handle soc, struct cdp_pdev *pdev, enum _ol_ath_param_t param, uint32_t val, void *ctx) { - if (soc->ops->pflow_ops->pflow_update_pdev_params) - return soc->ops->pflow_ops->pflow_update_pdev_params + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->pflow_ops || + !soc->ops->pflow_ops->pflow_update_pdev_params) + return 0; + + return soc->ops->pflow_ops->pflow_update_pdev_params (pdev, param, val, ctx); - return 0; } #endif diff --git a/dp/inc/cdp_txrx_raw.h b/dp/inc/cdp_txrx_raw.h index 8279653444..a91a72ff26 100644 --- a/dp/inc/cdp_txrx_raw.h +++ b/dp/inc/cdp_txrx_raw.h @@ -38,9 +38,18 @@ static inline int cdp_get_nwifi_mode(ol_txrx_soc_handle soc, struct cdp_vdev *vdev) { - if (soc->ops->raw_ops->txrx_get_nwifi_mode) - return soc->ops->raw_ops->txrx_get_nwifi_mode(vdev); - return 0; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->raw_ops || + !soc->ops->raw_ops->txrx_get_nwifi_mode) + return 0; + + return soc->ops->raw_ops->txrx_get_nwifi_mode(vdev); } /** @@ -60,13 +69,18 @@ cdp_rawsim_get_astentry (ol_txrx_soc_handle soc, struct cdp_vdev *vdev, qdf_nbuf_t *pnbuf, struct cdp_raw_ast *raw_ast) { - if (!soc || !soc->ops || !soc->ops->raw_ops) + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->raw_ops || + !soc->ops->raw_ops->rsim_get_astentry) return; - if (soc->ops->raw_ops->rsim_get_astentry) - soc->ops->raw_ops->rsim_get_astentry(vdev, pnbuf, raw_ast); - - return; + soc->ops->raw_ops->rsim_get_astentry(vdev, pnbuf, raw_ast); } #endif diff --git a/dp/inc/cdp_txrx_stats.h b/dp/inc/cdp_txrx_stats.h index 652897e5f7..82abd8bb3d 100644 --- a/dp/inc/cdp_txrx_stats.h +++ b/dp/inc/cdp_txrx_stats.h @@ -36,18 +36,37 @@ static inline void cdp_clear_stats(ol_txrx_soc_handle soc, uint16_t bitmap) { - if (soc->ops->mob_stats_ops->clear_stats) - return soc->ops->mob_stats_ops->clear_stats(bitmap); - return; + + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return; + } + + if (!soc->ops->mob_stats_ops || + !soc->ops->mob_stats_ops->clear_stats) + return; + + soc->ops->mob_stats_ops->clear_stats(bitmap); } static inline int cdp_stats(ol_txrx_soc_handle soc, uint8_t vdev_id, char *buffer, unsigned int buf_len) { - if (soc->ops->mob_stats_ops->stats) - return soc->ops->mob_stats_ops->stats(vdev_id, buffer, buf_len); - return 0; + if (!soc || !soc->ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance", __func__); + QDF_BUG(0); + return 0; + } + + if (!soc->ops->mob_stats_ops || + !soc->ops->mob_stats_ops->stats) + return 0; + + return soc->ops->mob_stats_ops->stats(vdev_id, buffer, buf_len); } #endif /* _CDP_TXRX_STATS_H_ */