diff --git a/os_if/son/inc/os_if_son.h b/os_if/son/inc/os_if_son.h index e5561fc292..08298c4438 100644 --- a/os_if/son/inc/os_if_son.h +++ b/os_if/son/inc/os_if_son.h @@ -304,6 +304,14 @@ enum ieee80211_phymode os_if_son_get_phymode(struct wlan_objmgr_vdev *vdev); int os_if_son_set_phymode(struct wlan_objmgr_vdev *vdev, enum ieee80211_phymode mode); +/** + * os_if_son_get_chan_util() - get chan utilization + * @vdev: vdev + * + * Return: chan utilization (0 - 100) + */ +uint8_t os_if_son_get_chan_util(struct wlan_objmgr_vdev *vdev); + /** * os_if_son_pdev_ops() - Handles PDEV specific SON commands * @pdev: pdev diff --git a/os_if/son/src/os_if_son.c b/os_if/son/src/os_if_son.c index 2fc9ec2894..21ccd6a462 100644 --- a/os_if/son/src/os_if_son.c +++ b/os_if/son/src/os_if_son.c @@ -33,6 +33,7 @@ #include #include #include +#include static struct son_callbacks g_son_os_if_cb; @@ -708,6 +709,38 @@ int os_if_son_kickout_mac(struct wlan_objmgr_vdev *vdev, } qdf_export_symbol(os_if_son_kickout_mac); +uint8_t os_if_son_get_chan_util(struct wlan_objmgr_vdev *vdev) +{ + struct wlan_host_dcs_ch_util_stats dcs_son_stats = {}; + struct wlan_objmgr_psoc *psoc; + uint8_t mac_id; + QDF_STATUS status; + + if (!vdev) { + osif_err("null vdev"); + return 0; + } + + psoc = wlan_vdev_get_psoc(vdev); + if (!psoc) { + osif_err("null psoc"); + return 0; + } + status = policy_mgr_get_mac_id_by_session_id(psoc, + wlan_vdev_get_id(vdev), + &mac_id); + if (QDF_IS_STATUS_ERROR(status)) { + osif_err("Failed to get mac_id"); + return 0; + } + + ucfg_dcs_get_ch_util(psoc, mac_id, &dcs_son_stats); + osif_debug("get_chan_util %d", dcs_son_stats.total_cu); + + return dcs_son_stats.total_cu; +} +qdf_export_symbol(os_if_son_get_chan_util); + int os_if_son_set_phymode(struct wlan_objmgr_vdev *vdev, enum ieee80211_phymode mode) {