8723BU: Update 8723BU wifi driver to version v4.3.16_14189.20150519_BTCOEX2015119...
[firefly-linux-kernel-4.4.55.git] / drivers / net / wireless / rockchip_wlan / rtl8723bu / hal / rtl8723b / rtl8723b_rxdesc.c
1 /******************************************************************************
2  *
3  * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
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  * You should have received a copy of the GNU General Public License along with
15  * this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
17  *
18  *
19  ******************************************************************************/
20 #define _RTL8723B_REDESC_C_
21
22 #include <rtl8723b_hal.h>
23
24 void rtl8723b_query_rx_desc_status(union recv_frame *precvframe, u8 *pdesc)
25 {
26         struct rx_pkt_attrib *pattrib;
27
28
29         pattrib = &precvframe->u.hdr.attrib;
30         _rtw_memset(pattrib, 0, sizeof(struct rx_pkt_attrib));
31
32         pattrib->pkt_len = (u16)GET_RX_STATUS_DESC_PKT_LEN_8723B(pdesc);
33         pattrib->pkt_rpt_type = GET_RX_STATUS_DESC_RPT_SEL_8723B(pdesc) ? C2H_PACKET : NORMAL_RX;
34
35         if (pattrib->pkt_rpt_type == NORMAL_RX) {
36                 // Offset 0
37                 pattrib->crc_err = (u8)GET_RX_STATUS_DESC_CRC32_8723B(pdesc);
38                 pattrib->icv_err = (u8)GET_RX_STATUS_DESC_ICV_8723B(pdesc);
39                 pattrib->drvinfo_sz = (u8)GET_RX_STATUS_DESC_DRVINFO_SIZE_8723B(pdesc) << 3;
40                 pattrib->encrypt = (u8)GET_RX_STATUS_DESC_SECURITY_8723B(pdesc);
41                 pattrib->qos = (u8)GET_RX_STATUS_DESC_QOS_8723B(pdesc);
42                 pattrib->shift_sz = (u8)GET_RX_STATUS_DESC_SHIFT_8723B(pdesc);
43                 pattrib->physt = (u8)GET_RX_STATUS_DESC_PHY_STATUS_8723B(pdesc);
44                 pattrib->bdecrypted = (u8)GET_RX_STATUS_DESC_SWDEC_8723B(pdesc) ? 0 : 1;
45
46                 // Offset 4
47                 pattrib->priority = (u8)GET_RX_STATUS_DESC_TID_8723B(pdesc);
48                 pattrib->amsdu = (u8)GET_RX_STATUS_DESC_AMSDU_8723B(pdesc);
49                 pattrib->mdata = (u8)GET_RX_STATUS_DESC_MORE_DATA_8723B(pdesc);
50                 pattrib->mfrag = (u8)GET_RX_STATUS_DESC_MORE_FRAG_8723B(pdesc);
51
52                 // Offset 8
53                 pattrib->seq_num = (u16)GET_RX_STATUS_DESC_SEQ_8723B(pdesc);
54                 pattrib->frag_num = (u8)GET_RX_STATUS_DESC_FRAG_8723B(pdesc);
55
56                 // Offset 12
57                 pattrib->data_rate = (u8)GET_RX_STATUS_DESC_RX_RATE_8723B(pdesc);
58
59                 /* Offset 16 */
60                 pattrib->sgi = (u8)GET_RX_STATUS_DESC_SPLCP_8723B(pdesc);
61                 pattrib->ldpc = (u8)GET_RX_STATUS_DESC_LDPC_8723B(pdesc);
62                 pattrib->stbc = (u8)GET_RX_STATUS_DESC_STBC_8723B(pdesc);
63                 pattrib->bw = (u8)GET_RX_STATUS_DESC_BW_8723B(pdesc);
64
65                 /* Offset 20 */
66                 /* pattrib->tsfl=(u8)GET_RX_STATUS_DESC_TSFL_8723B(pdesc); */
67         }
68 }
69