On Wed, Oct 16, 2019 at 8:33 PM <yhchuang@xxxxxxxxxxx> wrote: > > From: Tsang-Shian Lin <thlin@xxxxxxxxxxx> > > This commit adds several Tx/Rx physical information to phy_info > debugfs for 8822B/8822C. By this debugfs, we can know physical > information, such as Tx/Rx rate, RSSI, EVM,SNR, etc. The > information is gotten from the packets of Tx/Rx path. It has > no impact for the performance of 8822B/8822C. > > In the fields, we may meet different kinds of problems, but > we may have no professional instrument to check them. At > this moment, this debugfs is a good tool, and it may provide > useful information for debug. > > Signed-off-by: Tsang-Shian Lin <thlin@xxxxxxxxxxx> > Signed-off-by: Yan-Hsuan Chuang <yhchuang@xxxxxxxxxxx> > --- > > v1 -> v2 > * No change > > @@ -528,10 +556,16 @@ struct rtw_rx_pkt_stat { > s8 rx_power[RTW_RF_PATH_MAX]; > u8 rssi; > u8 rxsc; > + s8 rx_snr[RTW_RF_PATH_MAX]; > + u8 rx_evm[RTW_RF_PATH_MAX]; > + s8 cfo_tail[RTW_RF_PATH_MAX]; > + > struct rtw_sta_info *si; > struct ieee80211_vif *vif; > }; > > +DECLARE_EWMA(tp, 10, 2); > + > struct rtw_traffic_stats { > /* units in bytes */ > u64 tx_unicast; > @@ -853,6 +860,34 @@ static void query_phy_status_page1(struct rtw_dev *rtwdev, u8 *phy_status, > pkt_stat->signal_power = max3(pkt_stat->rx_power[RF_PATH_A], > pkt_stat->rx_power[RF_PATH_B], > min_rx_power); > + > + dm_info->curr_rx_rate = pkt_stat->rate; > + > + pkt_stat->rx_evm[RF_PATH_A] = GET_PHY_STAT_P1_RXEVM_A(phy_status); > + pkt_stat->rx_evm[RF_PATH_B] = GET_PHY_STAT_P1_RXEVM_B(phy_status); > + > + pkt_stat->rx_snr[RF_PATH_A] = GET_PHY_STAT_P1_RXSNR_A(phy_status); > + pkt_stat->rx_snr[RF_PATH_B] = GET_PHY_STAT_P1_RXSNR_B(phy_status); > + > + pkt_stat->cfo_tail[RF_PATH_A] = GET_PHY_STAT_P1_CFO_TAIL_A(phy_status); > + pkt_stat->cfo_tail[RF_PATH_B] = GET_PHY_STAT_P1_CFO_TAIL_B(phy_status); > + > + for (path = 0; path <= rtwdev->hal.rf_path_num; path++) { > + rssi = rtw_phy_rf_power_2_rssi(&pkt_stat->rx_power[path], 1); > + dm_info->rssi[path] = rssi; > + dm_info->rx_snr[path] = pkt_stat->rx_snr[path] >> 1; > + dm_info->cfo_tail[path] = (pkt_stat->cfo_tail[path] * 5) >> 1; > + > + rx_evm = pkt_stat->rx_evm[path]; > + > + if (rx_evm < 0) { > + evm_dbm = ((u8)-rx_evm >> 1); > + > + if (evm_dbm == 64) Does the 64 means the S8_MAX >> 1 or something else? Can you give a more straightforward expression for EVM boundary check? Same for the following rtw8822c.c > + evm_dbm = 0; > + } > + dm_info->rx_evm_dbm[path] = evm_dbm; > + } > } > > -- > 2.17.1 >