From 14109ecfdbb4e02b2cb60cc045b17cdd108fee92 Mon Sep 17 00:00:00 2001 From: cail Date: Sat, 24 Mar 2018 15:40:05 -0700 Subject: [PATCH 1/3] 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) From bf5593ab0cf3b85147b55ce9a3cddf0076380d1e Mon Sep 17 00:00:00 2001 From: cail Date: Sun, 25 Mar 2018 09:20:31 -0700 Subject: [PATCH 2/3] Fix power savings breaking monitor mode --- core/rtw_pwrctrl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/rtw_pwrctrl.c b/core/rtw_pwrctrl.c index d8b45f4..0a596db 100644 --- a/core/rtw_pwrctrl.c +++ b/core/rtw_pwrctrl.c @@ -219,6 +219,7 @@ bool rtw_pwr_unassociated_idle(_adapter *adapter) || check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS) || check_fwstate(pmlmepriv, WIFI_AP_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE) + || check_fwstate(pmlmepriv, WIFI_MONITOR_STATE) #if defined(CONFIG_P2P) && defined(CONFIG_IOCTL_CFG80211) || pcfg80211_wdinfo->is_ro_ch #elif defined(CONFIG_P2P) @@ -618,6 +619,7 @@ u8 PS_RDY_CHECK(_adapter *padapter) || check_fwstate(pmlmepriv, WIFI_UNDER_LINKING | WIFI_UNDER_WPS) || check_fwstate(pmlmepriv, WIFI_AP_STATE) || check_fwstate(pmlmepriv, WIFI_ADHOC_MASTER_STATE | WIFI_ADHOC_STATE) + || check_fwstate(pmlmepriv, WIFI_MONITOR_STATE) #if defined(CONFIG_P2P) && defined(CONFIG_IOCTL_CFG80211) || pcfg80211_wdinfo->is_ro_ch #endif From b6c6c05f4ac3b6db41909367519f9420b0a74973 Mon Sep 17 00:00:00 2001 From: kimocoder Date: Tue, 27 Mar 2018 15:02:10 +0200 Subject: [PATCH 3/3] Removed pre-configured SeqNum via RadioTap --- core/rtw_xmit.c | 14 +++++++------- hal/rtl8812a/usb/rtl8812au_xmit.c | 2 +- hal/rtl8814a/usb/rtl8814au_xmit.c | 5 +---- include/rtw_xmit.h | 2 +- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/core/rtw_xmit.c b/core/rtw_xmit.c index 0c6368d..c1019bb 100644 --- a/core/rtw_xmit.c +++ b/core/rtw_xmit.c @@ -3875,7 +3875,7 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev) u32 len = skb->len; u8 category, action; int type = -1; - + //RTW_INFO(FUNC_NDEV_FMT"\n", FUNC_NDEV_ARG(ndev)); if (skb) @@ -3923,17 +3923,17 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev) fixed_rate = 0; fixed_rate += MGN_MCS0; } - if ((mcs_have & 4) && + if ((mcs_have & 4) && (iterator.this_arg[1] & 4)) sgi = 1; - if ((mcs_have & 1) && + if ((mcs_have & 1) && (iterator.this_arg[1] & 1)) bwidth = 1; - if ((mcs_have & 0x10) && + if ((mcs_have & 0x10) && (iterator.this_arg[1] & 0x10)) ldpc = 1; if ((mcs_have & 0x20)) - stbc = (iterator.this_arg[1] >> 5) & 3; + stbc = (iterator.this_arg[1] >> 5) & 3; } break; @@ -3995,9 +3995,9 @@ s32 rtw_monitor_xmit_entry(struct sk_buff *skb, struct net_device *ndev) pattrib->ldpc = ldpc; pattrib->stbc = stbc; pattrib->retry_ctrl = (txflags & 0x08)?_FALSE:_TRUE; - pattrib->sw_seq = (txflags & 0x10)?_TRUE:_FALSE; + // pattrib->sw_seq = (txflags & 0x10)?_TRUE:_FALSE; // Adds support for pre-configured SeqNum via RadioTap + - pwlanhdr = (struct rtw_ieee80211_hdr *)pframe; pmlmeext->mgnt_seq = GetSequence(pwlanhdr); diff --git a/hal/rtl8812a/usb/rtl8812au_xmit.c b/hal/rtl8812a/usb/rtl8812au_xmit.c index 68ee167..bc5f941 100644 --- a/hal/rtl8812a/usb/rtl8812au_xmit.c +++ b/hal/rtl8812a/usb/rtl8812au_xmit.c @@ -112,7 +112,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz , u8 ba /* offset 12 */ - if (!pattrib->qos_en && pattrib->sw_seq == _FALSE) { + if (!pattrib->qos_en) { SET_TX_DESC_HWSEQ_EN_8812(ptxdesc, 1); /* Hw set sequence number */ } else SET_TX_DESC_SEQ_8812(ptxdesc, pattrib->seqnum); diff --git a/hal/rtl8814a/usb/rtl8814au_xmit.c b/hal/rtl8814a/usb/rtl8814au_xmit.c index ac60014..0f4d3e1 100644 --- a/hal/rtl8814a/usb/rtl8814au_xmit.c +++ b/hal/rtl8814a/usb/rtl8814au_xmit.c @@ -118,10 +118,7 @@ static s32 update_txdesc(struct xmit_frame *pxmitframe, u8 *pmem, s32 sz ,u8 bag if (!pattrib->qos_en) { /* HW sequence, to fix to use 0 queue. todo: 4AC packets to use auto queue select */ - if (pattrib->sw_seq == _FALSE) - SET_TX_DESC_HWSEQ_EN_8814A(ptxdesc, 1); // Hw set sequence number - else - SET_TX_DESC_SEQ_8814A(ptxdesc, pattrib->seqnum); + SET_TX_DESC_HWSEQ_EN_8814A(ptxdesc, 1); // Hw set sequence number SET_TX_DESC_EN_HWEXSEQ_8814A(ptxdesc, 0); SET_TX_DESC_DISQSELSEQ_8814A(ptxdesc, 1); SET_TX_DESC_HW_SSN_SEL_8814A(ptxdesc, 0); diff --git a/include/rtw_xmit.h b/include/rtw_xmit.h index d372338..6b5ea43 100644 --- a/include/rtw_xmit.h +++ b/include/rtw_xmit.h @@ -421,7 +421,7 @@ struct pkt_attrib { u8 rate; u8 intel_proxim; u8 retry_ctrl; - u8 sw_seq; + //u8 sw_seq; // Add support for pre-configured SeqNum via RadioTap u8 mbssid; u8 ldpc; u8 stbc;