diff --git a/dp/inc/cdp_txrx_misc.h b/dp/inc/cdp_txrx_misc.h index d152faa877..0adb23947b 100644 --- a/dp/inc/cdp_txrx_misc.h +++ b/dp/inc/cdp_txrx_misc.h @@ -819,4 +819,48 @@ cdp_vdev_inform_ll_conn(ol_txrx_soc_handle soc, uint8_t vdev_id, return QDF_STATUS_SUCCESS; } + +/** + * cdp_soc_set_swlm_enable() - Enable or disable software latency manager + * @soc: soc handle + * @value: value (enable/disable) + * + * Returns: QDF_STATUS + */ +static inline QDF_STATUS +cdp_soc_set_swlm_enable(ol_txrx_soc_handle soc, uint8_t value) +{ + if (!soc || !soc->ops || !soc->ops->misc_ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", __func__); + return QDF_STATUS_E_INVAL; + } + + if (soc->ops->misc_ops->set_swlm_enable) + return soc->ops->misc_ops->set_swlm_enable(soc, value); + + return QDF_STATUS_SUCCESS; +} + +/** + * cdp_soc_is_swlm_enabled() - Check if the software latency manager is + * enabled or not + * @soc: soc handle + * + * Returns: 1 if enabled, 0 if disabled + */ +static inline uint8_t +cdp_soc_is_swlm_enabled(ol_txrx_soc_handle soc) +{ + if (!soc || !soc->ops || !soc->ops->misc_ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", __func__); + return 0; + } + + if (soc->ops->misc_ops->is_swlm_enabled) + return soc->ops->misc_ops->is_swlm_enabled(soc); + + return 0; +} #endif /* _CDP_TXRX_MISC_H_ */ diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index f88d5aae8e..348d42a229 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -1166,6 +1166,8 @@ struct ol_if_ops { * * @vdev_inform_ll_conn: inform DP to add/delete a latency critical connection * for this particular vdev. + * @set_swlm_enable: Enable or Disable Software Latency Manager. + * @is_swlm_enabled: Check if Software latency manager is enabled or not. * * Function pointers for miscellaneous soc/pdev/vdev related operations. */ @@ -1251,6 +1253,9 @@ struct cdp_misc_ops { QDF_STATUS (*vdev_inform_ll_conn)(struct cdp_soc_t *soc_hdl, uint8_t vdev_id, enum vdev_ll_conn_actions action); + QDF_STATUS (*set_swlm_enable)(struct cdp_soc_t *soc_hdl, + uint8_t val); + uint8_t (*is_swlm_enabled)(struct cdp_soc_t *soc_hdl); }; /** diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 59c7915508..cb38ed552e 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -9855,6 +9855,43 @@ dp_vdev_inform_ll_conn(struct cdp_soc_t *soc_hdl, uint8_t vdev_id, return QDF_STATUS_SUCCESS; } +#ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR +/** + * dp_soc_set_swlm_enable() - Enable/Disable SWLM if initialized. + * @soc_hdl: CDP Soc handle + * @value: Enable/Disable value + * + * Returns: QDF_STATUS + */ +static QDF_STATUS dp_soc_set_swlm_enable(struct cdp_soc_t *soc_hdl, + uint8_t value) +{ + struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl); + + if (!soc->swlm.is_init) { + dp_err("SWLM is not initialized"); + return QDF_STATUS_E_FAILURE; + } + + soc->swlm.is_enabled = !!value; + + return QDF_STATUS_SUCCESS; +} + +/** + * dp_soc_is_swlm_enabled() - Check if SWLM is enabled. + * @soc_hdl: CDP Soc handle + * + * Returns: QDF_STATUS + */ +static uint8_t dp_soc_is_swlm_enabled(struct cdp_soc_t *soc_hdl) +{ + struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl); + + return soc->swlm.is_enabled; +} +#endif + /** * dp_soc_get_dp_txrx_handle() - get context for external-dp from dp soc * @soc_handle: datapath soc handle @@ -11224,6 +11261,10 @@ static struct cdp_misc_ops dp_ops_misc = { .request_rx_hw_stats = dp_request_rx_hw_stats, #endif /* WLAN_FEATURE_STATS_EXT */ .vdev_inform_ll_conn = dp_vdev_inform_ll_conn, +#ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR + .set_swlm_enable = dp_soc_set_swlm_enable, + .is_swlm_enabled = dp_soc_is_swlm_enabled, +#endif }; #endif