hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/drivers/net/wireless/realtek/rtlwifi/rtl8192ee/trx.h
....@@ -1,27 +1,5 @@
1
-/******************************************************************************
2
- *
3
- * Copyright(c) 2009-2014 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
- * The full GNU General Public License is included in this distribution in the
15
- * file called LICENSE.
16
- *
17
- * Contact Information:
18
- * wlanfae <wlanfae@realtek.com>
19
- * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
20
- * Hsinchu 300, Taiwan.
21
- *
22
- * Larry Finger <Larry.Finger@lwfinger.net>
23
- *
24
- *****************************************************************************/
1
+/* SPDX-License-Identifier: GPL-2.0 */
2
+/* Copyright(c) 2009-2014 Realtek Corporation.*/
253
264 #ifndef __RTL92E_TRX_H__
275 #define __RTL92E_TRX_H__
....@@ -36,466 +14,471 @@
3614 #define RX_DESC_SIZE 24
3715 #define MAX_RECEIVE_BUFFER_SIZE 8192
3816
39
-#define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \
40
- SET_BITS_TO_LE_4BYTE(__pdesc, 0, 16, __val)
41
-#define SET_TX_DESC_OFFSET(__pdesc, __val) \
42
- SET_BITS_TO_LE_4BYTE(__pdesc, 16, 8, __val)
43
-#define SET_TX_DESC_BMC(__pdesc, __val) \
44
- SET_BITS_TO_LE_4BYTE(__pdesc, 24, 1, __val)
45
-#define SET_TX_DESC_HTC(__pdesc, __val) \
46
- SET_BITS_TO_LE_4BYTE(__pdesc, 25, 1, __val)
47
-#define SET_TX_DESC_LAST_SEG(__pdesc, __val) \
48
- SET_BITS_TO_LE_4BYTE(__pdesc, 26, 1, __val)
49
-#define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \
50
- SET_BITS_TO_LE_4BYTE(__pdesc, 27, 1, __val)
51
-#define SET_TX_DESC_LINIP(__pdesc, __val) \
52
- SET_BITS_TO_LE_4BYTE(__pdesc, 28, 1, __val)
53
-#define SET_TX_DESC_NO_ACM(__pdesc, __val) \
54
- SET_BITS_TO_LE_4BYTE(__pdesc, 29, 1, __val)
55
-#define SET_TX_DESC_GF(__pdesc, __val) \
56
- SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val)
57
-#define SET_TX_DESC_OWN(__pdesc, __val) \
58
- SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val)
17
+static inline void set_tx_desc_pkt_size(__le32 *__pdesc, u32 __val)
18
+{
19
+ le32p_replace_bits(__pdesc, __val, GENMASK(15, 0));
20
+}
5921
60
-#define GET_TX_DESC_PKT_SIZE(__pdesc) \
61
- LE_BITS_TO_4BYTE(__pdesc, 0, 16)
62
-#define GET_TX_DESC_OFFSET(__pdesc) \
63
- LE_BITS_TO_4BYTE(__pdesc, 16, 8)
64
-#define GET_TX_DESC_BMC(__pdesc) \
65
- LE_BITS_TO_4BYTE(__pdesc, 24, 1)
66
-#define GET_TX_DESC_HTC(__pdesc) \
67
- LE_BITS_TO_4BYTE(__pdesc, 25, 1)
68
-#define GET_TX_DESC_LAST_SEG(__pdesc) \
69
- LE_BITS_TO_4BYTE(__pdesc, 26, 1)
70
-#define GET_TX_DESC_FIRST_SEG(__pdesc) \
71
- LE_BITS_TO_4BYTE(__pdesc, 27, 1)
72
-#define GET_TX_DESC_LINIP(__pdesc) \
73
- LE_BITS_TO_4BYTE(__pdesc, 28, 1)
74
-#define GET_TX_DESC_NO_ACM(__pdesc) \
75
- LE_BITS_TO_4BYTE(__pdesc, 29, 1)
76
-#define GET_TX_DESC_GF(__pdesc) \
77
- LE_BITS_TO_4BYTE(__pdesc, 30, 1)
78
-#define GET_TX_DESC_OWN(__pdesc) \
79
- LE_BITS_TO_4BYTE(__pdesc, 31, 1)
22
+static inline void set_tx_desc_offset(__le32 *__pdesc, u32 __val)
23
+{
24
+ le32p_replace_bits(__pdesc, __val, GENMASK(23, 16));
25
+}
8026
81
-#define SET_TX_DESC_MACID(__pdesc, __val) \
82
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 0, 7, __val)
83
-#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \
84
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 8, 5, __val)
85
-#define SET_TX_DESC_RDG_NAV_EXT(__pdesc, __val) \
86
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 13, 1, __val)
87
-#define SET_TX_DESC_LSIG_TXOP_EN(__pdesc, __val) \
88
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 14, 1, __val)
89
-#define SET_TX_DESC_PIFS(__pdesc, __val) \
90
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 15, 1, __val)
91
-#define SET_TX_DESC_RATE_ID(__pdesc, __val) \
92
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 16, 5, __val)
93
-#define SET_TX_DESC_EN_DESC_ID(__pdesc, __val) \
94
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 21, 1, __val)
95
-#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \
96
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 22, 2, __val)
97
-#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \
98
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 24, 5, __val)
99
-#define SET_TX_DESC_MORE_DATA(__pdesc, __val) \
100
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 29, 1, __val)
101
-#define SET_TX_DESC_TXOP_PS_CAP(__pdesc, __val) \
102
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 30, 1, __val)
103
-#define SET_TX_DESC_TXOP_PS_MODE(__pdesc, __val) \
104
- SET_BITS_TO_LE_4BYTE(__pdesc+4, 31, 1, __val)
27
+static inline void set_tx_desc_bmc(__le32 *__pdesc, u32 __val)
28
+{
29
+ le32p_replace_bits(__pdesc, __val, BIT(24));
30
+}
10531
106
-#define GET_TX_DESC_MACID(__pdesc) \
107
- LE_BITS_TO_4BYTE(__pdesc+4, 0, 5)
108
-#define GET_TX_DESC_AGG_ENABLE(__pdesc) \
109
- LE_BITS_TO_4BYTE(__pdesc+4, 5, 1)
110
-#define GET_TX_DESC_AGG_BREAK(__pdesc) \
111
- LE_BITS_TO_4BYTE(__pdesc+4, 6, 1)
112
-#define GET_TX_DESC_RDG_ENABLE(__pdesc) \
113
- LE_BITS_TO_4BYTE(__pdesc+4, 7, 1)
114
-#define GET_TX_DESC_QUEUE_SEL(__pdesc) \
115
- LE_BITS_TO_4BYTE(__pdesc+4, 8, 5)
116
-#define GET_TX_DESC_RDG_NAV_EXT(__pdesc) \
117
- LE_BITS_TO_4BYTE(__pdesc+4, 13, 1)
118
-#define GET_TX_DESC_LSIG_TXOP_EN(__pdesc) \
119
- LE_BITS_TO_4BYTE(__pdesc+4, 14, 1)
120
-#define GET_TX_DESC_PIFS(__pdesc) \
121
- LE_BITS_TO_4BYTE(__pdesc+4, 15, 1)
122
-#define GET_TX_DESC_RATE_ID(__pdesc) \
123
- LE_BITS_TO_4BYTE(__pdesc+4, 16, 4)
124
-#define GET_TX_DESC_NAV_USE_HDR(__pdesc) \
125
- LE_BITS_TO_4BYTE(__pdesc+4, 20, 1)
126
-#define GET_TX_DESC_EN_DESC_ID(__pdesc) \
127
- LE_BITS_TO_4BYTE(__pdesc+4, 21, 1)
128
-#define GET_TX_DESC_SEC_TYPE(__pdesc) \
129
- LE_BITS_TO_4BYTE(__pdesc+4, 22, 2)
130
-#define GET_TX_DESC_PKT_OFFSET(__pdesc) \
131
- LE_BITS_TO_4BYTE(__pdesc+4, 24, 5)
32
+static inline void set_tx_desc_htc(__le32 *__pdesc, u32 __val)
33
+{
34
+ le32p_replace_bits(__pdesc, __val, BIT(25));
35
+}
13236
133
-#define SET_TX_DESC_PAID(__pdesc, __val) \
134
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 0, 9, __val)
135
-#define SET_TX_DESC_CCA_RTS(__pdesc, __val) \
136
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 10, 2, __val)
137
-#define SET_TX_DESC_AGG_ENABLE(__pdesc, __val) \
138
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 12, 1, __val)
139
-#define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \
140
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 13, 1, __val)
141
-#define SET_TX_DESC_NULL_0(__pdesc, __val) \
142
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 14, 1, __val)
143
-#define SET_TX_DESC_NULL_1(__pdesc, __val) \
144
- SET_BITS_TO_LE_4BYTE((__pdesc) + 8, 15, 1, __val)
145
-#define SET_TX_DESC_BK(__pdesc, __val) \
146
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 16, 1, __val)
147
-#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \
148
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 17, 1, __val)
149
-#define SET_TX_DESC_RAW(__pdesc, __val) \
150
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 18, 1, __val)
151
-#define SET_TX_DESC_SPE_RPT(__pdesc, __val) \
152
- SET_BITS_TO_LE_4BYTE((__pdesc) + 8, 19, 1, __val)
153
-#define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \
154
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 20, 3, __val)
155
-#define SET_TX_DESC_BT_NULL(__pdesc, __val) \
156
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 23, 1, __val)
157
-#define SET_TX_DESC_GID(__pdesc, __val) \
158
- SET_BITS_TO_LE_4BYTE(__pdesc+8, 24, 6, __val)
37
+static inline void set_tx_desc_last_seg(__le32 *__pdesc, u32 __val)
38
+{
39
+ le32p_replace_bits(__pdesc, __val, BIT(26));
40
+}
15941
160
-#define SET_TX_DESC_WHEADER_LEN(__pdesc, __val) \
161
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 0, 4, __val)
162
-#define SET_TX_DESC_CHK_EN(__pdesc, __val) \
163
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 4, 1, __val)
164
-#define SET_TX_DESC_EARLY_RATE(__pdesc, __val) \
165
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 5, 1, __val)
166
-#define SET_TX_DESC_HWSEQ_SEL(__pdesc, __val) \
167
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 6, 2, __val)
168
-#define SET_TX_DESC_USE_RATE(__pdesc, __val) \
169
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 8, 1, __val)
170
-#define SET_TX_DESC_DISABLE_RTS_FB(__pdesc, __val) \
171
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 9, 1, __val)
172
-#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \
173
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 10, 1, __val)
174
-#define SET_TX_DESC_CTS2SELF(__pdesc, __val) \
175
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 11, 1, __val)
176
-#define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \
177
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 12, 1, __val)
178
-#define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \
179
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 13, 1, __val)
180
-#define SET_TX_DESC_HW_PORT_ID(__pdesc, __val) \
181
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 14, 1, __val)
182
-#define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \
183
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 15, 1, __val)
184
-#define SET_TX_DESC_USE_MAX_LEN(__pdesc, __val) \
185
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 16, 1, __val)
186
-#define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \
187
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 17, 5, __val)
188
-#define SET_TX_DESC_NDPA(__pdesc, __val) \
189
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 22, 2, __val)
190
-#define SET_TX_DESC_AMPDU_MAX_TIME(__pdesc, __val) \
191
- SET_BITS_TO_LE_4BYTE(__pdesc+12, 24, 8, __val)
42
+static inline void set_tx_desc_first_seg(__le32 *__pdesc, u32 __val)
43
+{
44
+ le32p_replace_bits(__pdesc, __val, BIT(27));
45
+}
46
+
47
+static inline void set_tx_desc_linip(__le32 *__pdesc, u32 __val)
48
+{
49
+ le32p_replace_bits(__pdesc, __val, BIT(28));
50
+}
51
+
52
+static inline void set_tx_desc_own(__le32 *__pdesc, u32 __val)
53
+{
54
+ le32p_replace_bits(__pdesc, __val, BIT(31));
55
+}
56
+
57
+static inline int get_tx_desc_own(__le32 *__pdesc)
58
+{
59
+ return le32_get_bits(*(__pdesc), BIT(31));
60
+}
61
+
62
+static inline void set_tx_desc_macid(__le32 *__pdesc, u32 __val)
63
+{
64
+ le32p_replace_bits((__pdesc + 1), __val, GENMASK(6, 0));
65
+}
66
+
67
+static inline void set_tx_desc_queue_sel(__le32 *__pdesc, u32 __val)
68
+{
69
+ le32p_replace_bits((__pdesc + 1), __val, GENMASK(12, 8));
70
+}
71
+
72
+static inline void set_tx_desc_rate_id(__le32 *__pdesc, u32 __val)
73
+{
74
+ le32p_replace_bits((__pdesc + 1), __val, GENMASK(20, 16));
75
+}
76
+
77
+static inline void set_tx_desc_sec_type(__le32 *__pdesc, u32 __val)
78
+{
79
+ le32p_replace_bits((__pdesc + 1), __val, GENMASK(23, 22));
80
+}
81
+
82
+static inline void set_tx_desc_pkt_offset(__le32 *__pdesc, u32 __val)
83
+{
84
+ le32p_replace_bits((__pdesc + 1), __val, GENMASK(28, 24));
85
+}
86
+
87
+static inline void set_tx_desc_agg_enable(__le32 *__pdesc, u32 __val)
88
+{
89
+ le32p_replace_bits((__pdesc + 2), __val, BIT(12));
90
+}
91
+
92
+static inline void set_tx_desc_rdg_enable(__le32 *__pdesc, u32 __val)
93
+{
94
+ le32p_replace_bits((__pdesc + 2), __val, BIT(13));
95
+}
96
+
97
+static inline void set_tx_desc_more_frag(__le32 *__pdesc, u32 __val)
98
+{
99
+ le32p_replace_bits((__pdesc + 2), __val, BIT(17));
100
+}
101
+
102
+static inline void set_tx_desc_ampdu_density(__le32 *__pdesc, u32 __val)
103
+{
104
+ le32p_replace_bits((__pdesc + 2), __val, GENMASK(22, 20));
105
+}
106
+
107
+static inline void set_tx_desc_use_rate(__le32 *__pdesc, u32 __val)
108
+{
109
+ le32p_replace_bits((__pdesc + 3), __val, BIT(8));
110
+}
111
+
112
+static inline void set_tx_desc_disable_fb(__le32 *__pdesc, u32 __val)
113
+{
114
+ le32p_replace_bits((__pdesc + 3), __val, BIT(10));
115
+}
116
+
117
+static inline void set_tx_desc_cts2self(__le32 *__pdesc, u32 __val)
118
+{
119
+ le32p_replace_bits((__pdesc + 3), __val, BIT(11));
120
+}
121
+
122
+static inline void set_tx_desc_rts_enable(__le32 *__pdesc, u32 __val)
123
+{
124
+ le32p_replace_bits((__pdesc + 3), __val, BIT(12));
125
+}
126
+
127
+static inline void set_tx_desc_hw_rts_enable(__le32 *__pdesc, u32 __val)
128
+{
129
+ le32p_replace_bits((__pdesc + 3), __val, BIT(13));
130
+}
131
+
132
+static inline void set_tx_desc_nav_use_hdr(__le32 *__pdesc, u32 __val)
133
+{
134
+ le32p_replace_bits((__pdesc + 3), __val, BIT(15));
135
+}
136
+
137
+static inline void set_tx_desc_max_agg_num(__le32 *__pdesc, u32 __val)
138
+{
139
+ le32p_replace_bits((__pdesc + 3), __val, GENMASK(21, 17));
140
+}
192141
193142 /* Dword 4 */
194
-#define SET_TX_DESC_TX_RATE(__pdesc, __val) \
195
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 0, 7, __val)
196
-#define SET_TX_DESC_TRY_RATE(__pdesc, __val) \
197
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 7, 1, __val)
198
-#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \
199
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 8, 5, __val)
200
-#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \
201
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 13, 4, __val)
202
-#define SET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc, __val) \
203
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 17, 1, __val)
204
-#define SET_TX_DESC_DATA_RETRY_LIMIT(__pdesc, __val) \
205
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 18, 6, __val)
206
-#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \
207
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 24, 5, __val)
208
-#define SET_TX_DESC_PCTS_ENABLE(__pdesc, __val) \
209
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 29, 1, __val)
210
-#define SET_TX_DESC_PCTS_MASK_IDX(__pdesc, __val) \
211
- SET_BITS_TO_LE_4BYTE(__pdesc+16, 30, 2, __val)
143
+static inline void set_tx_desc_tx_rate(__le32 *__pdesc, u32 __val)
144
+{
145
+ le32p_replace_bits((__pdesc + 4), __val, GENMASK(6, 0));
146
+}
147
+
148
+static inline void set_tx_desc_data_rate_fb_limit(__le32 *__pdesc, u32 __val)
149
+{
150
+ le32p_replace_bits((__pdesc + 4), __val, GENMASK(12, 8));
151
+}
152
+
153
+static inline void set_tx_desc_rts_rate_fb_limit(__le32 *__pdesc, u32 __val)
154
+{
155
+ le32p_replace_bits((__pdesc + 4), __val, GENMASK(16, 13));
156
+}
157
+
158
+static inline void set_tx_desc_rts_rate(__le32 *__pdesc, u32 __val)
159
+{
160
+ le32p_replace_bits((__pdesc + 4), __val, GENMASK(28, 24));
161
+}
212162
213163 /* Dword 5 */
214
-#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \
215
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 0, 4, __val)
216
-#define SET_TX_DESC_DATA_SHORT(__pdesc, __val) \
217
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 4, 1, __val)
218
-#define SET_TX_DESC_DATA_BW(__pdesc, __val) \
219
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 5, 2, __val)
220
-#define SET_TX_DESC_DATA_LDPC(__pdesc, __val) \
221
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 7, 1, __val)
222
-#define SET_TX_DESC_DATA_STBC(__pdesc, __val) \
223
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 8, 2, __val)
224
-#define SET_TX_DESC_VCS_STBC(__pdesc, __val) \
225
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 10, 2, __val)
226
-#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \
227
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 12, 1, __val)
228
-#define SET_TX_DESC_RTS_SC(__pdesc, __val) \
229
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 13, 4, __val)
230
-#define SET_TX_DESC_TX_ANT(__pdesc, __val) \
231
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 24, 4, __val)
232
-#define SET_TX_DESC_TX_POWER_0_PSET(__pdesc, __val) \
233
- SET_BITS_TO_LE_4BYTE(__pdesc+20, 28, 3, __val)
164
+static inline void set_tx_desc_tx_sub_carrier(__le32 *__pdesc, u32 __val)
165
+{
166
+ le32p_replace_bits((__pdesc + 5), __val, GENMASK(3, 0));
167
+}
234168
235
-/* Dword 6 */
236
-#define SET_TX_DESC_SW_DEFINE(__pdesc, __val) \
237
- SET_BITS_TO_LE_4BYTE((__pdesc) + 24, 0, 12, __val)
238
-#define SET_TX_DESC_ANTSEL_A(__pdesc, __val) \
239
- SET_BITS_TO_LE_4BYTE((__pdesc) + 24, 16, 3, __val)
240
-#define SET_TX_DESC_ANTSEL_B(__pdesc, __val) \
241
- SET_BITS_TO_LE_4BYTE((__pdesc) + 24, 19, 3, __val)
242
-#define SET_TX_DESC_ANTSEL_C(__pdesc, __val) \
243
- SET_BITS_TO_LE_4BYTE((__pdesc) + 24, 22, 3, __val)
244
-#define SET_TX_DESC_ANTSEL_D(__pdesc, __val) \
245
- SET_BITS_TO_LE_4BYTE((__pdesc) + 24, 25, 3, __val)
169
+static inline void set_tx_desc_data_bw(__le32 *__pdesc, u32 __val)
170
+{
171
+ le32p_replace_bits((__pdesc + 4), __val, GENMASK(6, 5));
172
+}
173
+
174
+static inline void set_tx_desc_rts_short(__le32 *__pdesc, u32 __val)
175
+{
176
+ le32p_replace_bits((__pdesc + 5), __val, BIT(12));
177
+}
178
+
179
+static inline void set_tx_desc_rts_sc(__le32 *__pdesc, u32 __val)
180
+{
181
+ le32p_replace_bits((__pdesc + 5), __val, GENMASK(16, 13));
182
+}
246183
247184 /* Dword 7 */
248
-#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \
249
- SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 16, __val)
250
-#define SET_TX_DESC_USB_TXAGG_NUM(__pdesc, __val) \
251
- SET_BITS_TO_LE_4BYTE(__pdesc+28, 24, 8, __val)
252
-
253
-/* Dword 8 */
254
-#define SET_TX_DESC_RTS_RC(__pdesc, __val) \
255
- SET_BITS_TO_LE_4BYTE(__pdesc+32, 0, 6, __val)
256
-#define SET_TX_DESC_BAR_RTY_TH(__pdesc, __val) \
257
- SET_BITS_TO_LE_4BYTE(__pdesc+32, 6, 2, __val)
258
-#define SET_TX_DESC_DATA_RC(__pdesc, __val) \
259
- SET_BITS_TO_LE_4BYTE(__pdesc+32, 8, 6, __val)
260
-#define SET_TX_DESC_ENABLE_HW_SELECT(__pdesc, __val) \
261
- SET_BITS_TO_LE_4BYTE(__pdesc+32, 15, 1, __val)
262
-#define SET_TX_DESC_NEXT_HEAD_PAGE(__pdesc, __val) \
263
- SET_BITS_TO_LE_4BYTE(__pdesc+32, 16, 8, __val)
264
-#define SET_TX_DESC_TAIL_PAGE(__pdesc, __val) \
265
- SET_BITS_TO_LE_4BYTE(__pdesc+32, 24, 8, __val)
185
+static inline void set_tx_desc_tx_buffer_size(__le32 *__pdesc, u32 __val)
186
+{
187
+ le32p_replace_bits((__pdesc + 7), __val, GENMASK(15, 0));
188
+}
266189
267190 /* Dword 9 */
268
-#define SET_TX_DESC_PADDING_LENGTH(__pdesc, __val) \
269
- SET_BITS_TO_LE_4BYTE(__pdesc+36, 0, 11, __val)
270
-#define SET_TX_DESC_TXBF_PATH(__pdesc, __val) \
271
- SET_BITS_TO_LE_4BYTE(__pdesc+36, 11, 1, __val)
272
-#define SET_TX_DESC_SEQ(__pdesc, __val) \
273
- SET_BITS_TO_LE_4BYTE(__pdesc+36, 12, 12, __val)
274
-#define SET_TX_DESC_FINAL_DATA_RATE(__pdesc, __val) \
275
- SET_BITS_TO_LE_4BYTE(__pdesc+36, 24, 8, __val)
191
+static inline void set_tx_desc_seq(__le32 *__pdesc, u32 __val)
192
+{
193
+ le32p_replace_bits((__pdesc + 9), __val, GENMASK(23, 12));
194
+}
276195
277196 /* Dword 10 */
278
-#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \
279
- SET_BITS_TO_LE_4BYTE(__pdesc+40, 0, 32, __val)
197
+static inline void set_tx_desc_tx_buffer_address(__le32 *__pdesc, u32 __val)
198
+{
199
+ *(__pdesc + 10) = cpu_to_le32(__val);
200
+}
280201
281202 /* Dword 11*/
282
-#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \
283
- SET_BITS_TO_LE_4BYTE(__pdesc+48, 0, 32, __val)
203
+static inline void set_tx_desc_next_desc_address(__le32 *__pdesc, u32 __val)
204
+{
205
+ *(__pdesc + 12) = cpu_to_le32(__val);
206
+}
284207
285
-#define SET_EARLYMODE_PKTNUM(__paddr, __val) \
286
- SET_BITS_TO_LE_4BYTE(__paddr, 0, 4, __val)
287
-#define SET_EARLYMODE_LEN0(__paddr, __val) \
288
- SET_BITS_TO_LE_4BYTE(__paddr, 4, 15, __val)
289
-#define SET_EARLYMODE_LEN1(__paddr, __val) \
290
- SET_BITS_TO_LE_4BYTE(__paddr, 16, 2, __val)
291
-#define SET_EARLYMODE_LEN1_1(__paddr, __val) \
292
- SET_BITS_TO_LE_4BYTE(__paddr, 19, 13, __val)
293
-#define SET_EARLYMODE_LEN1_2(__paddr, __val) \
294
- SET_BITS_TO_LE_4BYTE(__paddr+4, 0, 2, __val)
295
-#define SET_EARLYMODE_LEN2(__paddr, __val) \
296
- SET_BITS_TO_LE_4BYTE(__paddr+4, 2, 15, __val)
297
-#define SET_EARLYMODE_LEN2_1(__paddr, __val) \
298
- SET_BITS_TO_LE_4BYTE(__paddr, 2, 4, __val)
299
-#define SET_EARLYMODE_LEN2_2(__paddr, __val) \
300
- SET_BITS_TO_LE_4BYTE(__paddr+4, 0, 8, __val)
301
-#define SET_EARLYMODE_LEN3(__paddr, __val) \
302
- SET_BITS_TO_LE_4BYTE(__paddr+4, 17, 15, __val)
303
-#define SET_EARLYMODE_LEN4(__paddr, __val) \
304
- SET_BITS_TO_LE_4BYTE(__paddr+4, 20, 12, __val)
208
+static inline void set_earlymode_pktnum(__le32 *__paddr, u32 __val)
209
+{
210
+ le32p_replace_bits(__paddr, __val, GENMASK(3, 0));
211
+}
212
+
213
+static inline void set_earlymode_len0(__le32 *__paddr, u32 __val)
214
+{
215
+ le32p_replace_bits(__paddr, __val, GENMASK(18, 4));
216
+}
217
+
218
+static inline void set_earlymode_len1(__le32 *__paddr, u32 __val)
219
+{
220
+ le32p_replace_bits(__paddr, __val, GENMASK(17, 16));
221
+}
222
+
223
+static inline void set_earlymode_len2_1(__le32 *__paddr, u32 __val)
224
+{
225
+ le32p_replace_bits(__paddr, __val, GENMASK(5, 2));
226
+}
227
+
228
+static inline void set_earlymode_len2_2(__le32 *__paddr, u32 __val)
229
+{
230
+ le32p_replace_bits((__paddr + 1), __val, GENMASK(7, 0));
231
+}
232
+
233
+static inline void set_earlymode_len3(__le32 *__paddr, u32 __val)
234
+{
235
+ le32p_replace_bits((__paddr + 1), __val, GENMASK(31, 17));
236
+}
237
+
238
+static inline void set_earlymode_len4(__le32 *__paddr, u32 __val)
239
+{
240
+ le32p_replace_bits((__paddr + 1), __val, GENMASK(31, 20));
241
+}
305242
306243 /* TX/RX buffer descriptor */
307244
308
-#define SET_TX_EXTBUFF_DESC_LEN(__pdesc, __val, __set) \
309
- SET_BITS_TO_LE_4BYTE(__pdesc+(__set*16), 0, 16, __val)
310
-#define SET_TX_EXTBUFF_DESC_ADDR_LOW(__pdesc, __val, __set)\
311
- SET_BITS_TO_LE_4BYTE(__pdesc+(__set*16)+4, 0, 32, __val)
312
-#define SET_TX_EXTBUFF_DESC_ADDR_HIGH(__pdesc, __val, __set)\
313
- SET_BITS_TO_LE_4BYTE(__pdesc+(__set*16)+8, 0, 32, __val)
314
-
315245 /* for Txfilldescroptor92ee, fill the desc content. */
316
-#define SET_TXBUFFER_DESC_LEN_WITH_OFFSET(__pdesc, __offset, __val) \
317
- SET_BITS_TO_LE_4BYTE((__pdesc) + ((__offset) * 16), 0, 16, __val)
318
-#define SET_TXBUFFER_DESC_AMSDU_WITH_OFFSET(__pdesc, __offset, __val) \
319
- SET_BITS_TO_LE_4BYTE((__pdesc) + ((__offset) * 16), 31, 1, __val)
320
-#define SET_TXBUFFER_DESC_ADD_LOW_WITH_OFFSET(__pdesc, __offset, __val) \
321
- SET_BITS_TO_LE_4BYTE((__pdesc) + ((__offset) * 16) + 4, 0, 32, __val)
322
-#define SET_TXBUFFER_DESC_ADD_HIGH_WITH_OFFSET(pbd, off, val, dma64) \
323
- (dma64 ? SET_BITS_TO_LE_4BYTE((pbd) + ((off) * 16) + 8, 0, 32, val) : 0)
324
-#define GET_TXBUFFER_DESC_ADDR_LOW(__pdesc, __offset) \
325
- LE_BITS_TO_4BYTE((__pdesc) + ((__offset) * 16) + 4, 0, 32)
326
-#define GET_TXBUFFER_DESC_ADDR_HIGH(pbd, off, dma64) \
327
- (dma64 ? LE_BITS_TO_4BYTE((pbd) + ((off) * 16) + 8, 0, 32) : 0)
246
+static inline void set_txbuffer_desc_len_with_offset(__le32 *__pdesc,
247
+ u8 __offset, u32 __val)
248
+{
249
+ le32p_replace_bits((__pdesc + 4 * __offset), __val,
250
+ GENMASK(15, 0));
251
+}
252
+
253
+static inline void set_txbuffer_desc_amsdu_with_offset(__le32 *__pdesc,
254
+ u8 __offset, u32 __val)
255
+{
256
+ le32p_replace_bits((__pdesc + 4 * __offset), __val, BIT(31));
257
+}
258
+
259
+static inline void set_txbuffer_desc_add_low_with_offset(__le32 *__pdesc,
260
+ u8 __offset,
261
+ u32 __val)
262
+{
263
+ *(__pdesc + 4 * __offset + 1) = cpu_to_le32(__val);
264
+}
265
+
266
+static inline void set_txbuffer_desc_add_high_with_offset(__le32 *pbd, u8 off,
267
+ u32 val, bool dma64)
268
+{
269
+ if (dma64)
270
+ *(pbd + 4 * off + 2) = cpu_to_le32(val);
271
+ else
272
+ *(pbd + 4 * off + 2) = 0;
273
+}
274
+
275
+static inline u32 get_txbuffer_desc_addr_low(__le32 *__pdesc, u8 __offset)
276
+{
277
+ return le32_to_cpu(*((__pdesc + 4 * __offset + 1)));
278
+}
279
+
280
+static inline u32 get_txbuffer_desc_addr_high(__le32 *pbd, u32 off, bool dma64)
281
+{
282
+ if (dma64)
283
+ return le32_to_cpu(*((pbd + 4 * off + 2)));
284
+ return 0;
285
+}
328286
329287 /* Dword 0 */
330
-#define SET_TX_BUFF_DESC_LEN_0(__pdesc, __val) \
331
- SET_BITS_TO_LE_4BYTE(__pdesc, 0, 14, __val)
332
-#define SET_TX_BUFF_DESC_PSB(__pdesc, __val) \
333
- SET_BITS_TO_LE_4BYTE(__pdesc, 16, 15, __val)
334
-#define SET_TX_BUFF_DESC_OWN(__pdesc, __val) \
335
- SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val)
288
+static inline void set_tx_buff_desc_len_0(__le32 *__pdesc, u32 __val)
289
+{
290
+ le32p_replace_bits(__pdesc, __val, GENMASK(13, 0));
291
+}
292
+
293
+static inline void set_tx_buff_desc_psb(__le32 *__pdesc, u32 __val)
294
+{
295
+ le32p_replace_bits(__pdesc, __val, GENMASK(30, 16));
296
+}
297
+
298
+static inline void set_tx_buff_desc_own(__le32 *__pdesc, u32 __val)
299
+{
300
+ le32p_replace_bits(__pdesc, __val, BIT(31));
301
+}
336302
337303 /* Dword 1 */
338
-#define SET_TX_BUFF_DESC_ADDR_LOW_0(__pdesc, __val) \
339
- SET_BITS_TO_LE_4BYTE((__pdesc) + 4, 0, 32, __val)
304
+static inline void set_tx_buff_desc_addr_low_0(__le32 *__pdesc, u32 __val)
305
+{
306
+ *(__pdesc + 1) = cpu_to_le32(__val);
307
+}
308
+
340309 /* Dword 2 */
341
-#define SET_TX_BUFF_DESC_ADDR_HIGH_0(bdesc, val, dma64) \
342
- SET_TXBUFFER_DESC_ADD_HIGH_WITH_OFFSET(bdesc, 0, val, dma64)
343
-/* Dword 3 / RESERVED 0 */
310
+static inline void set_tx_buff_desc_addr_high_0(__le32 *pdesc, u32 val,
311
+ bool dma64)
312
+{
313
+ if (dma64)
314
+ *(pdesc + 2) = cpu_to_le32(val);
315
+ else
316
+ *(pdesc + 2) = 0;
317
+}
344318
345319 /* RX buffer */
346320
347321 /* DWORD 0 */
348
-#define SET_RX_BUFFER_DESC_DATA_LENGTH(__status, __val) \
349
- SET_BITS_TO_LE_4BYTE(__status, 0, 14, __val)
350
-#define SET_RX_BUFFER_DESC_LS(__status, __val) \
351
- SET_BITS_TO_LE_4BYTE(__status, 15, 1, __val)
352
-#define SET_RX_BUFFER_DESC_FS(__status, __val) \
353
- SET_BITS_TO_LE_4BYTE(__status, 16, 1, __val)
354
-#define SET_RX_BUFFER_DESC_TOTAL_LENGTH(__status, __val) \
355
- SET_BITS_TO_LE_4BYTE(__status, 16, 15, __val)
322
+static inline void set_rx_buffer_desc_data_length(__le32 *__status, u32 __val)
323
+{
324
+ le32p_replace_bits(__status, __val, GENMASK(13, 0));
325
+}
356326
357
-#define GET_RX_BUFFER_DESC_OWN(__status) \
358
- LE_BITS_TO_4BYTE(__status, 31, 1)
359
-#define GET_RX_BUFFER_DESC_LS(__status) \
360
- LE_BITS_TO_4BYTE(__status, 15, 1)
361
-#define GET_RX_BUFFER_DESC_FS(__status) \
362
- LE_BITS_TO_4BYTE(__status, 16, 1)
363
-#define GET_RX_BUFFER_DESC_TOTAL_LENGTH(__status) \
364
- LE_BITS_TO_4BYTE(__status, 16, 15)
327
+static inline void set_rx_buffer_desc_ls(__le32 *__status, u32 __val)
328
+{
329
+ le32p_replace_bits(__status, __val, BIT(15));
330
+}
331
+
332
+static inline void set_rx_buffer_desc_fs(__le32 *__status, u32 __val)
333
+{
334
+ le32p_replace_bits(__status, __val, BIT(16));
335
+}
336
+
337
+static inline void set_rx_buffer_desc_total_length(__le32 *__status, u32 __val)
338
+{
339
+ le32p_replace_bits(__status, __val, GENMASK(30, 16));
340
+}
341
+
342
+static inline int get_rx_buffer_desc_ls(__le32 *__status)
343
+{
344
+ return le32_get_bits(*(__status), BIT(15));
345
+}
346
+
347
+static inline int get_rx_buffer_desc_fs(__le32 *__status)
348
+{
349
+ return le32_get_bits(*(__status), BIT(16));
350
+}
351
+
352
+static inline int get_rx_buffer_desc_total_length(__le32 *__status)
353
+{
354
+ return le32_get_bits(*(__status), GENMASK(30, 16));
355
+}
365356
366357 /* DWORD 1 */
367
-#define SET_RX_BUFFER_PHYSICAL_LOW(__status, __val) \
368
- SET_BITS_TO_LE_4BYTE(__status+4, 0, 32, __val)
358
+static inline void set_rx_buffer_physical_low(__le32 *__status, u32 __val)
359
+{
360
+ *(__status + 1) = cpu_to_le32(__val);
361
+}
369362
370363 /* DWORD 2 */
371
-#define SET_RX_BUFFER_PHYSICAL_HIGH(__rx_status_desc, __val, dma64) \
372
- (dma64 ? SET_BITS_TO_LE_4BYTE((__rx_status_desc) + 8, 0, 32, __val) : 0)
364
+static inline void set_rx_buffer_physical_high(__le32 *__rx_status_desc,
365
+ u32 __val, bool dma64)
366
+{
367
+ if (dma64)
368
+ *(__rx_status_desc + 2) = cpu_to_le32(__val);
369
+ else
370
+ *(__rx_status_desc + 2) = 0;
371
+}
373372
374
-#define GET_RX_DESC_PKT_LEN(__pdesc) \
375
- LE_BITS_TO_4BYTE(__pdesc, 0, 14)
376
-#define GET_RX_DESC_CRC32(__pdesc) \
377
- LE_BITS_TO_4BYTE(__pdesc, 14, 1)
378
-#define GET_RX_DESC_ICV(__pdesc) \
379
- LE_BITS_TO_4BYTE(__pdesc, 15, 1)
380
-#define GET_RX_DESC_DRV_INFO_SIZE(__pdesc) \
381
- LE_BITS_TO_4BYTE(__pdesc, 16, 4)
382
-#define GET_RX_DESC_SECURITY(__pdesc) \
383
- LE_BITS_TO_4BYTE(__pdesc, 20, 3)
384
-#define GET_RX_DESC_QOS(__pdesc) \
385
- LE_BITS_TO_4BYTE(__pdesc, 23, 1)
386
-#define GET_RX_DESC_SHIFT(__pdesc) \
387
- LE_BITS_TO_4BYTE(__pdesc, 24, 2)
388
-#define GET_RX_DESC_PHYST(__pdesc) \
389
- LE_BITS_TO_4BYTE(__pdesc, 26, 1)
390
-#define GET_RX_DESC_SWDEC(__pdesc) \
391
- LE_BITS_TO_4BYTE(__pdesc, 27, 1)
392
-#define GET_RX_DESC_LS(__pdesc) \
393
- LE_BITS_TO_4BYTE(__pdesc, 28, 1)
394
-#define GET_RX_DESC_FS(__pdesc) \
395
- LE_BITS_TO_4BYTE(__pdesc, 29, 1)
396
-#define GET_RX_DESC_EOR(__pdesc) \
397
- LE_BITS_TO_4BYTE(__pdesc, 30, 1)
398
-#define GET_RX_DESC_OWN(__pdesc) \
399
- LE_BITS_TO_4BYTE(__pdesc, 31, 1)
373
+static inline int get_rx_desc_pkt_len(__le32 *__pdesc)
374
+{
375
+ return le32_get_bits(*__pdesc, GENMASK(13, 0));
376
+}
400377
401
-#define SET_RX_DESC_PKT_LEN(__pdesc, __val) \
402
- SET_BITS_TO_LE_4BYTE(__pdesc, 0, 14, __val)
403
-#define SET_RX_DESC_EOR(__pdesc, __val) \
404
- SET_BITS_TO_LE_4BYTE(__pdesc, 30, 1, __val)
405
-#define SET_RX_DESC_OWN(__pdesc, __val) \
406
- SET_BITS_TO_LE_4BYTE(__pdesc, 31, 1, __val)
378
+static inline int get_rx_desc_crc32(__le32 *__pdesc)
379
+{
380
+ return le32_get_bits(*__pdesc, BIT(14));
381
+}
407382
408
-#define GET_RX_DESC_MACID(__pdesc) \
409
- LE_BITS_TO_4BYTE(__pdesc+4, 0, 7)
410
-#define GET_RX_DESC_TID(__pdesc) \
411
- LE_BITS_TO_4BYTE(__pdesc+4, 8, 4)
412
-#define GET_RX_DESC_MACID_VLD(__pdesc) \
413
- LE_BITS_TO_4BYTE(__pdesc+4, 12, 1)
414
-#define GET_RX_DESC_AMSDU(__pdesc) \
415
- LE_BITS_TO_4BYTE(__pdesc+4, 13, 1)
416
-#define GET_RX_DESC_RXID_MATCH(__pdesc) \
417
- LE_BITS_TO_4BYTE(__pdesc+4, 14, 1)
418
-#define GET_RX_DESC_PAGGR(__pdesc) \
419
- LE_BITS_TO_4BYTE(__pdesc+4, 15, 1)
420
-#define GET_RX_DESC_A1_FIT(__pdesc) \
421
- LE_BITS_TO_4BYTE(__pdesc+4, 16, 4)
422
-#define GET_RX_DESC_TCPOFFLOAD_CHKERR(__pdesc) \
423
- LE_BITS_TO_4BYTE(__pdesc+4, 20, 1)
424
-#define GET_RX_DESC_TCPOFFLOAD_IPVER(__pdesc) \
425
- LE_BITS_TO_4BYTE(__pdesc+4, 21, 1)
426
-#define GET_RX_DESC_TCPOFFLOAD_IS_TCPUDP(__pdesc) \
427
- LE_BITS_TO_4BYTE(__pdesc+4, 22, 1)
428
-#define GET_RX_DESC_TCPOFFLOAD_CHK_VLD(__pdesc) \
429
- LE_BITS_TO_4BYTE(__pdesc+4, 23, 1)
430
-#define GET_RX_DESC_PAM(__pdesc) \
431
- LE_BITS_TO_4BYTE(__pdesc+4, 24, 1)
432
-#define GET_RX_DESC_PWR(__pdesc) \
433
- LE_BITS_TO_4BYTE(__pdesc+4, 25, 1)
434
-#define GET_RX_DESC_MD(__pdesc) \
435
- LE_BITS_TO_4BYTE(__pdesc+4, 26, 1)
436
-#define GET_RX_DESC_MF(__pdesc) \
437
- LE_BITS_TO_4BYTE(__pdesc+4, 27, 1)
438
-#define GET_RX_DESC_TYPE(__pdesc) \
439
- LE_BITS_TO_4BYTE(__pdesc+4, 28, 2)
440
-#define GET_RX_DESC_MC(__pdesc) \
441
- LE_BITS_TO_4BYTE(__pdesc+4, 30, 1)
442
-#define GET_RX_DESC_BC(__pdesc) \
443
- LE_BITS_TO_4BYTE(__pdesc+4, 31, 1)
444
-#define GET_RX_DESC_SEQ(__pdesc) \
445
- LE_BITS_TO_4BYTE(__pdesc+8, 0, 12)
446
-#define GET_RX_DESC_FRAG(__pdesc) \
447
- LE_BITS_TO_4BYTE(__pdesc+8, 12, 4)
448
-#define GET_RX_DESC_RX_IS_QOS(__pdesc) \
449
- LE_BITS_TO_4BYTE(__pdesc+8, 16, 1)
450
-#define GET_RX_STATUS_DESC_RPT_SEL(__pdesc) \
451
- LE_BITS_TO_4BYTE(__pdesc+8, 28, 1)
383
+static inline int get_rx_desc_icv(__le32 *__pdesc)
384
+{
385
+ return le32_get_bits(*__pdesc, BIT(15));
386
+}
452387
453
-#define GET_RX_DESC_RXMCS(__pdesc) \
454
- LE_BITS_TO_4BYTE(__pdesc+12, 0, 7)
455
-#define GET_RX_DESC_HTC(__pdesc) \
456
- LE_BITS_TO_4BYTE(__pdesc+12, 10, 1)
457
-#define GET_RX_STATUS_DESC_EOSP(__pdesc) \
458
- LE_BITS_TO_4BYTE(__pdesc+12, 11, 1)
459
-#define GET_RX_STATUS_DESC_BSSID_FIT(__pdesc) \
460
- LE_BITS_TO_4BYTE(__pdesc+12, 12, 2)
461
-#define GET_RX_STATUS_DESC_DMA_AGG_NUM(__pdesc) \
462
- LE_BITS_TO_4BYTE(__pdesc+12, 16, 8)
463
-#define GET_RX_STATUS_DESC_PATTERN_MATCH(__pdesc) \
464
- LE_BITS_TO_4BYTE(__pdesc+12, 29, 1)
465
-#define GET_RX_STATUS_DESC_UNICAST_MATCH(__pdesc) \
466
- LE_BITS_TO_4BYTE(__pdesc+12, 30, 1)
467
-#define GET_RX_STATUS_DESC_MAGIC_MATCH(__pdesc) \
468
- LE_BITS_TO_4BYTE(__pdesc+12, 31, 1)
388
+static inline int get_rx_desc_drv_info_size(__le32 *__pdesc)
389
+{
390
+ return le32_get_bits(*__pdesc, GENMASK(19, 16));
391
+}
469392
470
-#define GET_RX_DESC_TSFL(__pdesc) \
471
- LE_BITS_TO_4BYTE(__pdesc+20, 0, 32)
393
+static inline int get_rx_desc_shift(__le32 *__pdesc)
394
+{
395
+ return le32_get_bits(*__pdesc, GENMASK(25, 24));
396
+}
472397
473
-#define GET_RX_DESC_BUFF_ADDR(__pdesc) \
474
- LE_BITS_TO_4BYTE(__pdesc+24, 0, 32)
475
-#define GET_RX_DESC_BUFF_ADDR64(__pdesc) \
476
- LE_BITS_TO_4BYTE(__pdesc+28, 0, 32)
398
+static inline int get_rx_desc_physt(__le32 *__pdesc)
399
+{
400
+ return le32_get_bits(*__pdesc, BIT(26));
401
+}
477402
478
-#define SET_RX_DESC_BUFF_ADDR(__pdesc, __val) \
479
- SET_BITS_TO_LE_4BYTE(__pdesc+24, 0, 32, __val)
480
-#define SET_RX_DESC_BUFF_ADDR64(__pdesc, __val) \
481
- SET_BITS_TO_LE_4BYTE(__pdesc+28, 0, 32, __val)
403
+static inline int get_rx_desc_swdec(__le32 *__pdesc)
404
+{
405
+ return le32_get_bits(*__pdesc, BIT(27));
406
+}
407
+
408
+static inline int get_rx_desc_own(__le32 *__pdesc)
409
+{
410
+ return le32_get_bits(*__pdesc, BIT(31));
411
+}
412
+
413
+static inline void set_rx_desc_eor(__le32 *__pdesc, u32 __val)
414
+{
415
+ le32p_replace_bits(__pdesc, __val, BIT(30));
416
+}
417
+
418
+static inline int get_rx_desc_macid(__le32 *__pdesc)
419
+{
420
+ return le32_get_bits(*(__pdesc + 1), GENMASK(6, 0));
421
+}
422
+
423
+static inline int get_rx_desc_paggr(__le32 *__pdesc)
424
+{
425
+ return le32_get_bits(*(__pdesc + 1), BIT(15));
426
+}
427
+
428
+static inline int get_rx_status_desc_rpt_sel(__le32 *__pdesc)
429
+{
430
+ return le32_get_bits(*(__pdesc + 2), BIT(28));
431
+}
432
+
433
+static inline int get_rx_desc_rxmcs(__le32 *__pdesc)
434
+{
435
+ return le32_get_bits(*(__pdesc + 3), GENMASK(6, 0));
436
+}
437
+
438
+static inline int get_rx_status_desc_pattern_match(__le32 *__pdesc)
439
+{
440
+ return le32_get_bits(*(__pdesc + 3), BIT(29));
441
+}
442
+
443
+static inline int get_rx_status_desc_unicast_match(__le32 *__pdesc)
444
+{
445
+ return le32_get_bits(*(__pdesc + 3), BIT(30));
446
+}
447
+
448
+static inline int get_rx_status_desc_magic_match(__le32 *__pdesc)
449
+{
450
+ return le32_get_bits(*(__pdesc + 3), BIT(31));
451
+}
452
+
453
+static inline u32 get_rx_desc_tsfl(__le32 *__pdesc)
454
+{
455
+ return le32_to_cpu(*((__pdesc + 5)));
456
+}
457
+
458
+static inline u32 get_rx_desc_buff_addr(__le32 *__pdesc)
459
+{
460
+ return le32_to_cpu(*((__pdesc + 6)));
461
+}
482462
483463 /* TX report 2 format in Rx desc*/
484464
485
-#define GET_RX_RPT2_DESC_PKT_LEN(__status) \
486
- LE_BITS_TO_4BYTE(__status, 0, 9)
487
-#define GET_RX_RPT2_DESC_MACID_VALID_1(__status) \
488
- LE_BITS_TO_4BYTE(__status+16, 0, 32)
489
-#define GET_RX_RPT2_DESC_MACID_VALID_2(__status) \
490
- LE_BITS_TO_4BYTE(__status+20, 0, 32)
465
+static inline u32 get_rx_rpt2_desc_macid_valid_1(__le32 *__status)
466
+{
467
+ return le32_to_cpu(*((__status + 4)));
468
+}
491469
492
-#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \
493
-do { \
494
- if (_size > TX_DESC_NEXT_DESC_OFFSET) \
495
- memset(__pdesc, 0, TX_DESC_NEXT_DESC_OFFSET); \
496
- else \
497
- memset(__pdesc, 0, _size); \
498
-} while (0)
470
+static inline u32 get_rx_rpt2_desc_macid_valid_2(__le32 *__status)
471
+{
472
+ return le32_to_cpu(*((__status + 5)));
473
+}
474
+
475
+static inline void clear_pci_tx_desc_content(__le32 *__pdesc, int _size)
476
+{
477
+ if (_size > TX_DESC_NEXT_DESC_OFFSET)
478
+ memset(__pdesc, 0, TX_DESC_NEXT_DESC_OFFSET);
479
+ else
480
+ memset(__pdesc, 0, _size);
481
+}
499482
500483 #define RTL92EE_RX_HAL_IS_CCK_RATE(rxmcs)\
501484 (rxmcs == DESC_RATE1M ||\