1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright(c) 2018-2019  Realtek Corporation
3  */
4 
5 #ifndef __RTW_RX_H_
6 #define __RTW_RX_H_
7 
8 #define GET_RX_DESC_PHYST(rxdesc)                                              \
9 	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(26))
10 #define GET_RX_DESC_ICV_ERR(rxdesc)                                            \
11 	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(15))
12 #define GET_RX_DESC_CRC32(rxdesc)                                              \
13 	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(14))
14 #define GET_RX_DESC_SWDEC(rxdesc)                                              \
15 	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(27))
16 #define GET_RX_DESC_C2H(rxdesc)                                                \
17 	le32_get_bits(*((__le32 *)(rxdesc) + 0x02), BIT(28))
18 #define GET_RX_DESC_PKT_LEN(rxdesc)                                            \
19 	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(13, 0))
20 #define GET_RX_DESC_DRV_INFO_SIZE(rxdesc)                                      \
21 	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(19, 16))
22 #define GET_RX_DESC_SHIFT(rxdesc)                                              \
23 	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(25, 24))
24 #define GET_RX_DESC_RX_RATE(rxdesc)                                            \
25 	le32_get_bits(*((__le32 *)(rxdesc) + 0x03), GENMASK(6, 0))
26 #define GET_RX_DESC_MACID(rxdesc)                                              \
27 	le32_get_bits(*((__le32 *)(rxdesc) + 0x01), GENMASK(6, 0))
28 #define GET_RX_DESC_PPDU_CNT(rxdesc)                                           \
29 	le32_get_bits(*((__le32 *)(rxdesc) + 0x02), GENMASK(30, 29))
30 #define GET_RX_DESC_TSFL(rxdesc)                                               \
31 	le32_get_bits(*((__le32 *)(rxdesc) + 0x05), GENMASK(31, 0))
32 
33 void rtw_rx_stats(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
34 		  struct sk_buff *skb);
35 void rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
36 			   struct rtw_rx_pkt_stat *pkt_stat,
37 			   struct ieee80211_hdr *hdr,
38 			   struct ieee80211_rx_status *rx_status,
39 			   u8 *phy_status);
40 
41 #endif
42