|
@@ -284,54 +284,6 @@ rate_found:
|
|
|
return match_rate ? index : INVALID_MCS_IDX;
|
|
|
}
|
|
|
|
|
|
-#ifndef QCA_SUPPORT_CP_STATS
|
|
|
-/**
|
|
|
- * wma_peek_vdev_req() - peek what request message is queued for response.
|
|
|
- * the function does not delete the node after found
|
|
|
- * @wma: WMA handle
|
|
|
- * @vdev_id: vdev ID
|
|
|
- * @type: request message type
|
|
|
- *
|
|
|
- * Return: the request message found
|
|
|
- */
|
|
|
-static struct wma_target_req *wma_peek_vdev_req(tp_wma_handle wma,
|
|
|
- uint8_t vdev_id, uint8_t type)
|
|
|
-{
|
|
|
- struct wma_target_req *req_msg = NULL;
|
|
|
- bool found = false;
|
|
|
- qdf_list_node_t *node1 = NULL, *node2 = NULL;
|
|
|
-
|
|
|
- qdf_spin_lock_bh(&wma->vdev_respq_lock);
|
|
|
- if (QDF_STATUS_SUCCESS != qdf_list_peek_front(&wma->vdev_resp_queue,
|
|
|
- &node2)) {
|
|
|
- qdf_spin_unlock_bh(&wma->vdev_respq_lock);
|
|
|
- return NULL;
|
|
|
- }
|
|
|
-
|
|
|
- do {
|
|
|
- node1 = node2;
|
|
|
- req_msg = qdf_container_of(node1, struct wma_target_req, node);
|
|
|
- if (req_msg->vdev_id != vdev_id)
|
|
|
- continue;
|
|
|
- if (req_msg->type != type)
|
|
|
- continue;
|
|
|
-
|
|
|
- found = true;
|
|
|
- break;
|
|
|
- } while (QDF_STATUS_SUCCESS == qdf_list_peek_next(&wma->vdev_resp_queue,
|
|
|
- node1, &node2));
|
|
|
- qdf_spin_unlock_bh(&wma->vdev_respq_lock);
|
|
|
- if (!found) {
|
|
|
- WMA_LOGE(FL("target request not found for vdev_id %d type %d"),
|
|
|
- vdev_id, type);
|
|
|
- return NULL;
|
|
|
- }
|
|
|
- WMA_LOGD(FL("target request found for vdev id: %d type %d msg %d"),
|
|
|
- vdev_id, type, req_msg->msg_type);
|
|
|
- return req_msg;
|
|
|
-}
|
|
|
-#endif /* QCA_SUPPORT_CP_STATS */
|
|
|
-
|
|
|
void wma_lost_link_info_handler(tp_wma_handle wma, uint32_t vdev_id,
|
|
|
int32_t rssi)
|
|
|
{
|
|
@@ -2434,300 +2386,8 @@ void wma_config_stats_ext_threshold(tp_wma_handle wma,
|
|
|
if (QDF_IS_STATUS_ERROR(status))
|
|
|
wmi_buf_free(buf);
|
|
|
}
|
|
|
-
|
|
|
#endif /* WLAN_FEATURE_LINK_LAYER_STATS */
|
|
|
|
|
|
-#ifndef QCA_SUPPORT_CP_STATS
|
|
|
-/**
|
|
|
- * wma_update_pdev_stats() - update pdev stats
|
|
|
- * @wma: wma handle
|
|
|
- * @pdev_stats: pdev stats
|
|
|
- *
|
|
|
- * Return: none
|
|
|
- */
|
|
|
-static void wma_update_pdev_stats(tp_wma_handle wma,
|
|
|
- wmi_pdev_stats *pdev_stats)
|
|
|
-{
|
|
|
- tAniGetPEStatsRsp *stats_rsp_params;
|
|
|
- uint32_t temp_mask;
|
|
|
- uint8_t *stats_buf;
|
|
|
- tCsrGlobalClassAStatsInfo *classa_stats = NULL;
|
|
|
- struct wma_txrx_node *node;
|
|
|
- uint8_t i;
|
|
|
-
|
|
|
- for (i = 0; i < wma->max_bssid; i++) {
|
|
|
- node = &wma->interfaces[i];
|
|
|
- stats_rsp_params = node->stats_rsp;
|
|
|
- if (stats_rsp_params) {
|
|
|
- node->fw_stats_set |= FW_PDEV_STATS_SET;
|
|
|
- WMA_LOGD("<---FW PDEV STATS received for vdevId:%d", i);
|
|
|
- stats_buf = (uint8_t *) (stats_rsp_params + 1);
|
|
|
- temp_mask = stats_rsp_params->statsMask;
|
|
|
- if (temp_mask & (1 << eCsrSummaryStats))
|
|
|
- stats_buf += sizeof(tCsrSummaryStatsInfo);
|
|
|
-
|
|
|
- if (temp_mask & (1 << eCsrGlobalClassAStats)) {
|
|
|
- classa_stats =
|
|
|
- (tCsrGlobalClassAStatsInfo *) stats_buf;
|
|
|
- classa_stats->max_pwr = pdev_stats->chan_tx_pwr;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * wma_vdev_stats_lost_link_helper() - helper function to extract
|
|
|
- * lost link information from vdev statistics event while deleting BSS.
|
|
|
- * @wma: WMA handle
|
|
|
- * @vdev_stats: statistics information from firmware
|
|
|
- *
|
|
|
- * This is for informing HDD to collect lost link information while
|
|
|
- * disconnection. Following conditions to check
|
|
|
- * 1. vdev is up
|
|
|
- * 2. bssid is zero. When handling DELETE_BSS request message, it sets bssid to
|
|
|
- * zero, hence add the check here to indicate the event comes during deleting
|
|
|
- * BSS
|
|
|
- * 3. DELETE_BSS is the request message queued. Put this condition check on the
|
|
|
- * last one as it consumes more resource searching entries in the list
|
|
|
- *
|
|
|
- * Return: none
|
|
|
- */
|
|
|
-static void wma_vdev_stats_lost_link_helper(tp_wma_handle wma,
|
|
|
- wmi_vdev_stats *vdev_stats)
|
|
|
-{
|
|
|
- struct wma_txrx_node *node;
|
|
|
- int8_t rssi;
|
|
|
- struct wma_target_req *req_msg;
|
|
|
- static const uint8_t zero_mac[QDF_MAC_ADDR_SIZE] = {0};
|
|
|
- bool db2dbm_enabled;
|
|
|
-
|
|
|
- if (vdev_stats->vdev_id >= wma->max_bssid) {
|
|
|
- WMA_LOGE("%s: Invalid vdev_id %hu",
|
|
|
- __func__, vdev_stats->vdev_id);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- db2dbm_enabled = wlan_psoc_nif_fw_ext_cap_get(wma->psoc,
|
|
|
- WLAN_SOC_CEXT_HW_DB2DBM);
|
|
|
- node = &wma->interfaces[vdev_stats->vdev_id];
|
|
|
- if (wma_is_vdev_up(vdev_stats->vdev_id) &&
|
|
|
- !qdf_mem_cmp(node->bssid, zero_mac, QDF_MAC_ADDR_SIZE)) {
|
|
|
- req_msg = wma_peek_vdev_req(wma, vdev_stats->vdev_id,
|
|
|
- WMA_TARGET_REQ_TYPE_VDEV_STOP);
|
|
|
- if ((!req_msg) ||
|
|
|
- (WMA_DELETE_BSS_REQ != req_msg->msg_type)) {
|
|
|
- WMA_LOGD(FL("cannot find DELETE_BSS request message"));
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- WMA_LOGD(FL("get vdev id %d, beancon snr %d, data snr %d"),
|
|
|
- vdev_stats->vdev_id, vdev_stats->vdev_snr.bcn_snr,
|
|
|
- vdev_stats->vdev_snr.dat_snr);
|
|
|
-
|
|
|
- wlan_util_stats_get_rssi(db2dbm_enabled,
|
|
|
- vdev_stats->vdev_snr.bcn_snr,
|
|
|
- vdev_stats->vdev_snr.dat_snr,
|
|
|
- &rssi);
|
|
|
-
|
|
|
- wma_lost_link_info_handler(wma, vdev_stats->vdev_id, rssi);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * wma_update_vdev_stats() - update vdev stats
|
|
|
- * @wma: wma handle
|
|
|
- * @vdev_stats: vdev stats
|
|
|
- *
|
|
|
- * Return: none
|
|
|
- */
|
|
|
-static void wma_update_vdev_stats(tp_wma_handle wma,
|
|
|
- wmi_vdev_stats *vdev_stats)
|
|
|
-{
|
|
|
- tAniGetPEStatsRsp *stats_rsp_params;
|
|
|
- tCsrSummaryStatsInfo *summary_stats = NULL;
|
|
|
- uint8_t *stats_buf;
|
|
|
- struct wma_txrx_node *node;
|
|
|
- uint8_t i;
|
|
|
- int8_t rssi = 0;
|
|
|
- QDF_STATUS qdf_status;
|
|
|
- tAniGetRssiReq *pGetRssiReq = (tAniGetRssiReq *) wma->pGetRssiReq;
|
|
|
- struct scheduler_msg sme_msg = { 0 };
|
|
|
- int32_t bcn_snr, dat_snr;
|
|
|
- bool db2dbm_enabled;
|
|
|
-
|
|
|
- if (vdev_stats->vdev_id >= wma->max_bssid) {
|
|
|
- WMA_LOGE("%s: Invalid vdev_id %hu",
|
|
|
- __func__, vdev_stats->vdev_id);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- bcn_snr = vdev_stats->vdev_snr.bcn_snr;
|
|
|
- dat_snr = vdev_stats->vdev_snr.dat_snr;
|
|
|
- WMA_LOGD("vdev id %d beancon snr %d data snr %d",
|
|
|
- vdev_stats->vdev_id, bcn_snr, dat_snr);
|
|
|
-
|
|
|
- db2dbm_enabled = wlan_psoc_nif_fw_ext_cap_get(wma->psoc,
|
|
|
- WLAN_SOC_CEXT_HW_DB2DBM);
|
|
|
- node = &wma->interfaces[vdev_stats->vdev_id];
|
|
|
- stats_rsp_params = node->stats_rsp;
|
|
|
- if (stats_rsp_params) {
|
|
|
- stats_buf = (uint8_t *) (stats_rsp_params + 1);
|
|
|
- node->fw_stats_set |= FW_VDEV_STATS_SET;
|
|
|
- WMA_LOGD("<---FW VDEV STATS received for vdevId:%d",
|
|
|
- vdev_stats->vdev_id);
|
|
|
- if (stats_rsp_params->statsMask & (1 << eCsrSummaryStats)) {
|
|
|
- summary_stats = (tCsrSummaryStatsInfo *) stats_buf;
|
|
|
- for (i = 0; i < 4; i++) {
|
|
|
- summary_stats->tx_frm_cnt[i] =
|
|
|
- vdev_stats->tx_frm_cnt[i];
|
|
|
- summary_stats->fail_cnt[i] =
|
|
|
- vdev_stats->fail_cnt[i];
|
|
|
- summary_stats->multiple_retry_cnt[i] =
|
|
|
- vdev_stats->multiple_retry_cnt[i];
|
|
|
- }
|
|
|
-
|
|
|
- summary_stats->rx_frm_cnt = vdev_stats->rx_frm_cnt;
|
|
|
- summary_stats->rx_error_cnt = vdev_stats->rx_err_cnt;
|
|
|
- summary_stats->rx_discard_cnt =
|
|
|
- vdev_stats->rx_discard_cnt;
|
|
|
- summary_stats->ack_fail_cnt = vdev_stats->ack_fail_cnt;
|
|
|
- summary_stats->rts_succ_cnt = vdev_stats->rts_succ_cnt;
|
|
|
- summary_stats->rts_fail_cnt = vdev_stats->rts_fail_cnt;
|
|
|
- /* Update SNR and RSSI in SummaryStats */
|
|
|
- wlan_util_stats_get_rssi(db2dbm_enabled,
|
|
|
- bcn_snr, dat_snr,
|
|
|
- &summary_stats->rssi);
|
|
|
- summary_stats->snr = summary_stats->rssi -
|
|
|
- WMA_TGT_NOISE_FLOOR_DBM;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (pGetRssiReq && pGetRssiReq->sessionId == vdev_stats->vdev_id) {
|
|
|
- wlan_util_stats_get_rssi(db2dbm_enabled, bcn_snr, dat_snr,
|
|
|
- &rssi);
|
|
|
-
|
|
|
- WMA_LOGD("Average Rssi = %d, vdev id= %d", rssi,
|
|
|
- pGetRssiReq->sessionId);
|
|
|
-
|
|
|
- /* update the average rssi value to UMAC layer */
|
|
|
- if (pGetRssiReq->rssiCallback) {
|
|
|
- ((tCsrRssiCallback) (pGetRssiReq->rssiCallback))(rssi,
|
|
|
- pGetRssiReq->staId,
|
|
|
- pGetRssiReq->pDevContext);
|
|
|
- }
|
|
|
-
|
|
|
- qdf_mem_free(pGetRssiReq);
|
|
|
- wma->pGetRssiReq = NULL;
|
|
|
- }
|
|
|
-
|
|
|
- if (node->psnr_req) {
|
|
|
- tAniGetSnrReq *p_snr_req = node->psnr_req;
|
|
|
-
|
|
|
- if (WMA_TGT_IS_VALID_SNR(bcn_snr))
|
|
|
- p_snr_req->snr = bcn_snr;
|
|
|
- else if (WMA_TGT_IS_VALID_SNR(dat_snr))
|
|
|
- p_snr_req->snr = dat_snr;
|
|
|
- else
|
|
|
- p_snr_req->snr = WMA_TGT_INVALID_SNR;
|
|
|
-
|
|
|
- sme_msg.type = eWNI_SME_SNR_IND;
|
|
|
- sme_msg.bodyptr = p_snr_req;
|
|
|
- sme_msg.bodyval = 0;
|
|
|
-
|
|
|
- qdf_status = scheduler_post_message(QDF_MODULE_ID_WMA,
|
|
|
- QDF_MODULE_ID_SME,
|
|
|
- QDF_MODULE_ID_SME,
|
|
|
- &sme_msg);
|
|
|
- if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
|
|
|
- WMA_LOGE("%s: Fail to post snr ind msg", __func__);
|
|
|
- qdf_mem_free(p_snr_req);
|
|
|
- }
|
|
|
-
|
|
|
- node->psnr_req = NULL;
|
|
|
- }
|
|
|
- wma_vdev_stats_lost_link_helper(wma, vdev_stats);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * wma_update_peer_stats() - update peer stats
|
|
|
- * @wma: wma handle
|
|
|
- * @peer_stats: peer stats
|
|
|
- *
|
|
|
- * Return: none
|
|
|
- */
|
|
|
-static void wma_update_peer_stats(tp_wma_handle wma,
|
|
|
- wmi_peer_stats *peer_stats)
|
|
|
-{
|
|
|
- tAniGetPEStatsRsp *stats_rsp_params;
|
|
|
- tCsrGlobalClassAStatsInfo *classa_stats = NULL;
|
|
|
- struct wma_txrx_node *node;
|
|
|
- uint8_t *stats_buf, vdev_id, macaddr[QDF_MAC_ADDR_SIZE], mcsRateFlags;
|
|
|
- uint32_t temp_mask;
|
|
|
- uint8_t nss;
|
|
|
-
|
|
|
- WMI_MAC_ADDR_TO_CHAR_ARRAY(&peer_stats->peer_macaddr, &macaddr[0]);
|
|
|
- if (!wma_find_vdev_by_bssid(wma, macaddr, &vdev_id))
|
|
|
- return;
|
|
|
-
|
|
|
- node = &wma->interfaces[vdev_id];
|
|
|
- stats_rsp_params = (tAniGetPEStatsRsp *) node->stats_rsp;
|
|
|
- if (stats_rsp_params) {
|
|
|
- node->fw_stats_set |= FW_PEER_STATS_SET;
|
|
|
- WMA_LOGD("<-- FW PEER STATS received for vdevId:%d", vdev_id);
|
|
|
- stats_buf = (uint8_t *) (stats_rsp_params + 1);
|
|
|
- temp_mask = stats_rsp_params->statsMask;
|
|
|
- if (temp_mask & (1 << eCsrSummaryStats))
|
|
|
- stats_buf += sizeof(tCsrSummaryStatsInfo);
|
|
|
-
|
|
|
- if (temp_mask & (1 << eCsrGlobalClassAStats)) {
|
|
|
- classa_stats = (tCsrGlobalClassAStatsInfo *) stats_buf;
|
|
|
- WMA_LOGD("peer tx rate:%d", peer_stats->peer_tx_rate);
|
|
|
- WMA_LOGD("peer rx rate:%d", peer_stats->peer_rx_rate);
|
|
|
- /* The linkspeed returned by fw is in kbps so convert
|
|
|
- * it in to units of 500kbps which is expected by UMAC
|
|
|
- */
|
|
|
- if (peer_stats->peer_tx_rate) {
|
|
|
- classa_stats->tx_rate =
|
|
|
- peer_stats->peer_tx_rate / 500;
|
|
|
- }
|
|
|
-
|
|
|
- if (peer_stats->peer_rx_rate) {
|
|
|
- classa_stats->rx_rate =
|
|
|
- peer_stats->peer_rx_rate / 500;
|
|
|
- }
|
|
|
-
|
|
|
- classa_stats->tx_rx_rate_flags = node->rate_flags;
|
|
|
- if (!(node->rate_flags & TX_RATE_LEGACY)) {
|
|
|
- nss = node->nss;
|
|
|
- classa_stats->tx_mcs_index =
|
|
|
- wma_get_mcs_idx(
|
|
|
- (peer_stats->peer_tx_rate /
|
|
|
- 100), node->rate_flags,
|
|
|
- &nss, &mcsRateFlags);
|
|
|
- classa_stats->tx_nss = nss;
|
|
|
- classa_stats->tx_mcs_rate_flags = mcsRateFlags;
|
|
|
- }
|
|
|
-
|
|
|
- if (!(node->rate_flags & TX_RATE_LEGACY)) {
|
|
|
- nss = node->nss;
|
|
|
- classa_stats->rx_mcs_index =
|
|
|
- wma_get_mcs_idx(
|
|
|
- (peer_stats->peer_rx_rate /
|
|
|
- 100), node->rate_flags,
|
|
|
- &nss, &mcsRateFlags);
|
|
|
- classa_stats->rx_nss = nss;
|
|
|
- classa_stats->rx_mcs_rate_flags = mcsRateFlags;
|
|
|
- }
|
|
|
- /* FW returns tx power in intervals of 0.5 dBm
|
|
|
- * Convert it back to intervals of 1 dBm
|
|
|
- */
|
|
|
- classa_stats->max_pwr =
|
|
|
- roundup(classa_stats->max_pwr, 2) >> 1;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-#endif /* WMA_GET_STATISTICS_RSP */
|
|
|
-
|
|
|
/**
|
|
|
* wma_post_link_status() - post link status to SME
|
|
|
* @pGetLinkStatus: SME Link status
|
|
@@ -2755,96 +2415,6 @@ void wma_post_link_status(tAniGetLinkStatus *pGetLinkStatus,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-#ifndef QCA_SUPPORT_CP_STATS
|
|
|
-/**
|
|
|
- * wma_update_per_chain_rssi_stats() - to store per chain rssi stats
|
|
|
- * @wma: wma handle
|
|
|
- * @rssi_stats: rssi stats
|
|
|
- * @rssi_per_chain_stats: buffer where rssi stats to be stored
|
|
|
- *
|
|
|
- * This function stores per chain rssi stats received from fw for all vdevs for
|
|
|
- * which the stats were requested into a csr stats structure.
|
|
|
- *
|
|
|
- * Return: void
|
|
|
- */
|
|
|
-static void wma_update_per_chain_rssi_stats(tp_wma_handle wma,
|
|
|
- wmi_rssi_stats *rssi_stats,
|
|
|
- struct csr_per_chain_rssi_stats_info *rssi_per_chain_stats)
|
|
|
-{
|
|
|
- int i;
|
|
|
- int32_t bcn_snr, dat_snr;
|
|
|
- bool db2dbm_enabled;
|
|
|
-
|
|
|
- db2dbm_enabled = wlan_psoc_nif_fw_ext_cap_get(wma->psoc,
|
|
|
- WLAN_SOC_CEXT_HW_DB2DBM);
|
|
|
- for (i = 0; i < NUM_CHAINS_MAX; i++) {
|
|
|
- bcn_snr = rssi_stats->rssi_avg_beacon[i];
|
|
|
- dat_snr = rssi_stats->rssi_avg_data[i];
|
|
|
- WMA_LOGD("chain %d beacon snr %d data snr %d",
|
|
|
- i, bcn_snr, dat_snr);
|
|
|
-
|
|
|
- wlan_util_stats_get_rssi(db2dbm_enabled, bcn_snr, dat_snr,
|
|
|
- &rssi_per_chain_stats->rssi[i]);
|
|
|
-
|
|
|
- WMI_MAC_ADDR_TO_CHAR_ARRAY(&(rssi_stats->peer_macaddr),
|
|
|
- rssi_per_chain_stats->peer_mac_addr);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * wma_update_rssi_stats() - to update rssi stats for all vdevs
|
|
|
- * for which the stats were requested.
|
|
|
- * @wma: wma handle
|
|
|
- * @rssi_stats: rssi stats
|
|
|
- *
|
|
|
- * This function updates the rssi stats for all vdevs for which
|
|
|
- * the stats were requested.
|
|
|
- *
|
|
|
- * Return: void
|
|
|
- */
|
|
|
-static void wma_update_rssi_stats(tp_wma_handle wma,
|
|
|
- wmi_rssi_stats *rssi_stats)
|
|
|
-{
|
|
|
- tAniGetPEStatsRsp *stats_rsp_params;
|
|
|
- struct csr_per_chain_rssi_stats_info *rssi_per_chain_stats = NULL;
|
|
|
- struct wma_txrx_node *node;
|
|
|
- uint8_t *stats_buf;
|
|
|
- uint32_t temp_mask;
|
|
|
- uint8_t vdev_id;
|
|
|
-
|
|
|
- if (rssi_stats->vdev_id >= wma->max_bssid) {
|
|
|
- WMA_LOGE("%s: Invalid vdev_id %hu",
|
|
|
- __func__, rssi_stats->vdev_id);
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- vdev_id = rssi_stats->vdev_id;
|
|
|
- node = &wma->interfaces[vdev_id];
|
|
|
- stats_rsp_params = (tAniGetPEStatsRsp *) node->stats_rsp;
|
|
|
- if (stats_rsp_params) {
|
|
|
- node->fw_stats_set |= FW_RSSI_PER_CHAIN_STATS_SET;
|
|
|
- WMA_LOGD("<-- FW RSSI PER CHAIN STATS received for vdevId:%d",
|
|
|
- vdev_id);
|
|
|
- stats_buf = (uint8_t *) (stats_rsp_params + 1);
|
|
|
- temp_mask = stats_rsp_params->statsMask;
|
|
|
-
|
|
|
- if (temp_mask & (1 << eCsrSummaryStats))
|
|
|
- stats_buf += sizeof(tCsrSummaryStatsInfo);
|
|
|
- if (temp_mask & (1 << eCsrGlobalClassAStats))
|
|
|
- stats_buf += sizeof(tCsrGlobalClassAStatsInfo);
|
|
|
- if (temp_mask & (1 << eCsrGlobalClassDStats))
|
|
|
- stats_buf += sizeof(tCsrGlobalClassDStatsInfo);
|
|
|
-
|
|
|
- if (temp_mask & (1 << csr_per_chain_rssi_stats)) {
|
|
|
- rssi_per_chain_stats =
|
|
|
- (struct csr_per_chain_rssi_stats_info *)stats_buf;
|
|
|
- wma_update_per_chain_rssi_stats(wma, rssi_stats,
|
|
|
- rssi_per_chain_stats);
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-#endif /* QCA_SUPPORT_CP_STATS */
|
|
|
-
|
|
|
/**
|
|
|
* wma_link_status_event_handler() - link status event handler
|
|
|
* @handle: wma handle
|
|
@@ -2950,267 +2520,6 @@ int wma_rso_cmd_status_event_handler(wmi_roam_event_fixed_param *wmi_event)
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-#ifndef QCA_SUPPORT_CP_STATS
|
|
|
-/**
|
|
|
- * wma_handle_sta_peer_info() - handle peer information in
|
|
|
- * peer stats
|
|
|
- * @num_peer_stats: peer number
|
|
|
- * @peer_stats: peer stats received from firmware
|
|
|
- * @peer_macaddr: the specified mac address
|
|
|
- * @sapaddr: sap mac address
|
|
|
- *
|
|
|
- * This function will send eWNI_SME_GET_PEER_INFO_IND
|
|
|
- * to sme with stations' information
|
|
|
- *
|
|
|
- */
|
|
|
-static void wma_handle_sta_peer_info(uint32_t num_peer_stats,
|
|
|
- wmi_peer_stats *peer_stats,
|
|
|
- struct qdf_mac_addr peer_macaddr,
|
|
|
- uint8_t *sapaddr)
|
|
|
-{
|
|
|
- QDF_STATUS qdf_status;
|
|
|
- wmi_mac_addr temp_addr;
|
|
|
- struct sir_peer_info_resp *peer_info;
|
|
|
- struct scheduler_msg sme_msg = {0};
|
|
|
- uint32_t i;
|
|
|
- uint32_t j = 0;
|
|
|
-
|
|
|
- if (!qdf_is_macaddr_broadcast(&peer_macaddr)) {
|
|
|
- WMI_CHAR_ARRAY_TO_MAC_ADDR(peer_macaddr.bytes, &temp_addr);
|
|
|
- for (i = 0; i < num_peer_stats; i++) {
|
|
|
- if ((((temp_addr.mac_addr47to32) & 0x0000ffff) ==
|
|
|
- ((peer_stats->peer_macaddr.mac_addr47to32) &
|
|
|
- 0x0000ffff))
|
|
|
- && (temp_addr.mac_addr31to0 ==
|
|
|
- peer_stats->peer_macaddr.mac_addr31to0)) {
|
|
|
-
|
|
|
- break;
|
|
|
- }
|
|
|
- peer_stats = peer_stats + 1;
|
|
|
- }
|
|
|
- peer_info = qdf_mem_malloc(sizeof(*peer_info) +
|
|
|
- sizeof(peer_info->info[0]));
|
|
|
- if (!peer_info)
|
|
|
- return;
|
|
|
-
|
|
|
- if (i < num_peer_stats) {
|
|
|
- peer_info->count = 1;
|
|
|
- WMI_MAC_ADDR_TO_CHAR_ARRAY(&(peer_stats->peer_macaddr),
|
|
|
- peer_info->info[0].peer_macaddr.bytes);
|
|
|
- peer_info->info[0].rssi = peer_stats->peer_rssi;
|
|
|
- peer_info->info[0].tx_rate = peer_stats->peer_tx_rate;
|
|
|
- peer_info->info[0].rx_rate = peer_stats->peer_rx_rate;
|
|
|
- WMA_LOGD("%s peer %pM rssi %d tx_rate %d rx_rate %d",
|
|
|
- __func__,
|
|
|
- peer_info->info[0].peer_macaddr.bytes,
|
|
|
- peer_stats->peer_rssi,
|
|
|
- peer_stats->peer_tx_rate,
|
|
|
- peer_stats->peer_rx_rate);
|
|
|
- } else {
|
|
|
- WMA_LOGE("%s: no match mac address", __func__);
|
|
|
- peer_info->count = 0;
|
|
|
- }
|
|
|
- } else {
|
|
|
- peer_info = qdf_mem_malloc(sizeof(*peer_info) +
|
|
|
- num_peer_stats * sizeof(peer_info->info[0]));
|
|
|
- if (!peer_info)
|
|
|
- return;
|
|
|
-
|
|
|
- peer_info->count = num_peer_stats;
|
|
|
-
|
|
|
- for (i = 0; i < num_peer_stats; i++) {
|
|
|
- WMI_MAC_ADDR_TO_CHAR_ARRAY(&(peer_stats->peer_macaddr),
|
|
|
- peer_info->info[j].peer_macaddr.bytes);
|
|
|
- peer_info->info[j].rssi = peer_stats->peer_rssi;
|
|
|
- peer_info->info[j].tx_rate = peer_stats->peer_tx_rate;
|
|
|
- peer_info->info[j].rx_rate = peer_stats->peer_rx_rate;
|
|
|
- WMA_LOGD("%s peer %pM rssi %d tx_rate %d rx_rate %d",
|
|
|
- __func__,
|
|
|
- peer_info->info[j].peer_macaddr.bytes,
|
|
|
- peer_stats->peer_rssi,
|
|
|
- peer_stats->peer_tx_rate,
|
|
|
- peer_stats->peer_rx_rate);
|
|
|
- if (!qdf_mem_cmp(peer_info->info[j].peer_macaddr.bytes,
|
|
|
- sapaddr, QDF_MAC_ADDR_SIZE)) {
|
|
|
- peer_info->count = peer_info->count - 1;
|
|
|
- } else {
|
|
|
- j++;
|
|
|
- }
|
|
|
- peer_stats = peer_stats + 1;
|
|
|
- }
|
|
|
- WMA_LOGD("WDA send peer num %d", peer_info->count);
|
|
|
- }
|
|
|
-
|
|
|
- sme_msg.type = eWNI_SME_GET_PEER_INFO_IND;
|
|
|
- sme_msg.bodyptr = peer_info;
|
|
|
- sme_msg.bodyval = 0;
|
|
|
-
|
|
|
- qdf_status = scheduler_post_message(QDF_MODULE_ID_WMA,
|
|
|
- QDF_MODULE_ID_SME,
|
|
|
- QDF_MODULE_ID_SME, &sme_msg);
|
|
|
- if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
|
|
|
- WMA_LOGE("%s: Fail to post get rssi msg", __func__);
|
|
|
- qdf_mem_free(peer_info);
|
|
|
- }
|
|
|
-
|
|
|
- return;
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * wma_stats_event_handler() - stats event handler
|
|
|
- * @handle: wma handle
|
|
|
- * @cmd_param_info: data from event
|
|
|
- * @len: length
|
|
|
- *
|
|
|
- * Return: 0 for success or error code
|
|
|
- */
|
|
|
-int wma_stats_event_handler(void *handle, uint8_t *cmd_param_info,
|
|
|
- uint32_t len)
|
|
|
-{
|
|
|
- tp_wma_handle wma = (tp_wma_handle) handle;
|
|
|
- WMI_UPDATE_STATS_EVENTID_param_tlvs *param_buf;
|
|
|
- wmi_stats_event_fixed_param *event;
|
|
|
- wmi_pdev_stats *pdev_stats;
|
|
|
- wmi_vdev_stats *vdev_stats;
|
|
|
- wmi_peer_stats *peer_stats;
|
|
|
- wmi_rssi_stats *rssi_stats;
|
|
|
- wmi_per_chain_rssi_stats *rssi_event;
|
|
|
- struct wma_txrx_node *node;
|
|
|
- uint8_t *temp;
|
|
|
- uint32_t i;
|
|
|
- uint32_t buf_len = 0;
|
|
|
- bool excess_data = false;
|
|
|
- struct mac_context *mac;
|
|
|
-
|
|
|
- param_buf = (WMI_UPDATE_STATS_EVENTID_param_tlvs *) cmd_param_info;
|
|
|
- if (!param_buf) {
|
|
|
- WMA_LOGA("%s: Invalid stats event", __func__);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- event = param_buf->fixed_param;
|
|
|
- temp = (uint8_t *) param_buf->data;
|
|
|
-
|
|
|
- do {
|
|
|
- if (event->num_pdev_stats > ((WMI_SVC_MSG_MAX_SIZE -
|
|
|
- sizeof(*event)) / sizeof(*pdev_stats))) {
|
|
|
- excess_data = true;
|
|
|
- break;
|
|
|
- } else {
|
|
|
- buf_len += event->num_pdev_stats * sizeof(*pdev_stats);
|
|
|
- }
|
|
|
-
|
|
|
- if (event->num_vdev_stats > ((WMI_SVC_MSG_MAX_SIZE -
|
|
|
- sizeof(*event)) / sizeof(*vdev_stats))) {
|
|
|
- excess_data = true;
|
|
|
- break;
|
|
|
- } else {
|
|
|
- buf_len += event->num_vdev_stats * sizeof(*vdev_stats);
|
|
|
- }
|
|
|
-
|
|
|
- if (event->num_peer_stats > ((WMI_SVC_MSG_MAX_SIZE -
|
|
|
- sizeof(*event)) / sizeof(*peer_stats))) {
|
|
|
- excess_data = true;
|
|
|
- break;
|
|
|
- } else {
|
|
|
- buf_len += event->num_peer_stats * sizeof(*peer_stats);
|
|
|
- }
|
|
|
-
|
|
|
- if (buf_len > param_buf->num_data) {
|
|
|
- WMA_LOGE("%s: num_data: %d Invalid num_pdev_stats:%d or num_vdev_stats:%d or num_peer_stats:%d",
|
|
|
- __func__, param_buf->num_data,
|
|
|
- event->num_pdev_stats,
|
|
|
- event->num_vdev_stats, event->num_peer_stats);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- rssi_event =
|
|
|
- (wmi_per_chain_rssi_stats *) param_buf->chain_stats;
|
|
|
- if (rssi_event) {
|
|
|
- if (rssi_event->num_per_chain_rssi_stats >
|
|
|
- ((WMI_SVC_MSG_MAX_SIZE - sizeof(*event)) /
|
|
|
- sizeof(*rssi_event))) {
|
|
|
- excess_data = true;
|
|
|
- break;
|
|
|
- } else {
|
|
|
- buf_len += sizeof(*rssi_event) *
|
|
|
- rssi_event->num_per_chain_rssi_stats;
|
|
|
- }
|
|
|
- }
|
|
|
- } while (0);
|
|
|
-
|
|
|
- if (excess_data ||
|
|
|
- (buf_len > WMI_SVC_MSG_MAX_SIZE - sizeof(*event))) {
|
|
|
- WMA_LOGE("excess wmi buffer: stats pdev %d vdev %d peer %d",
|
|
|
- event->num_pdev_stats, event->num_vdev_stats,
|
|
|
- event->num_peer_stats);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
-
|
|
|
- if (event->num_pdev_stats > 0) {
|
|
|
- for (i = 0; i < event->num_pdev_stats; i++) {
|
|
|
- pdev_stats = (wmi_pdev_stats *) temp;
|
|
|
- wma_update_pdev_stats(wma, pdev_stats);
|
|
|
- temp += sizeof(wmi_pdev_stats);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (event->num_vdev_stats > 0) {
|
|
|
- for (i = 0; i < event->num_vdev_stats; i++) {
|
|
|
- vdev_stats = (wmi_vdev_stats *) temp;
|
|
|
- wma_update_vdev_stats(wma, vdev_stats);
|
|
|
- temp += sizeof(wmi_vdev_stats);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if (event->num_peer_stats > 0) {
|
|
|
- if (wma->get_sta_peer_info == true) {
|
|
|
- wma_handle_sta_peer_info(event->num_peer_stats,
|
|
|
- (wmi_peer_stats *)temp,
|
|
|
- wma->peer_macaddr,
|
|
|
- wma->myaddr);
|
|
|
- } else {
|
|
|
- for (i = 0; i < event->num_peer_stats; i++) {
|
|
|
- peer_stats = (wmi_peer_stats *) temp;
|
|
|
- wma_update_peer_stats(wma, peer_stats);
|
|
|
- temp += sizeof(wmi_peer_stats);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- rssi_event = (wmi_per_chain_rssi_stats *) param_buf->chain_stats;
|
|
|
- if (rssi_event) {
|
|
|
- if (rssi_event->num_per_chain_rssi_stats >
|
|
|
- param_buf->num_rssi_stats) {
|
|
|
- WMA_LOGE("%s: Invalid num_per_chain_rssi_stats:%d",
|
|
|
- __func__, rssi_event->num_per_chain_rssi_stats);
|
|
|
- return -EINVAL;
|
|
|
- }
|
|
|
- if (((rssi_event->tlv_header & 0xFFFF0000) >> 16 ==
|
|
|
- WMITLV_TAG_STRUC_wmi_per_chain_rssi_stats) &&
|
|
|
- ((rssi_event->tlv_header & 0x0000FFFF) ==
|
|
|
- WMITLV_GET_STRUCT_TLVLEN(wmi_per_chain_rssi_stats))) {
|
|
|
- if (rssi_event->num_per_chain_rssi_stats > 0) {
|
|
|
- temp = (uint8_t *) rssi_event;
|
|
|
- temp += sizeof(*rssi_event);
|
|
|
-
|
|
|
- /* skip past struct array tlv header */
|
|
|
- temp += WMI_TLV_HDR_SIZE;
|
|
|
-
|
|
|
- for (i = 0;
|
|
|
- i < rssi_event->num_per_chain_rssi_stats;
|
|
|
- i++) {
|
|
|
- rssi_stats = (wmi_rssi_stats *)temp;
|
|
|
- wma_update_rssi_stats(wma, rssi_stats);
|
|
|
- temp += sizeof(wmi_rssi_stats);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return 0;
|
|
|
-}
|
|
|
-#endif /* QCA_SUPPORT_CP_STATS */
|
|
|
-
|
|
|
/**
|
|
|
* wma_fill_peer_info() - fill SIR peer info from WMI peer info struct
|
|
|
* @wma: wma interface
|