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 8b238fbedd..caae7252ac 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 e0e99fedf8..80c2566d62 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 1f038310a5..626912907c 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 1abc411896..9124ef017d 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 @@ -124,6 +128,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);