1 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
2 /* Copyright (c) 2011 Realtek Semiconductor Corp. */
6 /* Module Name: RateAdaptive.h
7 * Abstract: Prototype of RA and related data structure.
10 #include <linux/bitfield.h>
12 /* Rate adaptive define */
16 #define TX_RPT2_ITEM_SIZE 8
18 /* TX report 2 format in Rx desc */
19 #define GET_TX_RPT2_DESC_PKT_LEN_88E(__rxstatusdesc) \
20 le32_get_bits(*(__le32 *)__rxstatusdesc, GENMASK(8, 0))
21 #define GET_TX_RPT2_DESC_MACID_VALID_1_88E(__rxstatusdesc) \
22 le32_to_cpu((*(__le32 *)(__rxstatusdesc + 16))
23 #define GET_TX_RPT2_DESC_MACID_VALID_2_88E(__rxstatusdesc) \
24 le32_to_cpu((*(__le32 *)(__rxstatusdesc + 20))
26 #define GET_TX_REPORT_TYPE1_RERTY_0(__paddr) \
27 le16_get_bits(*(__le16 *)__paddr, GENMASK(15, 0))
28 #define GET_TX_REPORT_TYPE1_RERTY_1(__paddr) \
29 LE_BITS_TO_1BYTE(__paddr + 2, 0, 8)
30 #define GET_TX_REPORT_TYPE1_RERTY_2(__paddr) \
31 LE_BITS_TO_1BYTE(__paddr + 3, 0, 8)
32 #define GET_TX_REPORT_TYPE1_RERTY_3(__paddr) \
33 LE_BITS_TO_1BYTE(__paddr + 4, 0, 8)
34 #define GET_TX_REPORT_TYPE1_RERTY_4(__paddr) \
35 LE_BITS_TO_1BYTE(__paddr + 5, 0, 8)
36 #define GET_TX_REPORT_TYPE1_DROP_0(__paddr) \
37 LE_BITS_TO_1BYTE(__paddr + 6, 0, 8)
38 /* End rate adaptive define */
40 void ODM_RASupport_Init(struct odm_dm_struct *dm_odm);
42 int ODM_RAInfo_Init_all(struct odm_dm_struct *dm_odm);
44 int ODM_RAInfo_Init(struct odm_dm_struct *dm_odm, u8 MacID);
46 u8 ODM_RA_GetShortGI_8188E(struct odm_dm_struct *dm_odm, u8 MacID);
48 u8 ODM_RA_GetDecisionRate_8188E(struct odm_dm_struct *dm_odm, u8 MacID);
50 u8 ODM_RA_GetHwPwrStatus_8188E(struct odm_dm_struct *dm_odm, u8 MacID);
51 void ODM_RA_UpdateRateInfo_8188E(struct odm_dm_struct *dm_odm, u8 MacID,
52 u8 RateID, u32 RateMask,
55 void ODM_RA_SetRSSI_8188E(struct odm_dm_struct *dm_odm, u8 macid,
58 void ODM_RA_TxRPT2Handle_8188E(struct odm_dm_struct *dm_odm,
59 u8 *txrpt_buf, u16 txrpt_len,
60 u32 validentry0, u32 validentry1);
62 void ODM_RA_Set_TxRPT_Time(struct odm_dm_struct *dm_odm, u16 minRptTime);