qcacld-3.0: Refactor code to store chan info status in cp_stats
Currently channel info stats are stored in LIM. Refactor code to store channel info stats in cp stats component. Change-Id: I2e7219c112e96916d3b73f974dd9803b9c2821c3 CRs-Fixed: 3265722
This commit is contained in:

committed by
Madan Koyyalamudi

parent
a7fcc140bb
commit
1981726d18
@@ -329,6 +329,49 @@ struct pdev_mc_cp_extd_stats {
|
||||
uint32_t rx_other_11ax_msdu_cnt;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct channel_status
|
||||
* @channel_freq: Channel freq
|
||||
* @noise_floor: Noise Floor value
|
||||
* @rx_clear_count: rx clear count
|
||||
* @cycle_count: cycle count
|
||||
* @chan_tx_pwr_range: channel tx power per range in 0.5dBm steps
|
||||
* @chan_tx_pwr_throughput: channel tx power per throughput
|
||||
* @rx_frame_count: rx frame count (cumulative)
|
||||
* @bss_rx_cycle_count: BSS rx cycle count
|
||||
* @rx_11b_mode_data_duration: b-mode data rx time (units are microseconds)
|
||||
* @tx_frame_count: BSS tx cycle count
|
||||
* @mac_clk_mhz: sample frequency
|
||||
* @channel_id: channel index
|
||||
* @cmd_flags: indicate which stat event is this status coming from
|
||||
*/
|
||||
struct channel_status {
|
||||
uint32_t channel_freq;
|
||||
uint32_t noise_floor;
|
||||
uint32_t rx_clear_count;
|
||||
uint32_t cycle_count;
|
||||
uint32_t chan_tx_pwr_range;
|
||||
uint32_t chan_tx_pwr_throughput;
|
||||
uint32_t rx_frame_count;
|
||||
uint32_t bss_rx_cycle_count;
|
||||
uint32_t rx_11b_mode_data_duration;
|
||||
uint32_t tx_frame_count;
|
||||
uint32_t mac_clk_mhz;
|
||||
uint32_t channel_id;
|
||||
uint32_t cmd_flags;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct per_channel_stats
|
||||
* @total_channel: total number of be scanned channel
|
||||
* @channel_status_list: channel status info store in this array
|
||||
*/
|
||||
struct per_channel_stats {
|
||||
uint8_t total_channel;
|
||||
struct channel_status
|
||||
channel_status_list[NUM_CHANNELS];
|
||||
};
|
||||
|
||||
/**
|
||||
* struct pdev_mc_cp_stats: pdev specific stats
|
||||
* @max_pwr: max tx power for pdev
|
||||
@@ -336,6 +379,7 @@ struct pdev_mc_cp_extd_stats {
|
||||
* @rx_clear_count: accumulative rx clear count (busy time) of pdev
|
||||
* @cycle_count: accumulative cycle count (total time) of pdev
|
||||
* @tx_frame_count: accumulative tx frame count (total time) of pdev
|
||||
* @chan_stats: per channel info stats
|
||||
*/
|
||||
struct pdev_mc_cp_stats {
|
||||
int32_t max_pwr;
|
||||
@@ -343,6 +387,7 @@ struct pdev_mc_cp_stats {
|
||||
uint32_t rx_clear_count;
|
||||
uint32_t cycle_count;
|
||||
uint32_t tx_frame_count;
|
||||
struct per_channel_stats chan_stats;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -378,6 +378,36 @@ wlan_cfg80211_mc_bmiss_get_infra_cp_stats(
|
||||
}
|
||||
#endif /* CONFIG_WLAN_BMISS */
|
||||
|
||||
/**
|
||||
* wlan_cp_stats_update_chan_info() - API to update chan stats
|
||||
* @psoc: pointer to psoc
|
||||
* @chan_stat: channel stats
|
||||
* @vdev_id: vdev id
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void wlan_cp_stats_update_chan_info(struct wlan_objmgr_psoc *psoc,
|
||||
struct channel_status *chan_stat,
|
||||
uint8_t vdev_id);
|
||||
|
||||
/**
|
||||
* ucfg_mc_cp_stats_clear_channel_status() - API to clear chan stats
|
||||
* @pdev: pointer to pdev object
|
||||
*
|
||||
* Return: None
|
||||
*/
|
||||
void ucfg_mc_cp_stats_clear_channel_status(struct wlan_objmgr_pdev *pdev);
|
||||
|
||||
/**
|
||||
* ucfg_mc_cp_stats_get_channel_status() - API to get chan stats
|
||||
* @pdev: pointer to pdev object
|
||||
* @chan_freq: channel freq of which stats are needed
|
||||
*
|
||||
* Return: channel status
|
||||
*/
|
||||
struct channel_status *
|
||||
ucfg_mc_cp_stats_get_channel_status(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan_freq);
|
||||
#else /* QCA_SUPPORT_CP_STATS */
|
||||
|
||||
void static inline ucfg_mc_cp_stats_register_pmo_handler(void) { };
|
||||
@@ -465,5 +495,23 @@ ucfg_mc_cp_stats_get_tx_power(struct wlan_objmgr_vdev *vdev,
|
||||
int *dbm)
|
||||
{}
|
||||
|
||||
static inline
|
||||
void wlan_cp_stats_update_chan_info(struct wlan_objmgr_psoc *psoc,
|
||||
struct channel_status *chan_stat,
|
||||
uint8_t vdev_id)
|
||||
{
|
||||
}
|
||||
|
||||
static inline
|
||||
void ucfg_mc_cp_stats_clear_channel_status(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
}
|
||||
|
||||
static inline struct channel_status *
|
||||
ucfg_mc_cp_stats_get_channel_status(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan_freq)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
#endif /* QCA_SUPPORT_CP_STATS */
|
||||
#endif /* __WLAN_CP_STATS_MC_UCFG_API_H__ */
|
||||
|
@@ -1072,4 +1072,121 @@ void ucfg_mc_cp_stats_register_pmo_handler(void)
|
||||
pmo_register_resume_handler(WLAN_UMAC_COMP_CP_STATS,
|
||||
ucfg_mc_cp_stats_resume_handler, NULL);
|
||||
}
|
||||
|
||||
void wlan_cp_stats_update_chan_info(struct wlan_objmgr_psoc *psoc,
|
||||
struct channel_status *channel_stat,
|
||||
uint8_t vdev_id)
|
||||
{
|
||||
struct wlan_objmgr_pdev *pdev;
|
||||
struct wlan_objmgr_vdev *vdev;
|
||||
struct pdev_cp_stats *pdev_cp_stats_priv;
|
||||
struct per_channel_stats *channel_stats;
|
||||
struct channel_status *channel_status_list;
|
||||
uint8_t total_channel;
|
||||
uint8_t i;
|
||||
bool found = false;
|
||||
|
||||
vdev = wlan_objmgr_get_vdev_by_id_from_psoc(psoc, vdev_id,
|
||||
WLAN_CP_STATS_ID);
|
||||
if (!vdev)
|
||||
return;
|
||||
|
||||
pdev = wlan_vdev_get_pdev(vdev);
|
||||
if (!pdev)
|
||||
return;
|
||||
|
||||
pdev_cp_stats_priv = wlan_cp_stats_get_pdev_stats_obj(pdev);
|
||||
if (!pdev_cp_stats_priv) {
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID);
|
||||
cp_stats_err("pdev cp stats object is null");
|
||||
return;
|
||||
}
|
||||
|
||||
channel_stats = &pdev_cp_stats_priv->pdev_stats->chan_stats;
|
||||
channel_status_list = channel_stats->channel_status_list;
|
||||
total_channel = channel_stats->total_channel;
|
||||
|
||||
for (i = 0; i < total_channel; i++) {
|
||||
if (channel_status_list[i].channel_id ==
|
||||
channel_stat->channel_id) {
|
||||
if (channel_stat->cmd_flags ==
|
||||
WMI_CHAN_InFO_END_RESP &&
|
||||
channel_status_list[i].cmd_flags ==
|
||||
WMI_CHAN_InFO_START_RESP) {
|
||||
/* adjust to delta value for counts */
|
||||
channel_stat->rx_clear_count -=
|
||||
channel_status_list[i].rx_clear_count;
|
||||
channel_stat->cycle_count -=
|
||||
channel_status_list[i].cycle_count;
|
||||
channel_stat->rx_frame_count -=
|
||||
channel_status_list[i].rx_frame_count;
|
||||
channel_stat->tx_frame_count -=
|
||||
channel_status_list[i].tx_frame_count;
|
||||
channel_stat->bss_rx_cycle_count -=
|
||||
channel_status_list[i].bss_rx_cycle_count;
|
||||
}
|
||||
qdf_mem_copy(&channel_status_list[i], channel_stat,
|
||||
sizeof(*channel_status_list));
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
if (total_channel < NUM_CHANNELS) {
|
||||
qdf_mem_copy(&channel_status_list[total_channel++],
|
||||
channel_stat,
|
||||
sizeof(*channel_status_list));
|
||||
channel_stats->total_channel = total_channel;
|
||||
} else {
|
||||
cp_stats_err("Chan cnt exceed, channel_id=%d",
|
||||
channel_stat->channel_id);
|
||||
}
|
||||
}
|
||||
|
||||
wlan_objmgr_vdev_release_ref(vdev, WLAN_CP_STATS_ID);
|
||||
}
|
||||
|
||||
struct channel_status *
|
||||
ucfg_mc_cp_stats_get_channel_status(struct wlan_objmgr_pdev *pdev,
|
||||
uint32_t chan_freq)
|
||||
{
|
||||
struct pdev_cp_stats *pdev_cp_stats_priv;
|
||||
struct per_channel_stats *channel_stats;
|
||||
struct channel_status *entry;
|
||||
uint8_t i;
|
||||
|
||||
pdev_cp_stats_priv = wlan_cp_stats_get_pdev_stats_obj(pdev);
|
||||
if (!pdev_cp_stats_priv) {
|
||||
cp_stats_err("pdev cp stats object is null");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
channel_stats = &pdev_cp_stats_priv->pdev_stats->chan_stats;
|
||||
|
||||
for (i = 0; i < channel_stats->total_channel; i++) {
|
||||
entry = &channel_stats->channel_status_list[i];
|
||||
if (entry->channel_freq == chan_freq)
|
||||
return entry;
|
||||
}
|
||||
cp_stats_err("Channel %d status info not exist", chan_freq);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ucfg_mc_cp_stats_clear_channel_status(struct wlan_objmgr_pdev *pdev)
|
||||
{
|
||||
struct pdev_cp_stats *pdev_cp_stats_priv;
|
||||
struct per_channel_stats *channel_stats;
|
||||
|
||||
pdev_cp_stats_priv = wlan_cp_stats_get_pdev_stats_obj(pdev);
|
||||
if (!pdev_cp_stats_priv) {
|
||||
cp_stats_err("pdev cp stats object is null");
|
||||
return;
|
||||
}
|
||||
|
||||
channel_stats = &pdev_cp_stats_priv->pdev_stats->chan_stats;
|
||||
channel_stats->total_channel = 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user