qcacmn: calculate RSSI in DBM

calculate rssi_comb and rssi per chain values using
parameters received from the fw.

Change-Id: Ide56549c7d7ee9bde609dc6764013d509f7ccac0
CRs-Fixed: 3157484
This commit is contained in:
KARTHIK KUMAR T
2022-03-23 18:24:55 +05:30
committed by Madan Koyyalamudi
parent dcaeac7d89
commit c7acbbd7ba
10 changed files with 135 additions and 6 deletions

View File

@@ -1151,6 +1151,7 @@ dp_mon_register_feature_ops_1_0(struct dp_soc *soc)
mon_ops->mon_filter_reset_undecoded_metadata_capture =
dp_mon_filter_reset_undecoded_metadata_capture_1_0;
#endif
mon_ops->mon_rx_stats_update_rssi_dbm_params = NULL;
}
struct dp_mon_ops monitor_ops_1_0 = {

View File

@@ -1452,6 +1452,8 @@ dp_mon_register_feature_ops_2_0(struct dp_soc *soc)
mon_ops->mon_filter_reset_undecoded_metadata_capture =
dp_mon_filter_reset_undecoded_metadata_capture_2_0;
#endif
mon_ops->mon_rx_stats_update_rssi_dbm_params =
dp_mon_rx_stats_update_rssi_dbm_params_2_0;
}
struct dp_mon_ops monitor_ops_2_0 = {

View File

@@ -1301,3 +1301,21 @@ dp_rx_mon_populate_ppdu_info_2_0(struct hal_rx_ppdu_info *hal_ppdu_info,
}
#endif
#endif
#ifdef QCA_RSSI_DB2DBM
void
dp_mon_rx_stats_update_rssi_dbm_params_2_0(struct dp_mon_pdev *mon_pdev)
{
struct dp_mon_pdev_be *mon_pdev_be =
dp_get_be_mon_pdev_from_dp_mon_pdev(mon_pdev);
mon_pdev->ppdu_info.rx_status.rssi_temp_offset =
mon_pdev_be->rssi_temp_offset;
mon_pdev->ppdu_info.rx_status.xlna_bypass_offset =
mon_pdev_be->xlna_bypass_offset;
mon_pdev->ppdu_info.rx_status.xlna_bypass_threshold =
mon_pdev_be->xlna_bypass_threshold;
mon_pdev->ppdu_info.rx_status.min_nf_dbm =
mon_pdev_be->min_nf_dbm;
mon_pdev->ppdu_info.rx_status.xbar_config =
mon_pdev_be->xbar_config;
}
#endif

View File

@@ -170,4 +170,22 @@ void
dp_rx_mon_handle_full_mon(struct dp_pdev *pdev,
struct hal_rx_ppdu_info *ppdu_info,
qdf_nbuf_t mpdu);
#ifdef QCA_RSSI_DB2DBM
/**
* dp_mon_rx_stats_update_rssi_dbm_params_2_0() - update rssi calibration
* parameters in rx stats
* @mon_pdev: monitor pdev
*/
void
dp_mon_rx_stats_update_rssi_dbm_params_2_0(struct dp_mon_pdev *mon_pdev);
#else
/**
* dp_mon_rx_stats_update_rssi_dbm_params_2_0() - update rssi calibration
* parameters in rx stats
* @mon_pdev: monitor pdev
*/
static inline void
dp_mon_rx_stats_update_rssi_dbm_params_2_0(struct dp_mon_pdev *mon_pdev)
{ }
#endif
#endif /* _DP_RX_MON_2_0_H_ */

View File

@@ -5715,6 +5715,7 @@ void dp_mon_feature_ops_deregister(struct dp_soc *soc)
mon_ops->mon_rx_populate_ppdu_usr_info = NULL;
mon_ops->mon_rx_populate_ppdu_info = NULL;
#endif
mon_ops->mon_rx_stats_update_rssi_dbm_params = NULL;
}
QDF_STATUS dp_mon_soc_attach(struct dp_soc *soc)

View File

@@ -779,6 +779,8 @@ struct dp_mon_ops {
void (*mon_lite_mon_vdev_delete)(struct dp_pdev *pdev,
struct dp_vdev *vdev);
void (*mon_lite_mon_disable_rx)(struct dp_pdev *pdev);
void (*mon_rx_stats_update_rssi_dbm_params)
(struct dp_mon_pdev *mon_pdev);
};
struct dp_mon_soc {
@@ -3754,6 +3756,27 @@ dp_rx_mon_enable(struct dp_soc *soc, uint32_t *msg_word,
monitor_ops->rx_mon_enable(msg_word, tlv_filter);
}
static inline void
dp_mon_rx_stats_update_rssi_dbm_params(struct dp_soc *soc,
struct dp_mon_pdev *mon_pdev)
{
struct dp_mon_soc *mon_soc = soc->monitor_soc;
struct dp_mon_ops *monitor_ops;
if (!mon_soc) {
dp_mon_debug("mon soc is NULL");
return;
}
monitor_ops = mon_soc->mon_ops;
if (!monitor_ops ||
!monitor_ops->mon_rx_stats_update_rssi_dbm_params) {
dp_mon_debug("callback not registered");
return;
}
monitor_ops->mon_rx_stats_update_rssi_dbm_params(mon_pdev);
}
#ifdef QCA_ENHANCED_STATS_SUPPORT
QDF_STATUS dp_peer_qos_stats_notify(struct dp_pdev *dp_pdev,
struct cdp_rx_stats_ppdu_user *ppdu_user);

View File

@@ -289,15 +289,63 @@ dp_bb_captured_chan_status(struct dp_pdev *pdev,
#endif /* WLAN_CFR_ENABLE */
#ifdef QCA_ENHANCED_STATS_SUPPORT
#ifdef QCA_RSSI_DB2DBM
/**
* dp_rx_mon_rf_index_conv() - this function will convert BB index to RF
* index in the rssi_chain[chain][bw] array
*
* @chain: BB chain index
* @pdev: pdev structure
*
* Return: return RF chain index
*
* Computation:
* 3 Bytes of xbar_config are used for RF to BB mapping
* Samples of xbar_config,
*
* If xbar_config is 0x688FAC(hex):
* RF chains 0-3 are connected to BB chains 4-7
* RF chains 4-7 are connected to BB chains 0-3
* here,
* bits 0 to 2 = 4, maps BB chain 4 for RF chain 0
* bits 3 to 5 = 5, maps BB chain 5 for RF chain 1
* bits 6 to 8 = 6, maps BB chain 6 for RF chain 2
* bits 9 to 11 = 7, maps BB chain 7 for RF chain 3
* bits 12 to 14 = 0, maps BB chain 0 for RF chain 4
* bits 15 to 17 = 1, maps BB chain 1 for RF chain 5
* bits 18 to 20 = 2, maps BB chain 2 for RF chain 6
* bits 21 to 23 = 3, maps BB chain 3 for RF chain 7
*/
static uint8_t dp_rx_mon_rf_index_conv(uint8_t chain,
struct hal_rx_ppdu_info *ppdu_info,
struct dp_pdev *pdev)
{
uint32_t xbar_config = ppdu_info->rx_status.xbar_config;
if (pdev->soc->features.rssi_dbm_conv_support && xbar_config)
return ((xbar_config >> (3 * chain)) & 0x07);
return chain;
}
#else
static uint8_t dp_rx_mon_rf_index_conv(uint8_t chain,
struct hal_rx_ppdu_info *ppdu_info,
struct dp_pdev *pdev)
{
return chain;
}
#endif
void
dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info,
struct cdp_rx_indication_ppdu *cdp_rx_ppdu)
struct cdp_rx_indication_ppdu *cdp_rx_ppdu,
struct dp_pdev *pdev)
{
uint8_t chain, bw;
uint8_t rssi;
for (chain = 0; chain < SS_COUNT; chain++) {
for (bw = 0; bw < MAX_BW; bw++) {
chain = dp_rx_mon_rf_index_conv(chain,
ppdu_info, pdev);
rssi = ppdu_info->rx_status.rssi_chain[chain][bw];
if (rssi != DP_RSSI_INVAL)
cdp_rx_ppdu->rssi_chain[chain][bw] = rssi;
@@ -596,8 +644,7 @@ dp_rx_populate_cdp_indication_ppdu(struct dp_pdev *pdev,
cdp_rx_ppdu->u.dcm = (ppdu_info->rx_status.he_data3 >>
QDF_MON_STATUS_DCM_SHIFT) & 0x1;
}
dp_rx_populate_rx_rssi_chain(ppdu_info, cdp_rx_ppdu);
dp_rx_populate_rx_rssi_chain(ppdu_info, cdp_rx_ppdu, pdev);
dp_rx_populate_su_evm_details(ppdu_info, cdp_rx_ppdu);
cdp_rx_ppdu->rx_antenna = ppdu_info->rx_status.rx_antenna;
@@ -1202,7 +1249,7 @@ dp_rx_populate_cdp_indication_ppdu_undecoded_metadata(struct dp_pdev *pdev,
cdp_rx_ppdu->sig_b_comp = (ppdu_info->rx_status.he_flags2 >>
QDF_MON_STATUS_SIG_B_COMPRESSION_FLAG_2_SHIFT) & 0x1;
}
dp_rx_populate_rx_rssi_chain(ppdu_info, cdp_rx_ppdu);
dp_rx_populate_rx_rssi_chain(ppdu_info, cdp_rx_ppdu, pdev);
dp_rx_populate_su_evm_details(ppdu_info, cdp_rx_ppdu);
cdp_rx_ppdu->rx_antenna = ppdu_info->rx_status.rx_antenna;
@@ -1766,7 +1813,7 @@ QDF_STATUS dp_rx_mon_deliver(struct dp_soc *soc, uint32_t mac_id,
mon_pdev->ppdu_info.rx_status.device_id = soc->device_id;
mon_pdev->ppdu_info.rx_status.chan_noise_floor =
pdev->chan_noise_floor;
dp_mon_rx_stats_update_rssi_dbm_params(soc, mon_pdev);
dp_handle_tx_capture(soc, pdev, mon_mpdu);
if (!qdf_nbuf_update_radiotap(&mon_pdev->ppdu_info.rx_status,

View File

@@ -302,7 +302,8 @@ dp_rx_mon_init_dbg_ppdu_stats(struct hal_rx_ppdu_info *ppdu_info,
#ifdef QCA_ENHANCED_STATS_SUPPORT
void
dp_rx_populate_rx_rssi_chain(struct hal_rx_ppdu_info *ppdu_info,
struct cdp_rx_indication_ppdu *cdp_rx_ppdu);
struct cdp_rx_indication_ppdu *cdp_rx_ppdu,
struct dp_pdev *pdev);
/*
* dp_rx_populate_su_evm_details() - Populate su evm info

View File

@@ -351,6 +351,11 @@ typedef __qdf_nbuf_queue_t qdf_nbuf_queue_t;
* @ht_stbc: Indicate stbc
* @ht_crc: ht crc
* @dcm: dcm
* @xlna_bypass_offset: Low noise amplifier bypass offset
* @xlna_bypass_threshold: Low noise amplifier bypass threshold
* @rssi_temp_offset: Temperature based rssi offset
* @min_nf_dbm: min noise floor in active chains per channel
* @xbar_config: 4 bytes, used for BB to RF Chain mapping
*/
struct mon_rx_status {
uint64_t tsft;
@@ -470,6 +475,13 @@ struct mon_rx_status {
ht_crc:8;
#endif
uint8_t dcm;
#ifdef QCA_RSSI_DB2DBM
int32_t xlna_bypass_offset;
int32_t xlna_bypass_threshold;
int32_t rssi_temp_offset;
int8_t min_nf_dbm;
uint32_t xbar_config;
#endif
};
/**

View File

@@ -5044,9 +5044,15 @@ static unsigned int qdf_nbuf_update_radiotap_ampdu_flags(
#define QDF_MON_STATUS_GET_RSSI_IN_DBM(rx_status) \
(rx_status->rssi_comb)
#else
#ifdef QCA_RSSI_DB2DBM
#define QDF_MON_STATUS_GET_RSSI_IN_DBM(rx_status) \
((rx_status)->rssi_comb + (rx_status)->min_nf_dbm +\
(rx_status)->rssi_temp_offset)
#else
#define QDF_MON_STATUS_GET_RSSI_IN_DBM(rx_status) \
(rx_status->rssi_comb + rx_status->chan_noise_floor)
#endif
#endif
/**
* qdf_nbuf_update_radiotap_tx_flags() - Update radiotap header tx flags