Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
nu11secur1ty
GitHub Repository: nu11secur1ty/Kali-Linux
Path: blob/master/ALFA-W1F1/RTL8814AU/hal/rtl8814a/rtl8814a_rxdesc.c
1307 views
1
/******************************************************************************
2
*
3
* Copyright(c) 2007 - 2017 Realtek Corporation.
4
*
5
* This program is free software; you can redistribute it and/or modify it
6
* under the terms of version 2 of the GNU General Public License as
7
* published by the Free Software Foundation.
8
*
9
* This program is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12
* more details.
13
*
14
*****************************************************************************/
15
#define _RTL8814A_RXDESC_C_
16
17
/* #include <drv_types.h> */
18
#include <rtl8814a_hal.h>
19
20
void rtl8814_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc)
21
{
22
struct rx_pkt_attrib *pattrib = &precvframe->u.hdr.attrib;
23
24
_rtw_memset(pattrib, 0, sizeof(struct rx_pkt_attrib));
25
pattrib->bw = CHANNEL_WIDTH_MAX;
26
27
/* Offset 0 */
28
pattrib->pkt_len = (u16)GET_RX_STATUS_DESC_PKT_LEN_8814A(pdesc);/* (le32_to_cpu(pdesc->rxdw0)&0x00003fff) */
29
pattrib->crc_err = (u8)GET_RX_STATUS_DESC_CRC32_8814A(pdesc);/* ((le32_to_cpu(pdesc->rxdw0) >> 14) & 0x1); */
30
pattrib->icv_err = (u8)GET_RX_STATUS_DESC_ICV_8814A(pdesc);/* ((le32_to_cpu(pdesc->rxdw0) >> 15) & 0x1); */
31
pattrib->drvinfo_sz = (u8)GET_RX_STATUS_DESC_DRVINFO_SIZE_8814A(pdesc) * 8;/* ((le32_to_cpu(pdesc->rxdw0) >> 16) & 0xf) * 8; */ /* uint 2^3 = 8 bytes */
32
pattrib->encrypt = (u8)GET_RX_STATUS_DESC_SECURITY_8814A(pdesc);/* ((le32_to_cpu(pdesc->rxdw0) >> 20) & 0x7); */
33
pattrib->qos = (u8)GET_RX_STATUS_DESC_QOS_8814A(pdesc);/* (( le32_to_cpu( pdesc->rxdw0 ) >> 23) & 0x1); */ /* Qos data, wireless lan header length is 26 */
34
pattrib->shift_sz = (u8)GET_RX_STATUS_DESC_SHIFT_8814A(pdesc);/* ((le32_to_cpu(pdesc->rxdw0) >> 24) & 0x3); */
35
pattrib->physt = (u8)GET_RX_STATUS_DESC_PHY_STATUS_8814A(pdesc);/* ((le32_to_cpu(pdesc->rxdw0) >> 26) & 0x1); */
36
pattrib->bdecrypted = !GET_RX_STATUS_DESC_SWDEC_8814A(pdesc);/* (le32_to_cpu(pdesc->rxdw0) & BIT(27))? 0:1; */
37
38
/* Offset 4 */
39
pattrib->priority = (u8)GET_RX_STATUS_DESC_TID_8814A(pdesc);/* ((le32_to_cpu(pdesc->rxdw1) >> 8) & 0xf); */
40
pattrib->mdata = (u8)GET_RX_STATUS_DESC_MORE_DATA_8814A(pdesc);/* ((le32_to_cpu(pdesc->rxdw1) >> 26) & 0x1); */
41
pattrib->mfrag = (u8)GET_RX_STATUS_DESC_MORE_FRAG_8814A(pdesc);/* ((le32_to_cpu(pdesc->rxdw1) >> 27) & 0x1); */ /* more fragment bit */
42
43
/* Offset 8 */
44
pattrib->seq_num = (u16)GET_RX_STATUS_DESC_SEQ_8814A(pdesc);/* (le32_to_cpu(pdesc->rxdw2) & 0x00000fff); */
45
pattrib->frag_num = (u8)GET_RX_STATUS_DESC_FRAG_8814A(pdesc);/* ((le32_to_cpu(pdesc->rxdw2) >> 12) & 0xf); */ /* fragmentation number */
46
47
48
if (GET_RX_STATUS_DESC_RPT_SEL_8814A(pdesc))
49
pattrib->pkt_rpt_type = C2H_PACKET;
50
else
51
52
pattrib->pkt_rpt_type = NORMAL_RX;
53
54
/* Offset 12 */
55
pattrib->data_rate = (u8)GET_RX_STATUS_DESC_RX_RATE_8814A(pdesc); /* ((le32_to_cpu(pdesc->rxdw3))&0x7f); */
56
57
/* Offset 16 */
58
/* Offset 20 */
59
60
}
61
62