blob: c4adb97773659b5353b8d1d724e6f3cfa3ff0e8f [file] [log] [blame]
Larry Finger0c817332010-12-08 11:12:31 -06001/******************************************************************************
2 *
Larry Finger9003a4a2012-01-07 20:46:44 -06003 * Copyright(c) 2009-2012 Realtek Corporation.
Larry Finger0c817332010-12-08 11:12:31 -06004 *
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 * The full GNU General Public License is included in this distribution in the
19 * file called LICENSE.
20 *
21 * Contact Information:
22 * wlanfae <wlanfae@realtek.com>
23 * Realtek Corporation, No. 2, Innovation Road II, Hsinchu Science Park,
24 * Hsinchu 300, Taiwan.
25 *
26 * Larry Finger <Larry.Finger@lwfinger.net>
27 *
28 *****************************************************************************/
29
30#ifndef __RTL92CE_TRX_H__
31#define __RTL92CE_TRX_H__
32
33#define TX_DESC_SIZE 64
34#define TX_DESC_AGGR_SUBFRAME_SIZE 32
35
36#define RX_DESC_SIZE 32
37#define RX_DRV_INFO_SIZE_UNIT 8
38
39#define TX_DESC_NEXT_DESC_OFFSET 40
40#define USB_HWDESC_HEADER_LEN 32
41#define CRCLENGTH 4
42
Larry Finger17c9ac62011-02-19 16:29:57 -060043/* Define a macro that takes a le32 word, converts it to host ordering,
44 * right shifts by a specified count, creates a mask of the specified
45 * bit count, and extracts that number of bits.
46 */
47
48#define SHIFT_AND_MASK_LE(__pdesc, __shift, __mask) \
49 ((le32_to_cpu(*(((__le32 *)(__pdesc)))) >> (__shift)) & \
50 BIT_LEN_MASK_32(__mask))
51
52/* Define a macro that clears a bit field in an le32 word and
53 * sets the specified value into that bit field. The resulting
54 * value remains in le32 ordering; however, it is properly converted
55 * to host ordering for the clear and set operations before conversion
56 * back to le32.
57 */
58
59#define SET_BITS_OFFSET_LE(__pdesc, __shift, __len, __val) \
60 (*(__le32 *)(__pdesc) = \
61 (cpu_to_le32((le32_to_cpu(*((__le32 *)(__pdesc))) & \
62 (~(BIT_OFFSET_LEN_MASK_32((__shift), __len)))) | \
63 (((u32)(__val) & BIT_LEN_MASK_32(__len)) << (__shift)))));
64
65/* macros to read/write various fields in RX or TX descriptors */
66
Larry Finger0c817332010-12-08 11:12:31 -060067#define SET_TX_DESC_PKT_SIZE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -060068 SET_BITS_OFFSET_LE(__pdesc, 0, 16, __val)
Larry Finger0c817332010-12-08 11:12:31 -060069#define SET_TX_DESC_OFFSET(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -060070 SET_BITS_OFFSET_LE(__pdesc, 16, 8, __val)
Larry Finger0c817332010-12-08 11:12:31 -060071#define SET_TX_DESC_BMC(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -060072 SET_BITS_OFFSET_LE(__pdesc, 24, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -060073#define SET_TX_DESC_HTC(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -060074 SET_BITS_OFFSET_LE(__pdesc, 25, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -060075#define SET_TX_DESC_LAST_SEG(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -060076 SET_BITS_OFFSET_LE(__pdesc, 26, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -060077#define SET_TX_DESC_FIRST_SEG(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -060078 SET_BITS_OFFSET_LE(__pdesc, 27, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -060079#define SET_TX_DESC_LINIP(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -060080 SET_BITS_OFFSET_LE(__pdesc, 28, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -060081#define SET_TX_DESC_NO_ACM(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -060082 SET_BITS_OFFSET_LE(__pdesc, 29, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -060083#define SET_TX_DESC_GF(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -060084 SET_BITS_OFFSET_LE(__pdesc, 30, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -060085#define SET_TX_DESC_OWN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -060086 SET_BITS_OFFSET_LE(__pdesc, 31, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -060087
88#define GET_TX_DESC_PKT_SIZE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -060089 SHIFT_AND_MASK_LE(__pdesc, 0, 16)
Larry Finger0c817332010-12-08 11:12:31 -060090#define GET_TX_DESC_OFFSET(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -060091 SHIFT_AND_MASK_LE(__pdesc, 16, 8)
Larry Finger0c817332010-12-08 11:12:31 -060092#define GET_TX_DESC_BMC(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -060093 SHIFT_AND_MASK_LE(__pdesc, 24, 1)
Larry Finger0c817332010-12-08 11:12:31 -060094#define GET_TX_DESC_HTC(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -060095 SHIFT_AND_MASK_LE(__pdesc, 25, 1)
Larry Finger0c817332010-12-08 11:12:31 -060096#define GET_TX_DESC_LAST_SEG(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -060097 SHIFT_AND_MASK_LE(__pdesc, 26, 1)
Larry Finger0c817332010-12-08 11:12:31 -060098#define GET_TX_DESC_FIRST_SEG(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -060099 SHIFT_AND_MASK_LE(__pdesc, 27, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600100#define GET_TX_DESC_LINIP(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600101 SHIFT_AND_MASK_LE(__pdesc, 28, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600102#define GET_TX_DESC_NO_ACM(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600103 SHIFT_AND_MASK_LE(__pdesc, 29, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600104#define GET_TX_DESC_GF(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600105 SHIFT_AND_MASK_LE(__pdesc, 30, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600106#define GET_TX_DESC_OWN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600107 SHIFT_AND_MASK_LE(__pdesc, 31, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600108
109#define SET_TX_DESC_MACID(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600110 SET_BITS_OFFSET_LE(__pdesc+4, 0, 5, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600111#define SET_TX_DESC_AGG_BREAK(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600112 SET_BITS_OFFSET_LE(__pdesc+4, 5, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600113#define SET_TX_DESC_BK(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600114 SET_BITS_OFFSET_LE(__pdesc+4, 6, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600115#define SET_TX_DESC_RDG_ENABLE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600116 SET_BITS_OFFSET_LE(__pdesc+4, 7, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600117#define SET_TX_DESC_QUEUE_SEL(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600118 SET_BITS_OFFSET_LE(__pdesc+4, 8, 5, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600119#define SET_TX_DESC_RDG_NAV_EXT(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600120 SET_BITS_OFFSET_LE(__pdesc+4, 13, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600121#define SET_TX_DESC_LSIG_TXOP_EN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600122 SET_BITS_OFFSET_LE(__pdesc+4, 14, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600123#define SET_TX_DESC_PIFS(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600124 SET_BITS_OFFSET_LE(__pdesc+4, 15, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600125#define SET_TX_DESC_RATE_ID(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600126 SET_BITS_OFFSET_LE(__pdesc+4, 16, 4, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600127#define SET_TX_DESC_NAV_USE_HDR(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600128 SET_BITS_OFFSET_LE(__pdesc+4, 20, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600129#define SET_TX_DESC_EN_DESC_ID(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600130 SET_BITS_OFFSET_LE(__pdesc+4, 21, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600131#define SET_TX_DESC_SEC_TYPE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600132 SET_BITS_OFFSET_LE(__pdesc+4, 22, 2, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600133#define SET_TX_DESC_PKT_OFFSET(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600134 SET_BITS_OFFSET_LE(__pdesc+4, 24, 8, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600135
136#define GET_TX_DESC_MACID(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600137 SHIFT_AND_MASK_LE(__pdesc+4, 0, 5)
Larry Finger0c817332010-12-08 11:12:31 -0600138#define GET_TX_DESC_AGG_ENABLE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600139 SHIFT_AND_MASK_LE(__pdesc+4, 5, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600140#define GET_TX_DESC_AGG_BREAK(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600141 SHIFT_AND_MASK_LE(__pdesc+4, 6, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600142#define GET_TX_DESC_RDG_ENABLE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600143 SHIFT_AND_MASK_LE(__pdesc+4, 7, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600144#define GET_TX_DESC_QUEUE_SEL(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600145 SHIFT_AND_MASK_LE(__pdesc+4, 8, 5)
Larry Finger0c817332010-12-08 11:12:31 -0600146#define GET_TX_DESC_RDG_NAV_EXT(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600147 SHIFT_AND_MASK_LE(__pdesc+4, 13, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600148#define GET_TX_DESC_LSIG_TXOP_EN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600149 SHIFT_AND_MASK_LE(__pdesc+4, 14, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600150#define GET_TX_DESC_PIFS(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600151 SHIFT_AND_MASK_LE(__pdesc+4, 15, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600152#define GET_TX_DESC_RATE_ID(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600153 SHIFT_AND_MASK_LE(__pdesc+4, 16, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600154#define GET_TX_DESC_NAV_USE_HDR(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600155 SHIFT_AND_MASK_LE(__pdesc+4, 20, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600156#define GET_TX_DESC_EN_DESC_ID(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600157 SHIFT_AND_MASK_LE(__pdesc+4, 21, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600158#define GET_TX_DESC_SEC_TYPE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600159 SHIFT_AND_MASK_LE(__pdesc+4, 22, 2)
Larry Finger0c817332010-12-08 11:12:31 -0600160#define GET_TX_DESC_PKT_OFFSET(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600161 SHIFT_AND_MASK_LE(__pdesc+4, 24, 8)
Larry Finger0c817332010-12-08 11:12:31 -0600162
163#define SET_TX_DESC_RTS_RC(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600164 SET_BITS_OFFSET_LE(__pdesc+8, 0, 6, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600165#define SET_TX_DESC_DATA_RC(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600166 SET_BITS_OFFSET_LE(__pdesc+8, 6, 6, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600167#define SET_TX_DESC_BAR_RTY_TH(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600168 SET_BITS_OFFSET_LE(__pdesc+8, 14, 2, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600169#define SET_TX_DESC_MORE_FRAG(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600170 SET_BITS_OFFSET_LE(__pdesc+8, 17, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600171#define SET_TX_DESC_RAW(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600172 SET_BITS_OFFSET_LE(__pdesc+8, 18, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600173#define SET_TX_DESC_CCX(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600174 SET_BITS_OFFSET_LE(__pdesc+8, 19, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600175#define SET_TX_DESC_AMPDU_DENSITY(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600176 SET_BITS_OFFSET_LE(__pdesc+8, 20, 3, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600177#define SET_TX_DESC_ANTSEL_A(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600178 SET_BITS_OFFSET_LE(__pdesc+8, 24, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600179#define SET_TX_DESC_ANTSEL_B(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600180 SET_BITS_OFFSET_LE(__pdesc+8, 25, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600181#define SET_TX_DESC_TX_ANT_CCK(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600182 SET_BITS_OFFSET_LE(__pdesc+8, 26, 2, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600183#define SET_TX_DESC_TX_ANTL(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600184 SET_BITS_OFFSET_LE(__pdesc+8, 28, 2, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600185#define SET_TX_DESC_TX_ANT_HT(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600186 SET_BITS_OFFSET_LE(__pdesc+8, 30, 2, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600187
188#define GET_TX_DESC_RTS_RC(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600189 SHIFT_AND_MASK_LE(__pdesc+8, 0, 6)
Larry Finger0c817332010-12-08 11:12:31 -0600190#define GET_TX_DESC_DATA_RC(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600191 SHIFT_AND_MASK_LE(__pdesc+8, 6, 6)
Larry Finger0c817332010-12-08 11:12:31 -0600192#define GET_TX_DESC_BAR_RTY_TH(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600193 SHIFT_AND_MASK_LE(__pdesc+8, 14, 2)
Larry Finger0c817332010-12-08 11:12:31 -0600194#define GET_TX_DESC_MORE_FRAG(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600195 SHIFT_AND_MASK_LE(__pdesc+8, 17, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600196#define GET_TX_DESC_RAW(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600197 SHIFT_AND_MASK_LE(__pdesc+8, 18, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600198#define GET_TX_DESC_CCX(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600199 SHIFT_AND_MASK_LE(__pdesc+8, 19, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600200#define GET_TX_DESC_AMPDU_DENSITY(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600201 SHIFT_AND_MASK_LE(__pdesc+8, 20, 3)
Larry Finger0c817332010-12-08 11:12:31 -0600202#define GET_TX_DESC_ANTSEL_A(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600203 SHIFT_AND_MASK_LE(__pdesc+8, 24, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600204#define GET_TX_DESC_ANTSEL_B(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600205 SHIFT_AND_MASK_LE(__pdesc+8, 25, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600206#define GET_TX_DESC_TX_ANT_CCK(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600207 SHIFT_AND_MASK_LE(__pdesc+8, 26, 2)
Larry Finger0c817332010-12-08 11:12:31 -0600208#define GET_TX_DESC_TX_ANTL(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600209 SHIFT_AND_MASK_LE(__pdesc+8, 28, 2)
Larry Finger0c817332010-12-08 11:12:31 -0600210#define GET_TX_DESC_TX_ANT_HT(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600211 SHIFT_AND_MASK_LE(__pdesc+8, 30, 2)
Larry Finger0c817332010-12-08 11:12:31 -0600212
213#define SET_TX_DESC_NEXT_HEAP_PAGE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600214 SET_BITS_OFFSET_LE(__pdesc+12, 0, 8, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600215#define SET_TX_DESC_TAIL_PAGE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600216 SET_BITS_OFFSET_LE(__pdesc+12, 8, 8, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600217#define SET_TX_DESC_SEQ(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600218 SET_BITS_OFFSET_LE(__pdesc+12, 16, 12, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600219#define SET_TX_DESC_PKT_ID(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600220 SET_BITS_OFFSET_LE(__pdesc+12, 28, 4, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600221
222#define GET_TX_DESC_NEXT_HEAP_PAGE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600223 SHIFT_AND_MASK_LE(__pdesc+12, 0, 8)
Larry Finger0c817332010-12-08 11:12:31 -0600224#define GET_TX_DESC_TAIL_PAGE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600225 SHIFT_AND_MASK_LE(__pdesc+12, 8, 8)
Larry Finger0c817332010-12-08 11:12:31 -0600226#define GET_TX_DESC_SEQ(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600227 SHIFT_AND_MASK_LE(__pdesc+12, 16, 12)
Larry Finger0c817332010-12-08 11:12:31 -0600228#define GET_TX_DESC_PKT_ID(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600229 SHIFT_AND_MASK_LE(__pdesc+12, 28, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600230
231#define SET_TX_DESC_RTS_RATE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600232 SET_BITS_OFFSET_LE(__pdesc+16, 0, 5, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600233#define SET_TX_DESC_AP_DCFE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600234 SET_BITS_OFFSET_LE(__pdesc+16, 5, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600235#define SET_TX_DESC_QOS(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600236 SET_BITS_OFFSET_LE(__pdesc+16, 6, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600237#define SET_TX_DESC_HWSEQ_EN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600238 SET_BITS_OFFSET_LE(__pdesc+16, 7, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600239#define SET_TX_DESC_USE_RATE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600240 SET_BITS_OFFSET_LE(__pdesc+16, 8, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600241#define SET_TX_DESC_DISABLE_RTS_FB(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600242 SET_BITS_OFFSET_LE(__pdesc+16, 9, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600243#define SET_TX_DESC_DISABLE_FB(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600244 SET_BITS_OFFSET_LE(__pdesc+16, 10, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600245#define SET_TX_DESC_CTS2SELF(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600246 SET_BITS_OFFSET_LE(__pdesc+16, 11, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600247#define SET_TX_DESC_RTS_ENABLE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600248 SET_BITS_OFFSET_LE(__pdesc+16, 12, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600249#define SET_TX_DESC_HW_RTS_ENABLE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600250 SET_BITS_OFFSET_LE(__pdesc+16, 13, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600251#define SET_TX_DESC_PORT_ID(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600252 SET_BITS_OFFSET_LE(__pdesc+16, 14, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600253#define SET_TX_DESC_WAIT_DCTS(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600254 SET_BITS_OFFSET_LE(__pdesc+16, 18, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600255#define SET_TX_DESC_CTS2AP_EN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600256 SET_BITS_OFFSET_LE(__pdesc+16, 19, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600257#define SET_TX_DESC_TX_SUB_CARRIER(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600258 SET_BITS_OFFSET_LE(__pdesc+16, 20, 2, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600259#define SET_TX_DESC_TX_STBC(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600260 SET_BITS_OFFSET_LE(__pdesc+16, 22, 2, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600261#define SET_TX_DESC_DATA_SHORT(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600262 SET_BITS_OFFSET_LE(__pdesc+16, 24, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600263#define SET_TX_DESC_DATA_BW(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600264 SET_BITS_OFFSET_LE(__pdesc+16, 25, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600265#define SET_TX_DESC_RTS_SHORT(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600266 SET_BITS_OFFSET_LE(__pdesc+16, 26, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600267#define SET_TX_DESC_RTS_BW(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600268 SET_BITS_OFFSET_LE(__pdesc+16, 27, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600269#define SET_TX_DESC_RTS_SC(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600270 SET_BITS_OFFSET_LE(__pdesc+16, 28, 2, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600271#define SET_TX_DESC_RTS_STBC(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600272 SET_BITS_OFFSET_LE(__pdesc+16, 30, 2, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600273
274#define GET_TX_DESC_RTS_RATE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600275 SHIFT_AND_MASK_LE(__pdesc+16, 0, 5)
Larry Finger0c817332010-12-08 11:12:31 -0600276#define GET_TX_DESC_AP_DCFE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600277 SHIFT_AND_MASK_LE(__pdesc+16, 5, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600278#define GET_TX_DESC_QOS(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600279 SHIFT_AND_MASK_LE(__pdesc+16, 6, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600280#define GET_TX_DESC_HWSEQ_EN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600281 SHIFT_AND_MASK_LE(__pdesc+16, 7, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600282#define GET_TX_DESC_USE_RATE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600283 SHIFT_AND_MASK_LE(__pdesc+16, 8, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600284#define GET_TX_DESC_DISABLE_RTS_FB(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600285 SHIFT_AND_MASK_LE(__pdesc+16, 9, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600286#define GET_TX_DESC_DISABLE_FB(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600287 SHIFT_AND_MASK_LE(__pdesc+16, 10, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600288#define GET_TX_DESC_CTS2SELF(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600289 SHIFT_AND_MASK_LE(__pdesc+16, 11, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600290#define GET_TX_DESC_RTS_ENABLE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600291 SHIFT_AND_MASK_LE(__pdesc+16, 12, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600292#define GET_TX_DESC_HW_RTS_ENABLE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600293 SHIFT_AND_MASK_LE(__pdesc+16, 13, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600294#define GET_TX_DESC_PORT_ID(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600295 SHIFT_AND_MASK_LE(__pdesc+16, 14, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600296#define GET_TX_DESC_WAIT_DCTS(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600297 SHIFT_AND_MASK_LE(__pdesc+16, 18, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600298#define GET_TX_DESC_CTS2AP_EN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600299 SHIFT_AND_MASK_LE(__pdesc+16, 19, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600300#define GET_TX_DESC_TX_SUB_CARRIER(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600301 SHIFT_AND_MASK_LE(__pdesc+16, 20, 2)
Larry Finger0c817332010-12-08 11:12:31 -0600302#define GET_TX_DESC_TX_STBC(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600303 SHIFT_AND_MASK_LE(__pdesc+16, 22, 2)
Larry Finger0c817332010-12-08 11:12:31 -0600304#define GET_TX_DESC_DATA_SHORT(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600305 SHIFT_AND_MASK_LE(__pdesc+16, 24, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600306#define GET_TX_DESC_DATA_BW(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600307 SHIFT_AND_MASK_LE(__pdesc+16, 25, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600308#define GET_TX_DESC_RTS_SHORT(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600309 SHIFT_AND_MASK_LE(__pdesc+16, 26, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600310#define GET_TX_DESC_RTS_BW(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600311 SHIFT_AND_MASK_LE(__pdesc+16, 27, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600312#define GET_TX_DESC_RTS_SC(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600313 SHIFT_AND_MASK_LE(__pdesc+16, 28, 2)
Larry Finger0c817332010-12-08 11:12:31 -0600314#define GET_TX_DESC_RTS_STBC(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600315 SHIFT_AND_MASK_LE(__pdesc+16, 30, 2)
Larry Finger0c817332010-12-08 11:12:31 -0600316
317#define SET_TX_DESC_TX_RATE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600318 SET_BITS_OFFSET_LE(__pdesc+20, 0, 6, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600319#define SET_TX_DESC_DATA_SHORTGI(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600320 SET_BITS_OFFSET_LE(__pdesc+20, 6, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600321#define SET_TX_DESC_CCX_TAG(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600322 SET_BITS_OFFSET_LE(__pdesc+20, 7, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600323#define SET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600324 SET_BITS_OFFSET_LE(__pdesc+20, 8, 5, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600325#define SET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600326 SET_BITS_OFFSET_LE(__pdesc+20, 13, 4, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600327#define SET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600328 SET_BITS_OFFSET_LE(__pdesc+20, 17, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600329#define SET_TX_DESC_DATA_RETRY_LIMIT(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600330 SET_BITS_OFFSET_LE(__pdesc+20, 18, 6, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600331#define SET_TX_DESC_USB_TXAGG_NUM(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600332 SET_BITS_OFFSET_LE(__pdesc+20, 24, 8, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600333
334#define GET_TX_DESC_TX_RATE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600335 SHIFT_AND_MASK_LE(__pdesc+20, 0, 6)
Larry Finger0c817332010-12-08 11:12:31 -0600336#define GET_TX_DESC_DATA_SHORTGI(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600337 SHIFT_AND_MASK_LE(__pdesc+20, 6, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600338#define GET_TX_DESC_CCX_TAG(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600339 SHIFT_AND_MASK_LE(__pdesc+20, 7, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600340#define GET_TX_DESC_DATA_RATE_FB_LIMIT(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600341 SHIFT_AND_MASK_LE(__pdesc+20, 8, 5)
Larry Finger0c817332010-12-08 11:12:31 -0600342#define GET_TX_DESC_RTS_RATE_FB_LIMIT(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600343 SHIFT_AND_MASK_LE(__pdesc+20, 13, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600344#define GET_TX_DESC_RETRY_LIMIT_ENABLE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600345 SHIFT_AND_MASK_LE(__pdesc+20, 17, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600346#define GET_TX_DESC_DATA_RETRY_LIMIT(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600347 SHIFT_AND_MASK_LE(__pdesc+20, 18, 6)
Larry Finger0c817332010-12-08 11:12:31 -0600348#define GET_TX_DESC_USB_TXAGG_NUM(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600349 SHIFT_AND_MASK_LE(__pdesc+20, 24, 8)
Larry Finger0c817332010-12-08 11:12:31 -0600350
351#define SET_TX_DESC_TXAGC_A(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600352 SET_BITS_OFFSET_LE(__pdesc+24, 0, 5, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600353#define SET_TX_DESC_TXAGC_B(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600354 SET_BITS_OFFSET_LE(__pdesc+24, 5, 5, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600355#define SET_TX_DESC_USE_MAX_LEN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600356 SET_BITS_OFFSET_LE(__pdesc+24, 10, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600357#define SET_TX_DESC_MAX_AGG_NUM(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600358 SET_BITS_OFFSET_LE(__pdesc+24, 11, 5, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600359#define SET_TX_DESC_MCSG1_MAX_LEN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600360 SET_BITS_OFFSET_LE(__pdesc+24, 16, 4, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600361#define SET_TX_DESC_MCSG2_MAX_LEN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600362 SET_BITS_OFFSET_LE(__pdesc+24, 20, 4, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600363#define SET_TX_DESC_MCSG3_MAX_LEN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600364 SET_BITS_OFFSET_LE(__pdesc+24, 24, 4, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600365#define SET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600366 SET_BITS_OFFSET_LE(__pdesc+24, 28, 4, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600367
368#define GET_TX_DESC_TXAGC_A(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600369 SHIFT_AND_MASK_LE(__pdesc+24, 0, 5)
Larry Finger0c817332010-12-08 11:12:31 -0600370#define GET_TX_DESC_TXAGC_B(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600371 SHIFT_AND_MASK_LE(__pdesc+24, 5, 5)
Larry Finger0c817332010-12-08 11:12:31 -0600372#define GET_TX_DESC_USE_MAX_LEN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600373 SHIFT_AND_MASK_LE(__pdesc+24, 10, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600374#define GET_TX_DESC_MAX_AGG_NUM(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600375 SHIFT_AND_MASK_LE(__pdesc+24, 11, 5)
Larry Finger0c817332010-12-08 11:12:31 -0600376#define GET_TX_DESC_MCSG1_MAX_LEN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600377 SHIFT_AND_MASK_LE(__pdesc+24, 16, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600378#define GET_TX_DESC_MCSG2_MAX_LEN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600379 SHIFT_AND_MASK_LE(__pdesc+24, 20, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600380#define GET_TX_DESC_MCSG3_MAX_LEN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600381 SHIFT_AND_MASK_LE(__pdesc+24, 24, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600382#define GET_TX_DESC_MCS7_SGI_MAX_LEN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600383 SHIFT_AND_MASK_LE(__pdesc+24, 28, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600384
385#define SET_TX_DESC_TX_BUFFER_SIZE(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600386 SET_BITS_OFFSET_LE(__pdesc+28, 0, 16, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600387#define SET_TX_DESC_MCSG4_MAX_LEN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600388 SET_BITS_OFFSET_LE(__pdesc+28, 16, 4, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600389#define SET_TX_DESC_MCSG5_MAX_LEN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600390 SET_BITS_OFFSET_LE(__pdesc+28, 20, 4, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600391#define SET_TX_DESC_MCSG6_MAX_LEN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600392 SET_BITS_OFFSET_LE(__pdesc+28, 24, 4, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600393#define SET_TX_DESC_MCS15_SGI_MAX_LEN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600394 SET_BITS_OFFSET_LE(__pdesc+28, 28, 4, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600395
396#define GET_TX_DESC_TX_BUFFER_SIZE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600397 SHIFT_AND_MASK_LE(__pdesc+28, 0, 16)
Larry Finger0c817332010-12-08 11:12:31 -0600398#define GET_TX_DESC_MCSG4_MAX_LEN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600399 SHIFT_AND_MASK_LE(__pdesc+28, 16, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600400#define GET_TX_DESC_MCSG5_MAX_LEN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600401 SHIFT_AND_MASK_LE(__pdesc+28, 20, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600402#define GET_TX_DESC_MCSG6_MAX_LEN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600403 SHIFT_AND_MASK_LE(__pdesc+28, 24, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600404#define GET_TX_DESC_MCS15_SGI_MAX_LEN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600405 SHIFT_AND_MASK_LE(__pdesc+28, 28, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600406
407#define SET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600408 SET_BITS_OFFSET_LE(__pdesc+32, 0, 32, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600409#define SET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600410 SET_BITS_OFFSET_LE(__pdesc+36, 0, 32, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600411
412#define GET_TX_DESC_TX_BUFFER_ADDRESS(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600413 SHIFT_AND_MASK_LE(__pdesc+32, 0, 32)
Larry Finger0c817332010-12-08 11:12:31 -0600414#define GET_TX_DESC_TX_BUFFER_ADDRESS64(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600415 SHIFT_AND_MASK_LE(__pdesc+36, 0, 32)
Larry Finger0c817332010-12-08 11:12:31 -0600416
417#define SET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600418 SET_BITS_OFFSET_LE(__pdesc+40, 0, 32, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600419#define SET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600420 SET_BITS_OFFSET_LE(__pdesc+44, 0, 32, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600421
422#define GET_TX_DESC_NEXT_DESC_ADDRESS(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600423 SHIFT_AND_MASK_LE(__pdesc+40, 0, 32)
Larry Finger0c817332010-12-08 11:12:31 -0600424#define GET_TX_DESC_NEXT_DESC_ADDRESS64(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600425 SHIFT_AND_MASK_LE(__pdesc+44, 0, 32)
Larry Finger0c817332010-12-08 11:12:31 -0600426
427#define GET_RX_DESC_PKT_LEN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600428 SHIFT_AND_MASK_LE(__pdesc, 0, 14)
Larry Finger0c817332010-12-08 11:12:31 -0600429#define GET_RX_DESC_CRC32(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600430 SHIFT_AND_MASK_LE(__pdesc, 14, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600431#define GET_RX_DESC_ICV(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600432 SHIFT_AND_MASK_LE(__pdesc, 15, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600433#define GET_RX_DESC_DRV_INFO_SIZE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600434 SHIFT_AND_MASK_LE(__pdesc, 16, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600435#define GET_RX_DESC_SECURITY(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600436 SHIFT_AND_MASK_LE(__pdesc, 20, 3)
Larry Finger0c817332010-12-08 11:12:31 -0600437#define GET_RX_DESC_QOS(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600438 SHIFT_AND_MASK_LE(__pdesc, 23, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600439#define GET_RX_DESC_SHIFT(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600440 SHIFT_AND_MASK_LE(__pdesc, 24, 2)
Larry Finger0c817332010-12-08 11:12:31 -0600441#define GET_RX_DESC_PHYST(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600442 SHIFT_AND_MASK_LE(__pdesc, 26, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600443#define GET_RX_DESC_SWDEC(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600444 SHIFT_AND_MASK_LE(__pdesc, 27, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600445#define GET_RX_DESC_LS(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600446 SHIFT_AND_MASK_LE(__pdesc, 28, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600447#define GET_RX_DESC_FS(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600448 SHIFT_AND_MASK_LE(__pdesc, 29, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600449#define GET_RX_DESC_EOR(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600450 SHIFT_AND_MASK_LE(__pdesc, 30, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600451#define GET_RX_DESC_OWN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600452 SHIFT_AND_MASK_LE(__pdesc, 31, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600453
454#define SET_RX_DESC_PKT_LEN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600455 SET_BITS_OFFSET_LE(__pdesc, 0, 14, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600456#define SET_RX_DESC_EOR(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600457 SET_BITS_OFFSET_LE(__pdesc, 30, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600458#define SET_RX_DESC_OWN(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600459 SET_BITS_OFFSET_LE(__pdesc, 31, 1, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600460
461#define GET_RX_DESC_MACID(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600462 SHIFT_AND_MASK_LE(__pdesc+4, 0, 5)
Larry Finger0c817332010-12-08 11:12:31 -0600463#define GET_RX_DESC_TID(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600464 SHIFT_AND_MASK_LE(__pdesc+4, 5, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600465#define GET_RX_DESC_HWRSVD(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600466 SHIFT_AND_MASK_LE(__pdesc+4, 9, 5)
Larry Finger0c817332010-12-08 11:12:31 -0600467#define GET_RX_DESC_PAGGR(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600468 SHIFT_AND_MASK_LE(__pdesc+4, 14, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600469#define GET_RX_DESC_FAGGR(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600470 SHIFT_AND_MASK_LE(__pdesc+4, 15, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600471#define GET_RX_DESC_A1_FIT(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600472 SHIFT_AND_MASK_LE(__pdesc+4, 16, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600473#define GET_RX_DESC_A2_FIT(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600474 SHIFT_AND_MASK_LE(__pdesc+4, 20, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600475#define GET_RX_DESC_PAM(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600476 SHIFT_AND_MASK_LE(__pdesc+4, 24, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600477#define GET_RX_DESC_PWR(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600478 SHIFT_AND_MASK_LE(__pdesc+4, 25, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600479#define GET_RX_DESC_MD(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600480 SHIFT_AND_MASK_LE(__pdesc+4, 26, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600481#define GET_RX_DESC_MF(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600482 SHIFT_AND_MASK_LE(__pdesc+4, 27, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600483#define GET_RX_DESC_TYPE(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600484 SHIFT_AND_MASK_LE(__pdesc+4, 28, 2)
Larry Finger0c817332010-12-08 11:12:31 -0600485#define GET_RX_DESC_MC(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600486 SHIFT_AND_MASK_LE(__pdesc+4, 30, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600487#define GET_RX_DESC_BC(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600488 SHIFT_AND_MASK_LE(__pdesc+4, 31, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600489#define GET_RX_DESC_SEQ(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600490 SHIFT_AND_MASK_LE(__pdesc+8, 0, 12)
Larry Finger0c817332010-12-08 11:12:31 -0600491#define GET_RX_DESC_FRAG(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600492 SHIFT_AND_MASK_LE(__pdesc+8, 12, 4)
Larry Finger0c817332010-12-08 11:12:31 -0600493#define GET_RX_DESC_NEXT_PKT_LEN(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600494 SHIFT_AND_MASK_LE(__pdesc+8, 16, 14)
Larry Finger0c817332010-12-08 11:12:31 -0600495#define GET_RX_DESC_NEXT_IND(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600496 SHIFT_AND_MASK_LE(__pdesc+8, 30, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600497#define GET_RX_DESC_RSVD(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600498 SHIFT_AND_MASK_LE(__pdesc+8, 31, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600499
500#define GET_RX_DESC_RXMCS(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600501 SHIFT_AND_MASK_LE(__pdesc+12, 0, 6)
Larry Finger0c817332010-12-08 11:12:31 -0600502#define GET_RX_DESC_RXHT(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600503 SHIFT_AND_MASK_LE(__pdesc+12, 6, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600504#define GET_RX_DESC_SPLCP(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600505 SHIFT_AND_MASK_LE(__pdesc+12, 8, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600506#define GET_RX_DESC_BW(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600507 SHIFT_AND_MASK_LE(__pdesc+12, 9, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600508#define GET_RX_DESC_HTC(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600509 SHIFT_AND_MASK_LE(__pdesc+12, 10, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600510#define GET_RX_DESC_HWPC_ERR(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600511 SHIFT_AND_MASK_LE(__pdesc+12, 14, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600512#define GET_RX_DESC_HWPC_IND(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600513 SHIFT_AND_MASK_LE(__pdesc+12, 15, 1)
Larry Finger0c817332010-12-08 11:12:31 -0600514#define GET_RX_DESC_IV0(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600515 SHIFT_AND_MASK_LE(__pdesc+12, 16, 16)
Larry Finger0c817332010-12-08 11:12:31 -0600516
517#define GET_RX_DESC_IV1(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600518 SHIFT_AND_MASK_LE(__pdesc+16, 0, 32)
Larry Finger0c817332010-12-08 11:12:31 -0600519#define GET_RX_DESC_TSFL(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600520 SHIFT_AND_MASK_LE(__pdesc+20, 0, 32)
Larry Finger0c817332010-12-08 11:12:31 -0600521
522#define GET_RX_DESC_BUFF_ADDR(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600523 SHIFT_AND_MASK_LE(__pdesc+24, 0, 32)
Larry Finger0c817332010-12-08 11:12:31 -0600524#define GET_RX_DESC_BUFF_ADDR64(__pdesc) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600525 SHIFT_AND_MASK_LE(__pdesc+28, 0, 32)
Larry Finger0c817332010-12-08 11:12:31 -0600526
527#define SET_RX_DESC_BUFF_ADDR(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600528 SET_BITS_OFFSET_LE(__pdesc+24, 0, 32, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600529#define SET_RX_DESC_BUFF_ADDR64(__pdesc, __val) \
Larry Finger17c9ac62011-02-19 16:29:57 -0600530 SET_BITS_OFFSET_LE(__pdesc+28, 0, 32, __val)
Larry Finger0c817332010-12-08 11:12:31 -0600531
532#define CLEAR_PCI_TX_DESC_CONTENT(__pdesc, _size) \
Joe Perchesda951c22012-04-03 14:46:49 -0700533 memset(__pdesc, 0, min_t(size_t, _size, TX_DESC_NEXT_DESC_OFFSET))
Larry Finger0c817332010-12-08 11:12:31 -0600534
Larry Finger0c817332010-12-08 11:12:31 -0600535struct rx_fwinfo_92c {
536 u8 gain_trsw[4];
537 u8 pwdb_all;
538 u8 cfosho[4];
539 u8 cfotail[4];
540 char rxevm[2];
541 char rxsnr[4];
542 u8 pdsnr[2];
543 u8 csi_current[2];
544 u8 csi_target[2];
545 u8 sigevm;
546 u8 max_ex_pwr;
547 u8 ex_intf_flag:1;
548 u8 sgi_en:1;
549 u8 rxsc:2;
550 u8 reserve:4;
John W. Linvillee1374782010-12-16 09:20:16 -0500551} __packed;
Larry Finger0c817332010-12-08 11:12:31 -0600552
553struct tx_desc_92c {
554 u32 pktsize:16;
555 u32 offset:8;
556 u32 bmc:1;
557 u32 htc:1;
558 u32 lastseg:1;
559 u32 firstseg:1;
560 u32 linip:1;
561 u32 noacm:1;
562 u32 gf:1;
563 u32 own:1;
564
565 u32 macid:5;
566 u32 agg_en:1;
567 u32 bk:1;
568 u32 rdg_en:1;
569 u32 queuesel:5;
570 u32 rd_nav_ext:1;
571 u32 lsig_txop_en:1;
572 u32 pifs:1;
573 u32 rateid:4;
574 u32 nav_usehdr:1;
575 u32 en_descid:1;
576 u32 sectype:2;
577 u32 pktoffset:8;
578
579 u32 rts_rc:6;
580 u32 data_rc:6;
581 u32 rsvd0:2;
582 u32 bar_retryht:2;
583 u32 rsvd1:1;
584 u32 morefrag:1;
585 u32 raw:1;
586 u32 ccx:1;
587 u32 ampdudensity:3;
588 u32 rsvd2:1;
589 u32 ant_sela:1;
590 u32 ant_selb:1;
591 u32 txant_cck:2;
592 u32 txant_l:2;
593 u32 txant_ht:2;
594
595 u32 nextheadpage:8;
596 u32 tailpage:8;
597 u32 seq:12;
598 u32 pktid:4;
599
600 u32 rtsrate:5;
601 u32 apdcfe:1;
602 u32 qos:1;
603 u32 hwseq_enable:1;
604 u32 userrate:1;
605 u32 dis_rtsfb:1;
606 u32 dis_datafb:1;
607 u32 cts2self:1;
608 u32 rts_en:1;
609 u32 hwrts_en:1;
610 u32 portid:1;
611 u32 rsvd3:3;
612 u32 waitdcts:1;
613 u32 cts2ap_en:1;
614 u32 txsc:2;
615 u32 stbc:2;
616 u32 txshort:1;
617 u32 txbw:1;
618 u32 rtsshort:1;
619 u32 rtsbw:1;
620 u32 rtssc:2;
621 u32 rtsstbc:2;
622
623 u32 txrate:6;
624 u32 shortgi:1;
625 u32 ccxt:1;
626 u32 txrate_fb_lmt:5;
627 u32 rtsrate_fb_lmt:4;
628 u32 retrylmt_en:1;
629 u32 txretrylmt:6;
630 u32 usb_txaggnum:8;
631
632 u32 txagca:5;
633 u32 txagcb:5;
634 u32 usemaxlen:1;
635 u32 maxaggnum:5;
636 u32 mcsg1maxlen:4;
637 u32 mcsg2maxlen:4;
638 u32 mcsg3maxlen:4;
639 u32 mcs7sgimaxlen:4;
640
641 u32 txbuffersize:16;
642 u32 mcsg4maxlen:4;
643 u32 mcsg5maxlen:4;
644 u32 mcsg6maxlen:4;
645 u32 mcsg15sgimaxlen:4;
646
647 u32 txbuffaddr;
648 u32 txbufferaddr64;
649 u32 nextdescaddress;
650 u32 nextdescaddress64;
651
652 u32 reserve_pass_pcie_mm_limit[4];
John W. Linvillee1374782010-12-16 09:20:16 -0500653} __packed;
Larry Finger0c817332010-12-08 11:12:31 -0600654
655struct rx_desc_92c {
656 u32 length:14;
657 u32 crc32:1;
658 u32 icverror:1;
659 u32 drv_infosize:4;
660 u32 security:3;
661 u32 qos:1;
662 u32 shift:2;
663 u32 phystatus:1;
664 u32 swdec:1;
665 u32 lastseg:1;
666 u32 firstseg:1;
667 u32 eor:1;
668 u32 own:1;
669
670 u32 macid:5;
671 u32 tid:4;
672 u32 hwrsvd:5;
673 u32 paggr:1;
674 u32 faggr:1;
675 u32 a1_fit:4;
676 u32 a2_fit:4;
677 u32 pam:1;
678 u32 pwr:1;
679 u32 moredata:1;
680 u32 morefrag:1;
681 u32 type:2;
682 u32 mc:1;
683 u32 bc:1;
684
685 u32 seq:12;
686 u32 frag:4;
687 u32 nextpktlen:14;
688 u32 nextind:1;
689 u32 rsvd:1;
690
691 u32 rxmcs:6;
692 u32 rxht:1;
693 u32 amsdu:1;
694 u32 splcp:1;
695 u32 bandwidth:1;
696 u32 htc:1;
697 u32 tcpchk_rpt:1;
698 u32 ipcchk_rpt:1;
699 u32 tcpchk_valid:1;
700 u32 hwpcerr:1;
701 u32 hwpcind:1;
702 u32 iv0:16;
703
704 u32 iv1;
705
706 u32 tsfl;
707
708 u32 bufferaddress;
709 u32 bufferaddress64;
710
John W. Linvillee1374782010-12-16 09:20:16 -0500711} __packed;
Larry Finger0c817332010-12-08 11:12:31 -0600712
713void rtl92ce_tx_fill_desc(struct ieee80211_hw *hw,
714 struct ieee80211_hdr *hdr,
715 u8 *pdesc, struct ieee80211_tx_info *info,
Chaoming_Li76c34f92011-04-25 12:54:05 -0500716 struct sk_buff *skb, u8 hw_queue,
717 struct rtl_tcb_desc *ptcb_desc);
Larry Finger0c817332010-12-08 11:12:31 -0600718bool rtl92ce_rx_query_desc(struct ieee80211_hw *hw,
719 struct rtl_stats *stats,
720 struct ieee80211_rx_status *rx_status,
721 u8 *pdesc, struct sk_buff *skb);
722void rtl92ce_set_desc(u8 *pdesc, bool istx, u8 desc_name, u8 *val);
723u32 rtl92ce_get_desc(u8 *pdesc, bool istx, u8 desc_name);
Chaoming_Li76c34f92011-04-25 12:54:05 -0500724void rtl92ce_tx_polling(struct ieee80211_hw *hw, u8 hw_queue);
Larry Finger0c817332010-12-08 11:12:31 -0600725void rtl92ce_tx_fill_cmddesc(struct ieee80211_hw *hw, u8 *pdesc,
726 bool b_firstseg, bool b_lastseg,
727 struct sk_buff *skb);
Larry Finger0c817332010-12-08 11:12:31 -0600728#endif