From fcb513f88f9d247fbc2bda293dabfa81e98f5d5e Mon Sep 17 00:00:00 2001 From: Roopavathi Lingampalli Date: Thu, 1 Dec 2022 13:48:44 +0530 Subject: [PATCH] qcacld-3.0: Add Component APIs for required ucfg APIs in DP component When component dependent functions calling from higher modules or any other components, it uses ucfg APIs pattern. Calling ucfg dependent APIs is acceptable for higher modules like HDD, OSIF but for another components like DP to avoid using ucfg APIs here, implementing component APIs for existing ucfg APIs to other components like MLME, TDLS, Pkt capture in DP component module. Change-Id: Ib8857eeca6a88810d7875312ff6dc14ffb60bc70 CRs-Fixed: 3351486 --- .../dp/core/src/wlan_dp_bus_bandwidth.c | 10 +++--- components/dp/core/src/wlan_dp_main.c | 4 +-- components/dp/core/src/wlan_dp_nud_tracking.c | 4 +-- components/dp/core/src/wlan_dp_txrx.c | 10 +++--- .../dp/dispatcher/src/wlan_dp_ucfg_api.c | 5 +-- .../mlme/dispatcher/inc/wlan_mlme_api.h | 11 ++++++ .../mlme/dispatcher/src/wlan_mlme_api.c | 19 ++++++++++ .../mlme/dispatcher/src/wlan_mlme_ucfg_api.c | 15 ++------ .../dispatcher/inc/wlan_pkt_capture_api.h | 26 +++++++++++++- .../dispatcher/src/wlan_pkt_capture_api.c | 10 +++++- .../tdls/dispatcher/inc/wlan_tdls_api.h | 35 +++++++++++++++++++ .../tdls/dispatcher/src/wlan_tdls_api.c | 13 +++++++ 12 files changed, 131 insertions(+), 31 deletions(-) diff --git a/components/dp/core/src/wlan_dp_bus_bandwidth.c b/components/dp/core/src/wlan_dp_bus_bandwidth.c index ac3a5ac19c..c31695940f 100644 --- a/components/dp/core/src/wlan_dp_bus_bandwidth.c +++ b/components/dp/core/src/wlan_dp_bus_bandwidth.c @@ -33,11 +33,11 @@ #include "wlan_mlme_vdev_mgr_interface.h" #include "hif.h" #include "qdf_trace.h" -#include +#include #include #include #include "wlan_dp_periodic_sta_stats.h" -#include "wlan_mlme_ucfg_api.h" +#include "wlan_mlme_api.h" #include "wlan_dp_txrx.h" #include "cdp_txrx_host_stats.h" #include "wlan_cm_roam_api.h" @@ -1145,7 +1145,7 @@ static void dp_display_periodic_stats(struct wlan_dp_psoc_context *dp_ctx, uint32_t periodic_stats_disp_time = 0; hdd_cb_handle ctx = dp_ctx->dp_ops.callback_ctx; - ucfg_mlme_stats_get_periodic_display_time(dp_ctx->psoc, + wlan_mlme_stats_get_periodic_display_time(dp_ctx->psoc, &periodic_stats_disp_time); if (!periodic_stats_disp_time) return; @@ -1849,7 +1849,7 @@ static void __dp_bus_bw_work_handler(struct wlan_dp_psoc_context *dp_ctx) if ((dp_intf->device_mode == QDF_STA_MODE || dp_intf->device_mode == QDF_P2P_CLIENT_MODE) && - !ucfg_cm_is_vdev_active(vdev)) { + !wlan_cm_is_vdev_active(vdev)) { dp_objmgr_put_vdev_by_user(vdev, WLAN_DP_ID); continue; } @@ -1876,7 +1876,7 @@ static void __dp_bus_bw_work_handler(struct wlan_dp_psoc_context *dp_ctx) dp_intf->prev_tx_bytes); if (dp_intf->device_mode == QDF_STA_MODE && - ucfg_cm_is_vdev_active(vdev)) { + wlan_cm_is_vdev_active(vdev)) { dp_ctx->dp_ops.dp_send_mscs_action_frame(ctx, dp_intf->intf_id); if (dp_intf->link_monitoring.enabled) diff --git a/components/dp/core/src/wlan_dp_main.c b/components/dp/core/src/wlan_dp_main.c index 7750f30868..810f0d79a1 100644 --- a/components/dp/core/src/wlan_dp_main.c +++ b/components/dp/core/src/wlan_dp_main.c @@ -29,7 +29,7 @@ #include #include #include "wlan_objmgr_vdev_obj.h" -#include +#include "wlan_cm_api.h" #include "wlan_dp_nud_tracking.h" #include "target_if_dp_comp.h" #include "wlan_dp_txrx.h" @@ -672,7 +672,7 @@ __dp_process_mic_error(struct wlan_dp_intf *dp_intf) if ((dp_intf->device_mode == QDF_STA_MODE || dp_intf->device_mode == QDF_P2P_CLIENT_MODE) && - ucfg_cm_is_vdev_active(vdev)) + wlan_cm_is_vdev_active(vdev)) ops->osif_dp_process_mic_error(dp_intf->mic_work.info, vdev); else if (dp_intf->device_mode == QDF_SAP_MODE || diff --git a/components/dp/core/src/wlan_dp_nud_tracking.c b/components/dp/core/src/wlan_dp_nud_tracking.c index 27fbf6b579..88811f281f 100644 --- a/components/dp/core/src/wlan_dp_nud_tracking.c +++ b/components/dp/core/src/wlan_dp_nud_tracking.c @@ -26,7 +26,7 @@ #include "wlan_dp_cfg.h" #include #include "wlan_cm_roam_ucfg_api.h" -#include +#include #include "wlan_dp_nud_tracking.h" #include "wlan_vdev_mgr_ucfg_api.h" @@ -377,7 +377,7 @@ static void dp_nud_filter_netevent(struct qdf_mac_addr *netdev_addr, if (!vdev) return; - if (!ucfg_cm_is_vdev_active(vdev)) { + if (!wlan_cm_is_vdev_active(vdev)) { dp_objmgr_put_vdev_by_user(vdev, WLAN_DP_ID); dp_info("Not in Connected State"); return; diff --git a/components/dp/core/src/wlan_dp_txrx.c b/components/dp/core/src/wlan_dp_txrx.c index f7c0ec67d5..b332f9495e 100644 --- a/components/dp/core/src/wlan_dp_txrx.c +++ b/components/dp/core/src/wlan_dp_txrx.c @@ -36,11 +36,11 @@ #endif #include "nan_public_structs.h" #include "nan_ucfg_api.h" -#include +#include #include #include #include -#include +#include "wlan_tdls_api.h" #include #include @@ -440,7 +440,7 @@ void dp_get_transmit_mac_addr(struct wlan_dp_intf *dp_intf, break; case QDF_STA_MODE: case QDF_P2P_CLIENT_MODE: - if (ucfg_cm_is_vdev_active(dp_intf->vdev)) + if (wlan_cm_is_vdev_active(dp_intf->vdev)) qdf_copy_macaddr(mac_addr_tx_allowed, &dp_intf->conn_info.bssid); break; @@ -815,7 +815,7 @@ void dp_sta_notify_tx_comp_cb(qdf_nbuf_t nbuf, void *ctx, uint16_t flag) /* Since it is TDLS call took TDLS vdev ref*/ status = wlan_objmgr_vdev_try_get_ref(dp_intf->vdev, WLAN_TDLS_SB_ID); if (QDF_IS_STATUS_SUCCESS(status)) { - ucfg_tdls_update_tx_pkt_cnt(dp_intf->vdev, dest_mac_addr); + wlan_tdls_update_tx_pkt_cnt(dp_intf->vdev, dest_mac_addr); wlan_objmgr_vdev_release_ref(dp_intf->vdev, WLAN_TDLS_SB_ID); } } @@ -1729,7 +1729,7 @@ QDF_STATUS dp_rx_packet_cbk(void *dp_intf_context, status = wlan_objmgr_vdev_try_get_ref(dp_intf->vdev, WLAN_TDLS_SB_ID); if (QDF_IS_STATUS_SUCCESS(status)) { - ucfg_tdls_update_rx_pkt_cnt(dp_intf->vdev, mac_addr, + wlan_tdls_update_rx_pkt_cnt(dp_intf->vdev, mac_addr, dest_mac_addr); wlan_objmgr_vdev_release_ref(dp_intf->vdev, WLAN_TDLS_SB_ID); diff --git a/components/dp/dispatcher/src/wlan_dp_ucfg_api.c b/components/dp/dispatcher/src/wlan_dp_ucfg_api.c index af1379b507..5282a87108 100644 --- a/components/dp/dispatcher/src/wlan_dp_ucfg_api.c +++ b/components/dp/dispatcher/src/wlan_dp_ucfg_api.c @@ -34,7 +34,7 @@ #include "wlan_dp_nud_tracking.h" #include "wlan_dp_txrx.h" #include "wlan_nlink_common.h" -#include "wlan_pkt_capture_ucfg_api.h" +#include "wlan_pkt_capture_api.h" #include #include #include "wlan_dp_prealloc.h" @@ -332,6 +332,7 @@ ucfg_dp_suspend_handler(struct wlan_objmgr_psoc *psoc, void *arg) struct wlan_dp_intf *dp_intf, *dp_intf_next = NULL; void *soc = cds_get_context(QDF_MODULE_ID_SOC); QDF_STATUS status; + dp_ctx = dp_psoc_get_priv(psoc); if (!dp_ctx) { dp_err("DP context not found"); @@ -1144,7 +1145,7 @@ QDF_STATUS ucfg_dp_register_pkt_capture_callbacks(struct wlan_objmgr_vdev *vdev) return QDF_STATUS_E_INVAL; } - return ucfg_pkt_capture_register_callbacks(vdev, + return wlan_pkt_capture_register_callbacks(vdev, dp_mon_rx_packet_cbk, dp_intf); } diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index 018d44317e..8e5f865953 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -4097,4 +4097,15 @@ wlan_mlme_get_sr_enable_modes(struct wlan_objmgr_psoc *psoc, uint8_t *val); void wlan_mlme_set_edca_pifs_param(struct wlan_edca_pifs_param_ie *ep, enum host_edca_param_type type); +/** + * wlan_mlme_stats_get_periodic_display_time() - get display time + * @psoc: pointer to psoc object + * @periodic_display_time: buffer to hold value + * + * Return: QDF Status + */ +QDF_STATUS +wlan_mlme_stats_get_periodic_display_time(struct wlan_objmgr_psoc *psoc, + uint32_t *periodic_display_time); + #endif /* _WLAN_MLME_API_H_ */ diff --git a/components/mlme/dispatcher/src/wlan_mlme_api.c b/components/mlme/dispatcher/src/wlan_mlme_api.c index ed71187867..b6463c3ead 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_api.c @@ -6470,3 +6470,22 @@ wlan_mlme_set_edca_pifs_param(struct wlan_edca_pifs_param_ie *ep, CFG_PIFS_PARAM_REB_OFFSET; } } + +QDF_STATUS +wlan_mlme_stats_get_periodic_display_time(struct wlan_objmgr_psoc *psoc, + uint32_t *periodic_display_time) +{ + struct wlan_mlme_psoc_ext_obj *mlme_obj; + + mlme_obj = mlme_get_psoc_ext_obj(psoc); + if (!mlme_obj) { + *periodic_display_time = + cfg_default(CFG_PERIODIC_STATS_DISPLAY_TIME); + return QDF_STATUS_E_INVAL; + } + + *periodic_display_time = + mlme_obj->cfg.stats.stats_periodic_display_time; + + return QDF_STATUS_SUCCESS; +} diff --git a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c index 71619c775b..9094ece1bc 100644 --- a/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c +++ b/components/mlme/dispatcher/src/wlan_mlme_ucfg_api.c @@ -1182,19 +1182,8 @@ QDF_STATUS ucfg_mlme_stats_get_periodic_display_time(struct wlan_objmgr_psoc *psoc, uint32_t *periodic_display_time) { - struct wlan_mlme_psoc_ext_obj *mlme_obj; - - mlme_obj = mlme_get_psoc_ext_obj(psoc); - if (!mlme_obj) { - *periodic_display_time = - cfg_default(CFG_PERIODIC_STATS_DISPLAY_TIME); - return QDF_STATUS_E_INVAL; - } - - *periodic_display_time = - mlme_obj->cfg.stats.stats_periodic_display_time; - - return QDF_STATUS_SUCCESS; + return wlan_mlme_stats_get_periodic_display_time(psoc, + periodic_display_time); } QDF_STATUS diff --git a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_api.h b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_api.h index 278efe7233..0e31796c26 100644 --- a/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_api.h +++ b/components/pkt_capture/dispatcher/inc/wlan_pkt_capture_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. 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 @@ -33,4 +33,28 @@ * Return: bool */ bool wlan_pkt_capture_is_tx_mgmt_enable(struct wlan_objmgr_pdev *pdev); + +#ifdef WLAN_FEATURE_PKT_CAPTURE +/** + * wlan_pkt_capture_register_callbacks - Register packet capture callbacks + * @vdev: pointer to wlan vdev object manager + * @mon_cb: callback to call + * @context: callback context + * + * Return: 0 in case of success, invalid in case of failure. + */ +QDF_STATUS +wlan_pkt_capture_register_callbacks(struct wlan_objmgr_vdev *vdev, + QDF_STATUS (*mon_cb)(void *, qdf_nbuf_t), + void *context); + +#else +static inline QDF_STATUS +wlan_pkt_capture_register_callbacks(struct wlan_objmgr_vdev *vdev, + QDF_STATUS (*mon_cb)(void *, qdf_nbuf_t), + void *context) +{ + return QDF_STATUS_SUCCESS; +} +#endif /* WLAN_FEATURE_PKT_CAPTURE */ #endif /* _WLAN_PKT_CAPTURE_API_H_ */ diff --git a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_api.c b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_api.c index 9f6dc26000..08b12717fa 100644 --- a/components/pkt_capture/dispatcher/src/wlan_pkt_capture_api.c +++ b/components/pkt_capture/dispatcher/src/wlan_pkt_capture_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved. + * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. 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 @@ -27,3 +27,11 @@ bool wlan_pkt_capture_is_tx_mgmt_enable(struct wlan_objmgr_pdev *pdev) { return pkt_capture_is_tx_mgmt_enable(pdev); } + +QDF_STATUS +wlan_pkt_capture_register_callbacks(struct wlan_objmgr_vdev *vdev, + QDF_STATUS (*mon_cb)(void *, qdf_nbuf_t), + void *context) +{ + return pkt_capture_register_callbacks(vdev, mon_cb, context); +} diff --git a/components/tdls/dispatcher/inc/wlan_tdls_api.h b/components/tdls/dispatcher/inc/wlan_tdls_api.h index 0996dfc01c..d1e9573d03 100644 --- a/components/tdls/dispatcher/inc/wlan_tdls_api.h +++ b/components/tdls/dispatcher/inc/wlan_tdls_api.h @@ -88,6 +88,28 @@ wlan_tdls_notify_sta_connect(uint8_t vdev_id, bool tdls_prohibited, struct wlan_objmgr_vdev *vdev); +/** + * wlan_tdls_update_tx_pkt_cnt() - update tx pkt count + * @vdev: tdls vdev object + * @mac_addr: peer mac address + * + * Return: None + */ +void wlan_tdls_update_tx_pkt_cnt(struct wlan_objmgr_vdev *vdev, + struct qdf_mac_addr *mac_addr); + +/** + * wlan_tdls_update_rx_pkt_cnt() - update rx pkt count + * @vdev: tdls vdev object + * @mac_addr: peer mac address + * @dest_mac_addr: dest mac address + * + * Return: None + */ +void wlan_tdls_update_rx_pkt_cnt(struct wlan_objmgr_vdev *vdev, + struct qdf_mac_addr *mac_addr, + struct qdf_mac_addr *dest_mac_addr); + #else #ifdef FEATURE_SET @@ -118,5 +140,18 @@ wlan_tdls_notify_sta_connect(uint8_t vdev_id, bool tdls_prohibited, struct wlan_objmgr_vdev *vdev) {} +static inline void +wlan_tdls_update_tx_pkt_cnt(struct wlan_objmgr_vdev *vdev, + struct qdf_mac_addr *mac_addr) +{ +} + +static inline +void wlan_tdls_update_rx_pkt_cnt(struct wlan_objmgr_vdev *vdev, + struct qdf_mac_addr *mac_addr, + struct qdf_mac_addr *dest_mac_addr) +{ +} + #endif #endif diff --git a/components/tdls/dispatcher/src/wlan_tdls_api.c b/components/tdls/dispatcher/src/wlan_tdls_api.c index 11df96c89a..ea3d4f0f0d 100644 --- a/components/tdls/dispatcher/src/wlan_tdls_api.c +++ b/components/tdls/dispatcher/src/wlan_tdls_api.c @@ -268,3 +268,16 @@ void wlan_tdls_get_features_info(struct wlan_objmgr_psoc *psoc, } } #endif + +void wlan_tdls_update_tx_pkt_cnt(struct wlan_objmgr_vdev *vdev, + struct qdf_mac_addr *mac_addr) +{ + tdls_update_tx_pkt_cnt(vdev, mac_addr); +} + +void wlan_tdls_update_rx_pkt_cnt(struct wlan_objmgr_vdev *vdev, + struct qdf_mac_addr *mac_addr, + struct qdf_mac_addr *dest_mac_addr) +{ + tdls_update_rx_pkt_cnt(vdev, mac_addr, dest_mac_addr); +}