From d8c9aacd1b3f43331c896090aeab6361d6de6bd2 Mon Sep 17 00:00:00 2001 From: Romary Sonrier Date: Thu, 28 Sep 2023 08:22:35 +0200 Subject: [PATCH] Begin of backporting rfmetrics patches from older v5.6.4.2 WORK IN PROGRESS - adding debug printk in phydm_phystatus.c - updating radio tap headers to add more metrics for each RF path --- core/rtw_recv.c | 56 ++++++++++++++++++++++++++++--------- hal/phydm/phydm_phystatus.c | 46 ++++++++++++++---------------- 2 files changed, 64 insertions(+), 38 deletions(-) diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 3999948f..0c9d92c4 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -17,6 +17,8 @@ #include #include +#define RFMETRICS 1 + #if defined(PLATFORM_LINUX) && defined (PLATFORM_WINDOWS) #error "Shall be Linux or Windows, but not both!\n" @@ -3684,6 +3686,10 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe) if(pHalData->NumTotalRFPath>1) { tmp_32bit = (1<NumTotalRFPath-1; i++) { @@ -3692,7 +3698,13 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe) } } tmp_32bit = (1<phy_info.recv_signal_power; rt_len += 1; -#if 0 - /* dBm Antenna Noise */ - rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE); - hdr_buf[rt_len] = 0; - rt_len += 1; +#if RFMETRICS + /* dBm Antenna Noise */ + rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE); + hdr_buf[rt_len] = pattrib->phy_info.recv_signal_power - pattrib->phy_info.rx_snr[0]; //UGLY : TDB AVG/MAX of SNR + rt_len += 1; +#else + rt_len++; // alignment #endif - rt_len++; // alignment + } /* Signal Quality */ @@ -3806,21 +3820,23 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe) tmp_16bit = cpu_to_le16(pattrib->phy_info.signal_quality); memcpy(&hdr_buf[rt_len], &tmp_16bit, 2); rt_len += 2; -#if 0 +#if RFMETRICS + /* Antenna */ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_ANTENNA); - hdr_buf[rt_len] = pHalData->rf_type; + hdr_buf[rt_len] = pattrib->phy_info.rx_count; rt_len += 1; rt_len++; // alignment #endif /* RX flags */ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_RX_FLAGS); -#if 0 - tmp_16bit = cpu_to_le16(0); - memcpy(ptr, &tmp_16bit, 1); -#endif +#if RFMETRICS + tmp_16bit = pHalData->NumTotalRFPath; + memcpy(&hdr_buf[rt_len], &tmp_16bit, 2); rt_len += 2; + //printk(KERN_ERR "NumTotalRFPath: %d\n", pHalData->NumTotalRFPath); +#endif /* MCS information */ if (pattrib->data_rate >= 12 && pattrib->data_rate < 44) { @@ -3921,8 +3937,22 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe) if (pattrib->physt) { for(i=0; iNumTotalRFPath; i++) { + // IEEE80211_RADIOTAP_DBM_ANTSIGNAL hdr_buf[rt_len] = pattrib->phy_info.rx_pwr[i]; rt_len ++; +#if RFMETRICS + // IEEE80211_RADIOTAP_DBM_ANTNOISE + hdr_buf[rt_len] = pattrib->phy_info.rx_pwr[i] - pattrib->phy_info.rx_snr[i]; + rt_len ++; + // alignment for the following u16 short + rt_len ++; // alignment + // IEEE80211_RADIOTAP_LOCK_QUALITY + tmp_16bit = cpu_to_le16(pattrib->phy_info.rx_mimo_signal_quality[i]); + memcpy(&hdr_buf[rt_len], &tmp_16bit, 2); + rt_len += 2; + // IEEE80211_RADIOTAP_ANTENNA + // hdr_buf[rt_len] = pattrib->phy_info.ant_idx[i]; +#endif hdr_buf[rt_len] = i; rt_len ++; } diff --git a/hal/phydm/phydm_phystatus.c b/hal/phydm/phydm_phystatus.c index b3b66451..8dbd78c9 100644 --- a/hal/phydm/phydm_phystatus.c +++ b/hal/phydm/phydm_phystatus.c @@ -20,6 +20,8 @@ #include "mp_precomp.h" #include "phydm_precomp.h" +#define RFMETRICS_DBG 0 + void phydm_rx_statistic_cal( struct PHY_DM_STRUCT *p_phydm, @@ -1544,31 +1546,25 @@ phydm_rx_phy_status_jaguar_series_parsing( phydm_avg_phystatus_index(p_dm, p_phy_info, p_pktinfo); phydm_rx_statistic_cal(p_dm, p_phy_status, p_pktinfo); } - /*PHYDM_DBG(p_dm, DBG_ANT_DIV, ("StaID[%d]: antidx_anta = ((%d)), MatchBSSID = ((%d))\n", p_pktinfo->station_id, p_phy_sta_rpt->antidx_anta, p_pktinfo->is_packet_match_bssid));*/ - - - /* dbg_print("p_phy_sta_rpt->antidx_anta = %d, p_phy_sta_rpt->antidx_antb = %d\n",*/ - /* p_phy_sta_rpt->antidx_anta, p_phy_sta_rpt->antidx_antb);*/ - /* dbg_print("----------------------------\n");*/ - /* dbg_print("p_pktinfo->station_id=%d, p_pktinfo->data_rate=0x%x\n",p_pktinfo->station_id, p_pktinfo->data_rate);*/ - /* dbg_print("p_phy_sta_rpt->r_RFMOD = %d\n", p_phy_sta_rpt->r_RFMOD);*/ - /* dbg_print("p_phy_sta_rpt->gain_trsw[0]=0x%x, p_phy_sta_rpt->gain_trsw[1]=0x%x\n",*/ - /* p_phy_sta_rpt->gain_trsw[0],p_phy_sta_rpt->gain_trsw[1]);*/ - /* dbg_print("p_phy_sta_rpt->gain_trsw[2]=0x%x, p_phy_sta_rpt->gain_trsw[3]=0x%x\n",*/ - /* p_phy_sta_rpt->gain_trsw_cd[0],p_phy_sta_rpt->gain_trsw_cd[1]);*/ - /* dbg_print("p_phy_sta_rpt->pwdb_all = 0x%x, p_phy_info->rx_pwdb_all = %d\n", p_phy_sta_rpt->pwdb_all, p_phy_info->rx_pwdb_all);*/ - /* dbg_print("p_phy_sta_rpt->cfotail[i] = 0x%x, p_phy_sta_rpt->CFO_tail[i] = 0x%x\n", p_phy_sta_rpt->cfotail[0], p_phy_sta_rpt->cfotail[1]);*/ - /* dbg_print("p_phy_sta_rpt->rxevm[0] = %d, p_phy_sta_rpt->rxevm[1] = %d\n", p_phy_sta_rpt->rxevm[0], p_phy_sta_rpt->rxevm[1]);*/ - /* dbg_print("p_phy_sta_rpt->rxevm[2] = %d, p_phy_sta_rpt->rxevm[3] = %d\n", p_phy_sta_rpt->rxevm_cd[0], p_phy_sta_rpt->rxevm_cd[1]);*/ - /* dbg_print("p_phy_info->rx_mimo_signal_strength[0]=%d, p_phy_info->rx_mimo_signal_strength[1]=%d, rx_pwdb_all=%d\n",*/ - /* p_phy_info->rx_mimo_signal_strength[0], p_phy_info->rx_mimo_signal_strength[1], p_phy_info->rx_pwdb_all);*/ - /* dbg_print("p_phy_info->rx_mimo_signal_strength[2]=%d, p_phy_info->rx_mimo_signal_strength[3]=%d\n",*/ - /* p_phy_info->rx_mimo_signal_strength[2], p_phy_info->rx_mimo_signal_strength[3]);*/ - /* dbg_print("ppPhyInfo->rx_mimo_signal_quality[0]=%d, p_phy_info->rx_mimo_signal_quality[1]=%d\n",*/ - /* p_phy_info->rx_mimo_signal_quality[0], p_phy_info->rx_mimo_signal_quality[1]);*/ - /* dbg_print("ppPhyInfo->rx_mimo_signal_quality[2]=%d, p_phy_info->rx_mimo_signal_quality[3]=%d\n",*/ - /* p_phy_info->rx_mimo_signal_quality[2], p_phy_info->rx_mimo_signal_quality[3]);*/ - +#if RFMETRICS_DBG + PHYDM_DBG(p_dm, DBG_ANT_DIV, ("StaID[%d]: antidx_anta = ((%d)), MatchBSSID = ((%d))\n", p_pktinfo->station_id, p_phy_sta_rpt->antidx_anta, p_pktinfo->is_packet_match_bssid)); + + + dbg_print("p_phy_sta_rpt->antidx_anta = %d, p_phy_sta_rpt->antidx_antb = %d\n", p_phy_sta_rpt->antidx_anta, p_phy_sta_rpt->antidx_antb); + dbg_print("----------------------------\n"); + dbg_print("p_pktinfo->station_id=%d, p_pktinfo->data_rate=0x%x\n",p_pktinfo->station_id, p_pktinfo->data_rate); + dbg_print("p_phy_sta_rpt->r_RFMOD = %d\n", p_phy_sta_rpt->r_RFMOD); + dbg_print("p_phy_sta_rpt->gain_trsw[0]=0x%x, p_phy_sta_rpt->gain_trsw[1]=0x%x\n", p_phy_sta_rpt->gain_trsw[0],p_phy_sta_rpt->gain_trsw[1]); + dbg_print("p_phy_sta_rpt->gain_trsw[2]=0x%x, p_phy_sta_rpt->gain_trsw[3]=0x%x\n", p_phy_sta_rpt->gain_trsw_cd[0],p_phy_sta_rpt->gain_trsw_cd[1]); + dbg_print("p_phy_sta_rpt->pwdb_all = 0x%x, p_phy_info->rx_pwdb_all = %d\n", p_phy_sta_rpt->pwdb_all, p_phy_info->rx_pwdb_all); + dbg_print("p_phy_sta_rpt->cfotail[i] = 0x%x, p_phy_sta_rpt->CFO_tail[i] = 0x%x\n", p_phy_sta_rpt->cfotail[0], p_phy_sta_rpt->cfotail[1]); + dbg_print("p_phy_sta_rpt->rxevm[0] = %d, p_phy_sta_rpt->rxevm[1] = %d\n", p_phy_sta_rpt->rxevm[0], p_phy_sta_rpt->rxevm[1]); + dbg_print("p_phy_sta_rpt->rxevm[2] = %d, p_phy_sta_rpt->rxevm[3] = %d\n", p_phy_sta_rpt->rxevm_cd[0], p_phy_sta_rpt->rxevm_cd[1]); + dbg_print("p_phy_info->rx_mimo_signal_strength[0]=%d, p_phy_info->rx_mimo_signal_strength[1]=%d, rx_pwdb_all=%d\n", p_phy_info->rx_mimo_signal_strength[0], p_phy_info->rx_mimo_signal_strength[1], p_phy_info->rx_pwdb_all); + dbg_print("p_phy_info->rx_mimo_signal_strength[2]=%d, p_phy_info->rx_mimo_signal_strength[3]=%d\n", p_phy_info->rx_mimo_signal_strength[2], p_phy_info->rx_mimo_signal_strength[3]); + dbg_print("ppPhyInfo->rx_mimo_signal_quality[0]=%d, p_phy_info->rx_mimo_signal_quality[1]=%d\n", p_phy_info->rx_mimo_signal_quality[0], p_phy_info->rx_mimo_signal_quality[1]); + dbg_print("ppPhyInfo->rx_mimo_signal_quality[2]=%d, p_phy_info->rx_mimo_signal_quality[3]=%d\n", p_phy_info->rx_mimo_signal_quality[2], p_phy_info->rx_mimo_signal_quality[3]); +#endif } #endif