From 1da67a59f84a552786d16725b59fe8551bd95900 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Thu, 14 Nov 2019 01:58:06 +0100 Subject: [PATCH] Place signal quality and per antenna rssi into radiotap header --- core/rtw_recv.c | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 5082fa1..38ee29e 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -4006,11 +4006,34 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, u8 hdr_buf[64] = {0}; u16 rt_len = 8; + u32 tmp_32bit; + int i; /* create header */ rtap_hdr = (struct ieee80211_radiotap_header *)&hdr_buf[0]; rtap_hdr->it_version = PKTHDR_RADIOTAP_VERSION; + if(pHalData->NumTotalRFPath>0) { + rtap_hdr->it_present |= (1<NumTotalRFPath>1) { + tmp_32bit = (1<NumTotalRFPath-1; i++) { + memcpy(&hdr_buf[rt_len], &tmp_32bit, 4); + rt_len += 4; + } + } + tmp_32bit = (1<it_present |= (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE); hdr_buf[rt_len] = 0; rt_len += 1; +#endif + rt_len++; // alignment /* Signal Quality */ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_LOCK_QUALITY); - hdr_buf[rt_len] = pattrib->phy_info.signal_quality; - rt_len += 1; -#endif + tmp_16bit = cpu_to_le16(pattrib->phy_info.signal_quality); + memcpy(&hdr_buf[rt_len], &tmp_16bit, 2); + rt_len += 2; +#if 0 /* Antenna */ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_ANTENNA); - hdr_buf[rt_len] = 0; /* pHalData->rf_type; */ + hdr_buf[rt_len] = pHalData->rf_type; rt_len += 1; + rt_len++; // alignment +#endif + /* RX flags */ rtap_hdr->it_present |= (1 << IEEE80211_RADIOTAP_RX_FLAGS); #if 0 @@ -4235,6 +4264,13 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe, rt_len += 2; } + for(i=0; iNumTotalRFPath; i++) { + hdr_buf[rt_len] = pattrib->phy_info.rx_pwr[i]; + rt_len ++; + hdr_buf[rt_len] = i; + rt_len ++; + } + /* push to skb */ pskb = (_pkt *)buf; if (skb_headroom(pskb) < rt_len) {