162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
262306a36Sopenharmony_ci/* Copyright(c) 2018-2019  Realtek Corporation
362306a36Sopenharmony_ci */
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#ifndef __RTW_RX_H_
662306a36Sopenharmony_ci#define __RTW_RX_H_
762306a36Sopenharmony_ci
862306a36Sopenharmony_cienum rtw_rx_desc_enc {
962306a36Sopenharmony_ci	RX_DESC_ENC_NONE	= 0,
1062306a36Sopenharmony_ci	RX_DESC_ENC_WEP40	= 1,
1162306a36Sopenharmony_ci	RX_DESC_ENC_TKIP_WO_MIC	= 2,
1262306a36Sopenharmony_ci	RX_DESC_ENC_TKIP_MIC	= 3,
1362306a36Sopenharmony_ci	RX_DESC_ENC_AES		= 4,
1462306a36Sopenharmony_ci	RX_DESC_ENC_WEP104	= 5,
1562306a36Sopenharmony_ci};
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#define GET_RX_DESC_PHYST(rxdesc)                                              \
1862306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(26))
1962306a36Sopenharmony_ci#define GET_RX_DESC_ICV_ERR(rxdesc)                                            \
2062306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(15))
2162306a36Sopenharmony_ci#define GET_RX_DESC_CRC32(rxdesc)                                              \
2262306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(14))
2362306a36Sopenharmony_ci#define GET_RX_DESC_SWDEC(rxdesc)                                              \
2462306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), BIT(27))
2562306a36Sopenharmony_ci#define GET_RX_DESC_C2H(rxdesc)                                                \
2662306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x02), BIT(28))
2762306a36Sopenharmony_ci#define GET_RX_DESC_PKT_LEN(rxdesc)                                            \
2862306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(13, 0))
2962306a36Sopenharmony_ci#define GET_RX_DESC_DRV_INFO_SIZE(rxdesc)                                      \
3062306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(19, 16))
3162306a36Sopenharmony_ci#define GET_RX_DESC_SHIFT(rxdesc)                                              \
3262306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(25, 24))
3362306a36Sopenharmony_ci#define GET_RX_DESC_ENC_TYPE(rxdesc)                                           \
3462306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x00), GENMASK(22, 20))
3562306a36Sopenharmony_ci#define GET_RX_DESC_RX_RATE(rxdesc)                                            \
3662306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x03), GENMASK(6, 0))
3762306a36Sopenharmony_ci#define GET_RX_DESC_MACID(rxdesc)                                              \
3862306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x01), GENMASK(6, 0))
3962306a36Sopenharmony_ci#define GET_RX_DESC_PPDU_CNT(rxdesc)                                           \
4062306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x02), GENMASK(30, 29))
4162306a36Sopenharmony_ci#define GET_RX_DESC_TSFL(rxdesc)                                               \
4262306a36Sopenharmony_ci	le32_get_bits(*((__le32 *)(rxdesc) + 0x05), GENMASK(31, 0))
4362306a36Sopenharmony_ci
4462306a36Sopenharmony_civoid rtw_rx_stats(struct rtw_dev *rtwdev, struct ieee80211_vif *vif,
4562306a36Sopenharmony_ci		  struct sk_buff *skb);
4662306a36Sopenharmony_civoid rtw_rx_fill_rx_status(struct rtw_dev *rtwdev,
4762306a36Sopenharmony_ci			   struct rtw_rx_pkt_stat *pkt_stat,
4862306a36Sopenharmony_ci			   struct ieee80211_hdr *hdr,
4962306a36Sopenharmony_ci			   struct ieee80211_rx_status *rx_status,
5062306a36Sopenharmony_ci			   u8 *phy_status);
5162306a36Sopenharmony_ci
5262306a36Sopenharmony_ci#endif
53