diff --git a/dp/inc/cdp_txrx_ctrl.h b/dp/inc/cdp_txrx_ctrl.h index 5953f13762..049f321490 100644 --- a/dp/inc/cdp_txrx_ctrl.h +++ b/dp/inc/cdp_txrx_ctrl.h @@ -341,4 +341,66 @@ cdp_peer_set_nawds(ol_txrx_soc_handle soc, (peer, value); return; } + +/** + * @brief Subscribe to a specified WDI event. + * @details + * This function adds the provided wdi_event_subscribe object to a list of + * subscribers for the specified WDI event. + * When the event in question happens, each subscriber for the event will + * have their callback function invoked. + * The order in which callback functions from multiple subscribers are + * invoked is unspecified. + * + * @param soc - pointer to the soc + * @param pdev - the data physical device object + * @param event_cb_sub - the callback and context for the event subscriber + * @param event - which event's notifications are being subscribed to + * @return - int + */ +static inline int +cdp_wdi_event_sub(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event) +{ + if (!soc || !soc->ops || !soc->ops->ctrl_ops) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, + "%s invalid instance", __func__); + return 0; + } + + if (soc->ops->ctrl_ops->txrx_wdi_event_sub) + return soc->ops->ctrl_ops->txrx_wdi_event_sub + (pdev, event_cb_sub, event); + return 0; +} + +/** + * @brief Unsubscribe from a specified WDI event. + * @details + * This function removes the provided event subscription object from the + * list of subscribers for its event. + * This function shall only be called if there was a successful prior call + * to event_sub() on the same wdi_event_subscribe object. + * + * @param soc - pointer to the soc + * @param pdev - the data physical device object + * @param event_cb_sub - the callback and context for the event subscriber + * @param event - which event's notifications are being subscribed to + * @return - int + */ +static inline int +cdp_wdi_event_unsub(ol_txrx_soc_handle soc, + struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event) +{ + if (!soc || !soc->ops || !soc->ops->ctrl_ops) { + QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL, + "%s invalid instance", __func__); + return 0; + } + + if (soc->ops->ctrl_ops->txrx_wdi_event_unsub) + return soc->ops->ctrl_ops->txrx_wdi_event_unsub + (pdev, event_cb_sub, event); + return 0; +} #endif diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index fa30ee525c..7a31f679d7 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -390,6 +390,12 @@ struct cdp_ctrl_ops { */ enum cdp_host_reo_dest_ring (*txrx_get_pdev_reo_dest)( struct cdp_pdev *pdev); + + int (*txrx_wdi_event_sub)(struct cdp_pdev *pdev, void *event_cb_sub, + uint32_t event); + + int (*txrx_wdi_event_unsub)(struct cdp_pdev *pdev, void *event_cb_sub, + uint32_t event); }; struct cdp_me_ops {