From 1fee5149d5f901ad189ced8664c6786f08950f07 Mon Sep 17 00:00:00 2001 From: Rajasekaran Kalidoss Date: Thu, 7 Jan 2021 13:16:50 +0530 Subject: [PATCH] qcacmn: Register cp stats legacy ops Currently there is no support to register both common cp stats ops and MC specific cp stats ops. Add support to register common ops and MC/WIN specific cp stats ops. Change-Id: Ibaee9da8b1ce3185161821f2be751d8bb4bf10e2 CRs-Fixed: 2851235 --- target_if/cp_stats/inc/target_if_cp_stats.h | 42 ++++++++++++++++++- target_if/cp_stats/src/target_if_cp_stats.c | 8 ++-- umac/cp_stats/core/src/wlan_cp_stats_ol_api.c | 14 ++++++- .../lmac_if/inc/wlan_lmac_if_def.h | 12 ++++-- 4 files changed, 67 insertions(+), 9 deletions(-) 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 8b238fbedd31..caae7252ac4b 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, 2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2018, 2020-2021 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 @@ -80,6 +80,46 @@ target_if_cp_stats_get_tx_ops(struct wlan_objmgr_psoc *psoc) */ QDF_STATUS target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops); + +#ifdef WLAN_SUPPORT_LEGACY_CP_STATS_HANDLERS +/** + * @target_if_cp_stats_register_legacy_event_handler() - Register handler + * specific to legacy components + * @psoc: pointer to psoc object + * + * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on + * failure + */ +QDF_STATUS +target_if_cp_stats_register_legacy_event_handler(struct wlan_objmgr_psoc *psoc); + +/** + * @target_if_cp_stats_unregister_legacy_event_handler() - Unregister handler + * specific to legacy components + * @psoc: pointer to psoc object + * + * Return: QDF_STATUS_SUCCESS on Success, other QDF_STATUS error codes on + * failure + */ +QDF_STATUS +target_if_cp_stats_unregister_legacy_event_handler( + struct wlan_objmgr_psoc *psoc); +#else + +static inline QDF_STATUS +target_if_cp_stats_register_legacy_event_handler(struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} + +static inline QDF_STATUS +target_if_cp_stats_unregister_legacy_event_handler( + struct wlan_objmgr_psoc *psoc) +{ + return QDF_STATUS_SUCCESS; +} +#endif /* WLAN_SUPPORT_LEGACY_CP_STATS_HANDLERS */ + #else static inline QDF_STATUS target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) diff --git a/target_if/cp_stats/src/target_if_cp_stats.c b/target_if/cp_stats/src/target_if_cp_stats.c index e0e99fedf8b7..80c2566d621a 100644 --- a/target_if/cp_stats/src/target_if_cp_stats.c +++ b/target_if/cp_stats/src/target_if_cp_stats.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018, 2021 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 @@ -75,7 +75,9 @@ target_if_cp_stats_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops) target_if_cp_stats_register_event_handler; cp_stats_tx_ops->cp_stats_detach = target_if_cp_stats_unregister_event_handler; - + cp_stats_tx_ops->cp_stats_legacy_attach = + target_if_cp_stats_register_legacy_event_handler; + cp_stats_tx_ops->cp_stats_legacy_detach = + target_if_cp_stats_unregister_legacy_event_handler; return QDF_STATUS_SUCCESS; } - diff --git a/umac/cp_stats/core/src/wlan_cp_stats_ol_api.c b/umac/cp_stats/core/src/wlan_cp_stats_ol_api.c index 1f038310a550..626912907c43 100644 --- a/umac/cp_stats/core/src/wlan_cp_stats_ol_api.c +++ b/umac/cp_stats/core/src/wlan_cp_stats_ol_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018, 2021 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 @@ -129,6 +129,10 @@ QDF_STATUS wlan_cp_stats_enable_ol(struct wlan_objmgr_psoc *psoc) } tx_ops->cp_stats_attach(psoc); + + if (tx_ops->cp_stats_legacy_attach) + tx_ops->cp_stats_legacy_attach(psoc); + return QDF_STATUS_SUCCESS; } @@ -147,12 +151,18 @@ QDF_STATUS wlan_cp_stats_disable_ol(struct wlan_objmgr_psoc *psoc) return QDF_STATUS_E_NULL_VALUE; } + if (!tx_ops->cp_stats_legacy_detach) { + cp_stats_err("cp_stats_legacy_detach function ptr is null!"); + return QDF_STATUS_E_NULL_VALUE; + } + tx_ops->cp_stats_legacy_detach(psoc); + if (!tx_ops->cp_stats_detach) { cp_stats_err("cp_stats_detach function ptr is null!"); return QDF_STATUS_E_NULL_VALUE; } - tx_ops->cp_stats_detach(psoc); + return QDF_STATUS_SUCCESS; } diff --git a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h index 9e81ed833140..5dcd37963e72 100644 --- a/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h +++ b/umac/global_umac_dispatcher/lmac_if/inc/wlan_lmac_if_def.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. * * * Permission to use, copy, modify, and/or distribute this software for @@ -112,8 +112,12 @@ typedef struct wake_lock_stats stats_wake_lock; /** * struct wlan_lmac_if_cp_stats_tx_ops - defines southbound tx callbacks for * control plane statistics component - * @cp_stats_attach: function pointer to register events from FW - * @cp_stats_detach: function pointer to unregister events from FW + * @cp_stats_attach: function pointer to register events from FW + * @cp_stats_detach: function pointer to unregister events from FW + * @cp_stats_legacy_attach: function pointer to register legacy stats events + * from FW + * @cp_stats_legacy_detach: function pointer to unregister legacy stats events + * from FW * @inc_wake_lock_stats: function pointer to increase wake lock stats * @send_req_stats: function pointer to send request stats command to FW * @send_req_peer_stats: function pointer to send request peer stats command @@ -122,6 +126,8 @@ typedef struct wake_lock_stats stats_wake_lock; struct wlan_lmac_if_cp_stats_tx_ops { QDF_STATUS (*cp_stats_attach)(struct wlan_objmgr_psoc *psoc); QDF_STATUS (*cp_stats_detach)(struct wlan_objmgr_psoc *posc); + QDF_STATUS (*cp_stats_legacy_attach)(struct wlan_objmgr_psoc *psoc); + QDF_STATUS (*cp_stats_legacy_detach)(struct wlan_objmgr_psoc *psoc); void (*inc_wake_lock_stats)(uint32_t reason, stats_wake_lock *stats, uint32_t *unspecified_wake_count);