From 14109ecfdbb4e02b2cb60cc045b17cdd108fee92 Mon Sep 17 00:00:00 2001 From: cail Date: Sat, 24 Mar 2018 15:40:05 -0700 Subject: [PATCH] Fix FCS on 8812 and 8814 --- core/rtw_recv.c | 11 +++++++++-- hal/rtl8814a/usb/usb_ops_linux.c | 5 +++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/core/rtw_recv.c b/core/rtw_recv.c index 91bb6fb..8bb59ee 100644 --- a/core/rtw_recv.c +++ b/core/rtw_recv.c @@ -3608,8 +3608,15 @@ static sint fill_radiotap_hdr(_adapter *padapter, union recv_frame *precvframe) if (pattrib->mfrag) hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_FRAG; - /* always append FCS */ - /* hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_FCS; */ +#ifdef CONFIG_RX_PACKET_APPEND_FCS + // Start by always indicating FCS is there: + hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_FCS; + + // Next, test for prior conditions that will remove FCS, and update flag accordingly: + if(check_fwstate(&padapter->mlmepriv,WIFI_MONITOR_STATE) == _FALSE) + if((pattrib->pkt_rpt_type == NORMAL_RX) && (pHalData->ReceiveConfig & RCR_APPFCS)) + hdr_buf[rt_len] &= ~IEEE80211_RADIOTAP_F_FCS; +#endif if (0) hdr_buf[rt_len] |= IEEE80211_RADIOTAP_F_DATAPAD; diff --git a/hal/rtl8814a/usb/usb_ops_linux.c b/hal/rtl8814a/usb/usb_ops_linux.c index f10cd09..d2fea87 100644 --- a/hal/rtl8814a/usb/usb_ops_linux.c +++ b/hal/rtl8814a/usb/usb_ops_linux.c @@ -357,8 +357,9 @@ int recvbuf2recvframe(PADAPTER padapter, void *ptr) } #ifdef CONFIG_RX_PACKET_APPEND_FCS - if(pattrib->pkt_rpt_type == NORMAL_RX) - pattrib->pkt_len -= IEEE80211_FCS_LEN; + if (check_fwstate(&padapter->mlmepriv, WIFI_MONITOR_STATE) == _FALSE) + if ((pattrib->pkt_rpt_type == NORMAL_RX) && (pHalData->ReceiveConfig & RCR_APPFCS)) + pattrib->pkt_len -= IEEE80211_FCS_LEN; #endif if(rtw_os_alloc_recvframe(padapter, precvframe, (pbuf + pattrib->shift_sz + pattrib->drvinfo_sz + RXDESC_SIZE), pskb) == _FAIL)