qcacmn: API to get channel utilization values
Add API to get channel utilization values from DCS , which can be used by other components, like EasyMesh. Change-Id: If0fa2b98a6c3deb80deea814d941614d1c41f01e CRs-Fixed: 3054014
This commit is contained in:
@@ -225,6 +225,31 @@ wlan_dcs_im_print_stats(struct wlan_host_dcs_im_tgt_stats *prev_stats,
|
||||
prev_stats->mib_stats.reg_cck_phyerr_cnt);
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_dcs_update_chan_util() - update chan utilization of dcs stats
|
||||
* @p_dcs_im_stats: pointer to pdev_dcs_im_stats
|
||||
* @rx_cu: rx channel utilization
|
||||
* @tx_cu: tx channel utilization
|
||||
* @obss_rx_cu: obss rx channel utilization
|
||||
* @total_cu: total channel utilization
|
||||
* @chan_nf: Channel noise floor (units are in dBm)
|
||||
*
|
||||
* Return: Void
|
||||
*/
|
||||
static void wlan_dcs_update_chan_util(struct pdev_dcs_im_stats *p_dcs_im_stats,
|
||||
uint32_t rx_cu, uint32_t tx_cu,
|
||||
uint32_t obss_rx_cu,
|
||||
uint32_t total_cu, uint32_t chan_nf)
|
||||
{
|
||||
if (p_dcs_im_stats) {
|
||||
p_dcs_im_stats->dcs_ch_util_im_stats.rx_cu = rx_cu;
|
||||
p_dcs_im_stats->dcs_ch_util_im_stats.tx_cu = tx_cu;
|
||||
p_dcs_im_stats->dcs_ch_util_im_stats.obss_rx_cu = obss_rx_cu;
|
||||
p_dcs_im_stats->dcs_ch_util_im_stats.total_cu = total_cu;
|
||||
p_dcs_im_stats->dcs_ch_util_im_stats.chan_nf = chan_nf;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* wlan_dcs_wlan_interference_process() - dcs detection algorithm handling
|
||||
* @curr_stats: current target im stats pointer
|
||||
@@ -252,6 +277,7 @@ wlan_dcs_wlan_interference_process(
|
||||
uint32_t reg_total_cu = 0;
|
||||
uint32_t reg_tx_cu = 0;
|
||||
uint32_t reg_rx_cu = 0;
|
||||
uint32_t obss_rx_cu = 0;
|
||||
uint32_t reg_unused_cu = 0;
|
||||
uint32_t rx_time_cu = 0;
|
||||
uint32_t reg_ofdm_phyerr_delta = 0;
|
||||
@@ -362,16 +388,6 @@ wlan_dcs_wlan_interference_process(
|
||||
}
|
||||
wlan_dcs_pdev_obj_unlock(dcs_pdev_priv);
|
||||
|
||||
/*
|
||||
* For below scenario, will ignore dcs event data and won't do
|
||||
* interference detection algorithm calculation:
|
||||
* 1: Current SAP channel isn't on 5G band
|
||||
* 2: In the process of ACS
|
||||
* 3: In the process of dcs disabling dcs_restart_delay time duration
|
||||
*/
|
||||
if (!dcs_host_params.dcs_algorithm_process)
|
||||
goto copy_stats;
|
||||
|
||||
/*
|
||||
* Total channel utiliztaion is the amount of time RXCLR is
|
||||
* counted. RXCLR is counted, when 'RX is NOT clear', please
|
||||
@@ -385,6 +401,11 @@ wlan_dcs_wlan_interference_process(
|
||||
reg_tx_cu = ((tx_frame_delta >> 8) * 100) / (cycle_count_delta >> 8);
|
||||
reg_rx_cu = ((rx_frame_delta >> 8) * 100) / (cycle_count_delta >> 8);
|
||||
rx_time_cu = ((curr_stats->rx_time >> 8) * 100) / (reg_tsf_delta >> 8);
|
||||
obss_rx_cu = (((rx_frame_delta - my_bss_rx_delta) >> 8) * 100) /
|
||||
(cycle_count_delta >> 8);
|
||||
wlan_dcs_update_chan_util(p_dcs_im_stats, reg_rx_cu, reg_tx_cu,
|
||||
obss_rx_cu, reg_total_cu,
|
||||
curr_stats->chan_nf);
|
||||
|
||||
/*
|
||||
* Amount of the time AP received cannot go higher than the receive
|
||||
@@ -395,8 +416,20 @@ wlan_dcs_wlan_interference_process(
|
||||
rx_time_cu = reg_rx_cu;
|
||||
|
||||
if (unlikely(dcs_host_params.dcs_debug >= DCS_DEBUG_VERBOSE))
|
||||
dcs_debug("reg_total_cu: %u, reg_tx_cu: %u, reg_rx_cu: %u, rx_time_cu: %u",
|
||||
reg_total_cu, reg_tx_cu, reg_rx_cu, rx_time_cu);
|
||||
dcs_debug("reg_total_cu: %u, reg_tx_cu: %u, reg_rx_cu: %u, rx_time_cu: %u, obss_rx_cu: %u dcs_algorithm: %d",
|
||||
reg_total_cu, reg_tx_cu, reg_rx_cu,
|
||||
rx_time_cu, obss_rx_cu,
|
||||
dcs_host_params.dcs_algorithm_process);
|
||||
|
||||
/*
|
||||
* For below scenario, will ignore dcs event data and won't do
|
||||
* interference detection algorithm calculation:
|
||||
* 1: Current SAP channel isn't on 5G band
|
||||
* 2: In the process of ACS
|
||||
* 3: In the process of dcs disabling dcs_restart_delay time duration
|
||||
*/
|
||||
if (!dcs_host_params.dcs_algorithm_process)
|
||||
goto copy_stats;
|
||||
|
||||
/*
|
||||
* Unusable channel utilization is amount of time that we
|
||||
@@ -1423,6 +1456,12 @@ void wlan_dcs_set_algorithm_process(struct wlan_objmgr_psoc *psoc,
|
||||
return;
|
||||
}
|
||||
|
||||
if (dcs_pdev_priv->dcs_host_params.force_disable_algorithm) {
|
||||
dcs_debug("dcs alorithm is disabled forcely");
|
||||
dcs_pdev_priv->dcs_host_params.dcs_algorithm_process = false;
|
||||
return;
|
||||
}
|
||||
|
||||
dcs_pdev_priv->dcs_host_params.dcs_algorithm_process =
|
||||
dcs_algorithm_process;
|
||||
}
|
||||
|
@@ -55,6 +55,7 @@ enum wlan_dcs_debug_level {
|
||||
* stats in pdev object
|
||||
* @prev_dcs_im_stats: previous statistics at last time
|
||||
* @user_dcs_im_stats: statistics requested from userspace
|
||||
* @dcs_ch_util_im_stats: chan utilization statistics
|
||||
* @im_intfr_cnt: number of times the interference is
|
||||
* detected within detection window
|
||||
* @im_sample_cnt: sample counter
|
||||
@@ -62,6 +63,7 @@ enum wlan_dcs_debug_level {
|
||||
struct pdev_dcs_im_stats {
|
||||
struct wlan_host_dcs_im_tgt_stats prev_dcs_im_stats;
|
||||
struct wlan_host_dcs_im_user_stats user_dcs_im_stats;
|
||||
struct wlan_host_dcs_ch_util_stats dcs_ch_util_im_stats;
|
||||
uint8_t im_intfr_cnt;
|
||||
uint8_t im_samp_cnt;
|
||||
};
|
||||
@@ -71,6 +73,7 @@ struct pdev_dcs_im_stats {
|
||||
* @dcs_enable_cfg: dcs enable from ini config
|
||||
* @dcs_enable: dcs enable from ucfg config
|
||||
* @dcs_algorithm_process: do dcs algorithm process or not
|
||||
* @force_disable_algorithm: disable dcs algorithm forcely
|
||||
* @dcs_debug: dcs debug trace level
|
||||
* @phy_err_penalty: phy error penalty
|
||||
* @phy_err_threshold: phy error threshold
|
||||
@@ -87,6 +90,7 @@ struct pdev_dcs_params {
|
||||
uint8_t dcs_enable_cfg;
|
||||
uint8_t dcs_enable;
|
||||
bool dcs_algorithm_process;
|
||||
bool force_disable_algorithm;
|
||||
enum wlan_dcs_debug_level dcs_debug;
|
||||
uint32_t phy_err_penalty;
|
||||
uint32_t phy_err_threshold;
|
||||
|
@@ -292,6 +292,27 @@
|
||||
0, 0xFFFFFFFF, 30,\
|
||||
CFG_VALUE_OR_DEFAULT, "dcs restart delay")
|
||||
|
||||
/*
|
||||
* <ini>
|
||||
* dcs_disable_algorithm - Some feature like SON only need dcs stats,
|
||||
* then disable dcs algorithm for SON.
|
||||
* @Min: 0
|
||||
* @Max: 1
|
||||
* @Default: 0
|
||||
*
|
||||
* This ini is used to disable dcs algorithm
|
||||
*
|
||||
*
|
||||
* Related: None
|
||||
*
|
||||
* Usage: External
|
||||
*
|
||||
* </ini>
|
||||
*/
|
||||
#define CFG_DCS_DISABLE_ALGORITHM CFG_INI_BOOL(\
|
||||
"dcs_disable_algorithm", false,\
|
||||
"dcs disable algorithm")
|
||||
|
||||
#define CFG_DCS_ALL \
|
||||
CFG(CFG_DCS_ENABLE) \
|
||||
CFG(CFG_DCS_DEBUG) \
|
||||
@@ -304,6 +325,7 @@
|
||||
CFG(CFG_DCS_INTFR_DETECTION_THRESHOLD) \
|
||||
CFG(CFG_DCS_INTFR_DETECTION_WINDOW) \
|
||||
CFG(CFG_DCS_DISABLE_THRESHOLD_PER_5MINS) \
|
||||
CFG(CFG_DCS_RESTART_DELAY)
|
||||
CFG(CFG_DCS_RESTART_DELAY) \
|
||||
CFG(CFG_DCS_DISABLE_ALGORITHM)
|
||||
|
||||
#endif /* __CONFIG_DCS_H */
|
||||
|
@@ -97,6 +97,22 @@ struct wlan_host_dcs_im_tgt_stats {
|
||||
uint32_t reg_rxclr_ext80_cnt;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wlan_host_dcs_ch_util_stats - DCS IM chan utilization stats
|
||||
* @rx_cu: rx channel utilization
|
||||
* @tx_cu: tx channel utilization
|
||||
* @rx_obss_cu: obss rx channel utilization
|
||||
* @total_cu: total channel utilization
|
||||
* @chan_nf: Channel noise floor (units are in dBm)
|
||||
*/
|
||||
struct wlan_host_dcs_ch_util_stats {
|
||||
uint32_t rx_cu;
|
||||
uint32_t tx_cu;
|
||||
uint32_t obss_rx_cu;
|
||||
uint32_t total_cu;
|
||||
uint32_t chan_nf;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct wlan_host_dcs_im_user_stats - DCS IM stats requested by userspace
|
||||
* @max_rssi: max rssi of the bss traffic
|
||||
|
@@ -189,6 +189,18 @@ void ucfg_dcs_reset_user_stats(struct wlan_objmgr_psoc *psoc, uint8_t mac_id);
|
||||
*/
|
||||
void ucfg_dcs_set_user_request(struct wlan_objmgr_psoc *psoc, uint8_t mac_id,
|
||||
uint32_t user_request_count);
|
||||
|
||||
/**
|
||||
* ucfg_dcs_get_ch_util() - API to get channel interference values
|
||||
* @psoc: pointer to psoc object
|
||||
* @mac_id: mac id
|
||||
* @dcs_stats: pointer to wlan_host_dcs_ch_util_stats
|
||||
*
|
||||
* Return: Integer
|
||||
*/
|
||||
QDF_STATUS ucfg_dcs_get_ch_util(struct wlan_objmgr_psoc *psoc, uint8_t mac_id,
|
||||
struct wlan_host_dcs_ch_util_stats *dcs_stats);
|
||||
|
||||
#else
|
||||
static inline void
|
||||
ucfg_dcs_register_cb(struct wlan_objmgr_psoc *psoc, dcs_callback cbk, void *arg)
|
||||
@@ -250,5 +262,12 @@ ucfg_dcs_set_user_request(struct wlan_objmgr_psoc *psoc, uint8_t mac_id,
|
||||
uint32_t user_request_count)
|
||||
{
|
||||
}
|
||||
|
||||
static inline QDF_STATUS
|
||||
ucfg_dcs_get_ch_util(struct wlan_objmgr_vdev *vdev,
|
||||
struct wlan_host_dcs_ch_util_stats *dcs_stats)
|
||||
{
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
#endif
|
||||
#endif /* _WLAN_DCS_UCFG_API_H_ */
|
||||
|
@@ -201,6 +201,8 @@ QDF_STATUS wlan_dcs_psoc_open(struct wlan_objmgr_psoc *psoc)
|
||||
cfg_get(psoc, CFG_DCS_INTFR_DETECTION_WINDOW);
|
||||
dcs_pdev_priv->dcs_host_params.tx_err_threshold =
|
||||
cfg_get(psoc, CFG_DCS_TX_ERR_THRESHOLD);
|
||||
dcs_pdev_priv->dcs_host_params.force_disable_algorithm =
|
||||
cfg_get(psoc, CFG_DCS_DISABLE_ALGORITHM);
|
||||
dcs_pdev_priv->dcs_freq_ctrl_params.
|
||||
disable_threshold_per_5mins =
|
||||
cfg_get(psoc, CFG_DCS_DISABLE_THRESHOLD_PER_5MINS);
|
||||
|
@@ -21,6 +21,7 @@
|
||||
|
||||
#include "wlan_dcs_ucfg_api.h"
|
||||
#include "../../core/src/wlan_dcs.h"
|
||||
#include "wlan_objmgr_vdev_obj.h"
|
||||
|
||||
void ucfg_dcs_register_cb(
|
||||
struct wlan_objmgr_psoc *psoc,
|
||||
@@ -181,3 +182,23 @@ void ucfg_dcs_set_user_request(struct wlan_objmgr_psoc *psoc, uint8_t mac_id,
|
||||
dcs_pdev_priv->dcs_host_params.user_request_count = user_request_count;
|
||||
wlan_dcs_pdev_obj_unlock(dcs_pdev_priv);
|
||||
}
|
||||
|
||||
QDF_STATUS ucfg_dcs_get_ch_util(struct wlan_objmgr_psoc *psoc, uint8_t mac_id,
|
||||
struct wlan_host_dcs_ch_util_stats *dcs_stats)
|
||||
{
|
||||
struct dcs_pdev_priv_obj *dcs_pdev_priv;
|
||||
|
||||
dcs_pdev_priv = wlan_dcs_get_pdev_private_obj(psoc, mac_id);
|
||||
if (!dcs_pdev_priv) {
|
||||
dcs_err("dcs pdev private object is null");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
wlan_dcs_pdev_obj_lock(dcs_pdev_priv);
|
||||
qdf_mem_copy(dcs_stats,
|
||||
&dcs_pdev_priv->dcs_im_stats.dcs_ch_util_im_stats,
|
||||
sizeof(*dcs_stats));
|
||||
wlan_dcs_pdev_obj_unlock(dcs_pdev_priv);
|
||||
|
||||
return QDF_STATUS_SUCCESS;
|
||||
}
|
||||
|
Reference in New Issue
Block a user