Commit | Line | Data |
---|---|---|
1b4a7c03 LJ |
1 | /* |
2 | * Copyright (C) 2020, Broadcom. | |
3 | * | |
4 | * Unless you and Broadcom execute a separate written software license | |
5 | * agreement governing use of this software, this software is licensed to you | |
6 | * under the terms of the GNU General Public License version 2 (the "GPL"), | |
7 | * available at http://www.broadcom.com/licenses/GPLv2.php, with the | |
8 | * following added to such license: | |
9 | * | |
10 | * As a special exception, the copyright holders of this software give you | |
11 | * permission to link this software with independent modules, and to copy and | |
12 | * distribute the resulting executable under terms of your choice, provided that | |
13 | * you also meet, for each linked independent module, the terms and conditions of | |
14 | * the license of that module. An independent module is a module which is not | |
15 | * derived from this software. The special exception does not apply to any | |
16 | * modifications of the software. | |
17 | * | |
18 | * | |
19 | * <<Broadcom-WL-IPTag/Dual:>> | |
20 | * | |
21 | */ | |
22 | ||
23 | /** WL flow control for PROP_TXSTATUS. Related to host AMPDU reordering. */ | |
24 | ||
25 | #ifndef __wlfc_proto_definitions_h__ | |
26 | #define __wlfc_proto_definitions_h__ | |
27 | ||
28 | /* Use TLV to convey WLFC information. | |
29 | --------------------------------------------------------------------------- | |
30 | | Type | Len | value | Description | |
31 | --------------------------------------------------------------------------- | |
32 | | 1 | 1 | (handle) | MAC OPEN | |
33 | --------------------------------------------------------------------------- | |
34 | | 2 | 1 | (handle) | MAC CLOSE | |
35 | --------------------------------------------------------------------------- | |
36 | | 3 | 2 | (count, handle, prec_bmp)| Set the credit depth for a MAC dstn | |
37 | --------------------------------------------------------------------------- | |
38 | | 4 | 4+ | see pkttag comments | TXSTATUS | |
39 | | | 12 | TX status & timestamps | Present only when pkt timestamp is enabled | |
40 | --------------------------------------------------------------------------- | |
41 | | 5 | 4 | see pkttag comments | PKKTTAG [host->firmware] | |
42 | --------------------------------------------------------------------------- | |
43 | | 6 | 8 | (handle, ifid, MAC) | MAC ADD | |
44 | --------------------------------------------------------------------------- | |
45 | | 7 | 8 | (handle, ifid, MAC) | MAC DEL | |
46 | --------------------------------------------------------------------------- | |
47 | | 8 | 1 | (rssi) | RSSI - RSSI value for the packet. | |
48 | --------------------------------------------------------------------------- | |
49 | | 9 | 1 | (interface ID) | Interface OPEN | |
50 | --------------------------------------------------------------------------- | |
51 | | 10 | 1 | (interface ID) | Interface CLOSE | |
52 | --------------------------------------------------------------------------- | |
53 | | 11 | 8 | fifo credit returns map | FIFO credits back to the host | |
54 | | | | | | |
55 | | | | | -------------------------------------- | |
56 | | | | | | ac0 | ac1 | ac2 | ac3 | bcmc | atim | | |
57 | | | | | -------------------------------------- | |
58 | | | | | | |
59 | --------------------------------------------------------------------------- | |
60 | | 12 | 2 | MAC handle, | Host provides a bitmap of pending | |
61 | | | | AC[0-3] traffic bitmap | unicast traffic for MAC-handle dstn. | |
62 | | | | | [host->firmware] | |
63 | --------------------------------------------------------------------------- | |
64 | | 13 | 3 | (count, handle, prec_bmp)| One time request for packet to a specific | |
65 | | | | | MAC destination. | |
66 | --------------------------------------------------------------------------- | |
67 | | 15 | 12 | (pkttag, timestamps) | Send TX timestamp at reception from host | |
68 | --------------------------------------------------------------------------- | |
69 | | 16 | 12 | (pkttag, timestamps) | Send WLAN RX timestamp along with RX frame | |
70 | --------------------------------------------------------------------------- | |
71 | | 255 | N/A | N/A | FILLER - This is a special type | |
72 | | | | | that has no length or value. | |
73 | | | | | Typically used for padding. | |
74 | --------------------------------------------------------------------------- | |
75 | */ | |
76 | ||
77 | typedef enum { | |
78 | WLFC_CTL_TYPE_MAC_OPEN = 1, | |
79 | WLFC_CTL_TYPE_MAC_CLOSE = 2, | |
80 | WLFC_CTL_TYPE_MAC_REQUEST_CREDIT = 3, | |
81 | WLFC_CTL_TYPE_TXSTATUS = 4, | |
82 | WLFC_CTL_TYPE_PKTTAG = 5, /** host<->dongle */ | |
83 | ||
84 | WLFC_CTL_TYPE_MACDESC_ADD = 6, | |
85 | WLFC_CTL_TYPE_MACDESC_DEL = 7, | |
86 | WLFC_CTL_TYPE_RSSI = 8, | |
87 | ||
88 | WLFC_CTL_TYPE_INTERFACE_OPEN = 9, | |
89 | WLFC_CTL_TYPE_INTERFACE_CLOSE = 10, | |
90 | ||
91 | WLFC_CTL_TYPE_FIFO_CREDITBACK = 11, | |
92 | ||
93 | WLFC_CTL_TYPE_PENDING_TRAFFIC_BMP = 12, /** host->dongle */ | |
94 | WLFC_CTL_TYPE_MAC_REQUEST_PACKET = 13, | |
95 | WLFC_CTL_TYPE_HOST_REORDER_RXPKTS = 14, | |
96 | ||
97 | WLFC_CTL_TYPE_TX_ENTRY_STAMP = 15, | |
98 | WLFC_CTL_TYPE_RX_STAMP = 16, | |
99 | ||
100 | WLFC_CTL_TYPE_UPD_FLR_FETCH = 17, /* PCIE_FLOWCTL: Update Flowring Fetch */ | |
101 | ||
102 | WLFC_CTL_TYPE_TRANS_ID = 18, | |
103 | WLFC_CTL_TYPE_COMP_TXSTATUS = 19, | |
104 | ||
105 | WLFC_CTL_TYPE_TID_OPEN = 20, | |
106 | WLFC_CTL_TYPE_TID_CLOSE = 21, | |
107 | WLFC_CTL_TYPE_UPD_FLR_WEIGHT = 22, /* WLATF_DONGLE */ | |
108 | WLFC_CTL_TYPE_ENAB_FFSCH = 23, /* WLATF_DONGLE */ | |
109 | ||
110 | WLFC_CTL_TYPE_UPDATE_FLAGS = 24, /* clear the flags set in flowring */ | |
111 | WLFC_CTL_TYPE_CLEAR_SUPPR = 25, /* free the supression info in the flowring */ | |
112 | ||
113 | WLFC_CTL_TYPE_FLOWID_OPEN = 26, | |
114 | WLFC_CTL_TYPE_FLOWID_CLOSE = 27, | |
115 | ||
116 | WLFC_CTL_TYPE_PENDING_TX_PKTS = 28, /* Get the outstandinding packets in host | |
117 | * flowring for the given interface. | |
118 | */ | |
119 | WLFC_CTL_TYPE_UPD_SCB_RATESEL_CHANGE= 29, /* Update flow's max rate dynamically */ | |
120 | WLFC_CTL_TYPE_AMSDU_STATE = 30, /* Update flow's AMSDU state (Enabled/Disabled) */ | |
121 | WLFC_CTL_TYPE_FILLER = 255 | |
122 | } wlfc_ctl_type_t; | |
123 | ||
124 | #define WLFC_CTL_VALUE_LEN_FLOWID 2 | |
125 | ||
126 | #define WLFC_CTL_VALUE_LEN_MACDESC 8 /** handle, interface, MAC */ | |
127 | ||
128 | #define WLFC_CTL_VALUE_LEN_MAC 1 /** MAC-handle */ | |
129 | #define WLFC_CTL_VALUE_LEN_RSSI 1 | |
130 | ||
131 | #define WLFC_CTL_VALUE_LEN_INTERFACE 1 | |
132 | #define WLFC_CTL_VALUE_LEN_PENDING_TRAFFIC_BMP 2 | |
133 | ||
134 | #define WLFC_CTL_VALUE_LEN_TXSTATUS 4 | |
135 | #define WLFC_CTL_VALUE_LEN_PKTTAG 4 | |
136 | #define WLFC_CTL_VALUE_LEN_TIMESTAMP 12 /** 4-byte rate info + 2 TSF */ | |
137 | ||
138 | #define WLFC_CTL_VALUE_LEN_SEQ 2 | |
139 | #define WLFC_CTL_VALUE_LEN_TID 2 /* interface index, TID */ | |
140 | ||
141 | /* Reset the flags set for the corresponding flowring of the SCB which is de-inited */ | |
142 | /* FLOW_RING_FLAG_LAST_TIM | FLOW_RING_FLAG_INFORM_PKTPEND | FLOW_RING_FLAG_PKT_REQ */ | |
143 | #define WLFC_RESET_ALL_FLAGS 0 | |
144 | #define WLFC_CTL_VALUE_LEN_FLAGS 7 /** flags, MAC */ | |
145 | ||
146 | /* free the data stored to be used for suppressed packets in future */ | |
147 | #define WLFC_CTL_VALUE_LEN_SUPR 8 /** ifindex, tid, MAC */ | |
148 | ||
149 | #define WLFC_CTL_VALUE_LEN_SCB_RATESEL_CHANGE 7 /* ifindex, MAC */ | |
150 | /* enough space to host all 4 ACs, bc/mc and atim fifo credit */ | |
151 | #define WLFC_CTL_VALUE_LEN_FIFO_CREDITBACK 6 | |
152 | ||
153 | #define WLFC_CTL_VALUE_LEN_REQUEST_CREDIT 3 /* credit, MAC-handle, prec_bitmap */ | |
154 | #define WLFC_CTL_VALUE_LEN_REQUEST_PACKET 3 /* credit, MAC-handle, prec_bitmap */ | |
155 | ||
156 | /* | |
157 | WLFC packet identifier: b[31:0] (WLFC_CTL_TYPE_PKTTAG) | |
158 | ||
159 | Generation : b[31] => generation number for this packet [host->fw] | |
160 | OR, current generation number [fw->host] | |
161 | Flags : b[30:27] => command, status flags | |
162 | FIFO-AC : b[26:24] => AC-FIFO id | |
163 | ||
164 | h-slot : b[23:8] => hanger-slot | |
165 | freerun : b[7:0] => A free running counter? | |
166 | ||
167 | As far as the firmware is concerned, host generated b[23:0] should be just | |
168 | reflected back on txstatus. | |
169 | */ | |
170 | ||
171 | #ifndef WLFC_PKTFLAG_COMPAT | |
172 | #define WLFC_PKTFLAG_PKTFROMHOST 0x01 | |
173 | #define WLFC_PKTFLAG_PKT_REQUESTED 0x02 | |
174 | #define WLFC_PKTFLAG_PKT_SENDTOHOST 0x04 | |
175 | #define WLFC_PKTFLAG_PKT_FLUSHED 0x08 | |
176 | #else | |
177 | #define WLFC_PKTFLAG_PKTFROMHOST_MASK 0x01 | |
178 | #define WLFC_PKTFLAG_PKT_REQUESTED_MASK 0x02 | |
179 | #define WLFC_PKTFLAG_PKT_SENDTOHOST_MASK 0x04 | |
180 | #define WLFC_PKTFLAG_PKT_FLUSHED_MASK 0x08 | |
181 | #endif /* WLFC_PKTFLAG_COMPAT */ | |
182 | ||
183 | #define WL_TXSTATUS_STATUS_MASK 0xff /* allow 8 bits */ | |
184 | #define WL_TXSTATUS_STATUS_SHIFT 24 | |
185 | ||
186 | #define WL_TXSTATUS_SET_STATUS(x, status) ((x) = \ | |
187 | ((x) & ~(WL_TXSTATUS_STATUS_MASK << WL_TXSTATUS_STATUS_SHIFT)) | \ | |
188 | (((status) & WL_TXSTATUS_STATUS_MASK) << WL_TXSTATUS_STATUS_SHIFT)) | |
189 | #define WL_TXSTATUS_GET_STATUS(x) (((x) >> WL_TXSTATUS_STATUS_SHIFT) & \ | |
190 | WL_TXSTATUS_STATUS_MASK) | |
191 | ||
192 | /** | |
193 | * Bit 31 of the 32-bit packet tag is defined as 'generation ID'. It is set by the host to the | |
194 | * "current" generation, and by the firmware to the "expected" generation, toggling on suppress. The | |
195 | * firmware accepts a packet when the generation matches; on reset (startup) both "current" and | |
196 | * "expected" are set to 0. | |
197 | */ | |
198 | #define WL_TXSTATUS_GENERATION_MASK 1 /* allow 1 bit */ | |
199 | #define WL_TXSTATUS_GENERATION_SHIFT 31 | |
200 | ||
201 | #define WL_TXSTATUS_SET_GENERATION(x, gen) ((x) = \ | |
202 | ((x) & ~(WL_TXSTATUS_GENERATION_MASK << WL_TXSTATUS_GENERATION_SHIFT)) | \ | |
203 | (((gen) & WL_TXSTATUS_GENERATION_MASK) << WL_TXSTATUS_GENERATION_SHIFT)) | |
204 | ||
205 | #define WL_TXSTATUS_GET_GENERATION(x) (((x) >> WL_TXSTATUS_GENERATION_SHIFT) & \ | |
206 | WL_TXSTATUS_GENERATION_MASK) | |
207 | ||
208 | #define WL_TXSTATUS_FLAGS_MASK 0xf /* allow 4 bits only */ | |
209 | #define WL_TXSTATUS_FLAGS_SHIFT 27 | |
210 | ||
211 | #define WL_TXSTATUS_SET_FLAGS(x, flags) ((x) = \ | |
212 | ((x) & ~(WL_TXSTATUS_FLAGS_MASK << WL_TXSTATUS_FLAGS_SHIFT)) | \ | |
213 | (((flags) & WL_TXSTATUS_FLAGS_MASK) << WL_TXSTATUS_FLAGS_SHIFT)) | |
214 | #define WL_TXSTATUS_GET_FLAGS(x) (((x) >> WL_TXSTATUS_FLAGS_SHIFT) & \ | |
215 | WL_TXSTATUS_FLAGS_MASK) | |
216 | #define WL_TXSTATUS_CLEAR_FLAGS(x, flags) ((x) = \ | |
217 | ((x) & ~(((flags) & WL_TXSTATUS_FLAGS_MASK) << WL_TXSTATUS_FLAGS_SHIFT))) | |
218 | ||
219 | #define WL_TXSTATUS_FIFO_MASK 0x7 /* allow 3 bits for FIFO ID */ | |
220 | #define WL_TXSTATUS_FIFO_SHIFT 24 | |
221 | ||
222 | #define WL_TXSTATUS_SET_FIFO(x, flags) ((x) = \ | |
223 | ((x) & ~(WL_TXSTATUS_FIFO_MASK << WL_TXSTATUS_FIFO_SHIFT)) | \ | |
224 | (((flags) & WL_TXSTATUS_FIFO_MASK) << WL_TXSTATUS_FIFO_SHIFT)) | |
225 | #define WL_TXSTATUS_GET_FIFO(x) (((x) >> WL_TXSTATUS_FIFO_SHIFT) & WL_TXSTATUS_FIFO_MASK) | |
226 | ||
227 | #define WL_TXSTATUS_PKTID_MASK 0xffffff /* allow 24 bits */ | |
228 | #define WL_TXSTATUS_SET_PKTID(x, num) ((x) = \ | |
229 | ((x) & ~WL_TXSTATUS_PKTID_MASK) | (num)) | |
230 | #define WL_TXSTATUS_GET_PKTID(x) ((x) & WL_TXSTATUS_PKTID_MASK) | |
231 | ||
232 | #define WL_TXSTATUS_HSLOT_MASK 0xffff /* allow 16 bits */ | |
233 | #define WL_TXSTATUS_HSLOT_SHIFT 8 | |
234 | ||
235 | #define WL_TXSTATUS_SET_HSLOT(x, hslot) ((x) = \ | |
236 | ((x) & ~(WL_TXSTATUS_HSLOT_MASK << WL_TXSTATUS_HSLOT_SHIFT)) | \ | |
237 | (((hslot) & WL_TXSTATUS_HSLOT_MASK) << WL_TXSTATUS_HSLOT_SHIFT)) | |
238 | #define WL_TXSTATUS_GET_HSLOT(x) (((x) >> WL_TXSTATUS_HSLOT_SHIFT)& \ | |
239 | WL_TXSTATUS_HSLOT_MASK) | |
240 | ||
241 | #define WL_TXSTATUS_FREERUNCTR_MASK 0xff /* allow 8 bits */ | |
242 | ||
243 | #define WL_TXSTATUS_SET_FREERUNCTR(x, ctr) ((x) = \ | |
244 | ((x) & ~(WL_TXSTATUS_FREERUNCTR_MASK)) | \ | |
245 | ((ctr) & WL_TXSTATUS_FREERUNCTR_MASK)) | |
246 | #define WL_TXSTATUS_GET_FREERUNCTR(x) ((x)& WL_TXSTATUS_FREERUNCTR_MASK) | |
247 | ||
248 | /* AMSDU part of d11 seq number */ | |
249 | #define WL_SEQ_AMSDU_MASK 0x1 /* allow 1 bit */ | |
250 | #define WL_SEQ_AMSDU_SHIFT 14 | |
251 | #define WL_SEQ_SET_AMSDU(x, val) ((x) = \ | |
252 | ((x) & ~(WL_SEQ_AMSDU_MASK << WL_SEQ_AMSDU_SHIFT)) | \ | |
253 | (((val) & WL_SEQ_AMSDU_MASK) << WL_SEQ_AMSDU_SHIFT)) /**< sets a single AMSDU bit */ | |
254 | /** returns TRUE if ring item is AMSDU (seq = d11 seq nr) */ | |
255 | #define WL_SEQ_IS_AMSDU(x) (((x) >> WL_SEQ_AMSDU_SHIFT) & \ | |
256 | WL_SEQ_AMSDU_MASK) | |
257 | ||
258 | /* indicates last_suppr_seq is valid */ | |
259 | #define WL_SEQ_VALIDSUPPR_MASK 0x1 /* allow 1 bit */ | |
260 | #define WL_SEQ_VALIDSUPPR_SHIFT 12 | |
261 | #define WL_SEQ_SET_VALIDSUPPR(x, val) ((x) = \ | |
262 | ((x) & ~(WL_SEQ_VALIDSUPPR_MASK << WL_SEQ_VALIDSUPPR_SHIFT)) | \ | |
263 | (((val) & WL_SEQ_VALIDSUPPR_MASK) << WL_SEQ_VALIDSUPPR_SHIFT)) | |
264 | #define WL_SEQ_GET_VALIDSUPPR(x) (((x) >> WL_SEQ_VALIDSUPPR_SHIFT) & \ | |
265 | WL_SEQ_VALIDSUPPR_MASK) | |
266 | ||
267 | #define WL_SEQ_FROMFW_MASK 0x1 /* allow 1 bit */ | |
268 | #define WL_SEQ_FROMFW_SHIFT 13 | |
269 | #define WL_SEQ_SET_FROMFW(x, val) ((x) = \ | |
270 | ((x) & ~(WL_SEQ_FROMFW_MASK << WL_SEQ_FROMFW_SHIFT)) | \ | |
271 | (((val) & WL_SEQ_FROMFW_MASK) << WL_SEQ_FROMFW_SHIFT)) | |
272 | /** Set when firmware assigns D11 sequence number to packet */ | |
273 | #define SET_WL_HAS_ASSIGNED_SEQ(x) WL_SEQ_SET_FROMFW((x), 1) | |
274 | ||
275 | /** returns TRUE if packet has been assigned a d11 seq number by the WL firmware layer */ | |
276 | #define GET_WL_HAS_ASSIGNED_SEQ(x) (((x) >> WL_SEQ_FROMFW_SHIFT) & WL_SEQ_FROMFW_MASK) | |
277 | ||
278 | #ifdef WLFC_PKTFLAG_COMPAT | |
279 | /* Helper macros for WLFC pktflags */ | |
280 | #define WLFC_PKTFLAG_PKTFROMHOST(p) \ | |
281 | (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKTFROMHOST_MASK) | |
282 | #define WLFC_PKTFLAG_PKT_REQUESTED(p) \ | |
283 | (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKT_REQUESTED_MASK) | |
284 | #define WLFC_PKTFLAG_PKT_SENDTOHOST(p) \ | |
285 | (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKT_SENDTOHOST_MASK) | |
286 | #define WLFC_PKTFLAG_PKT_FLUSHED(p) \ | |
287 | (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKT_FLUSHED_MASK) | |
288 | #endif /* WLFC_PKTFLAG_COMPAT */ | |
289 | ||
290 | /** | |
291 | * Proptxstatus related. | |
292 | * | |
293 | * When a packet is suppressed by WL or the D11 core, the packet has to be retried. Assigning | |
294 | * a new d11 sequence number for the packet when retrying would cause the peer to be unable to | |
295 | * reorder the packets within an AMPDU. So, suppressed packet from bus layer (DHD for SDIO and | |
296 | * pciedev for PCIE) is re-using d11 seq number, so FW should not assign a new one. | |
297 | */ | |
298 | #define WL_SEQ_FROMDRV_MASK 0x1 /* allow 1 bit */ | |
299 | #define WL_SEQ_FROMDRV_SHIFT 12 | |
300 | ||
301 | /** | |
302 | * Proptxstatus, host or fw PCIe layer requests WL layer to reuse d11 seq no. Bit is reset by WL | |
303 | * subsystem when it reuses the seq number. | |
304 | */ | |
305 | #define WL_SEQ_SET_REUSE(x, val) ((x) = \ | |
306 | ((x) & ~(WL_SEQ_FROMDRV_MASK << WL_SEQ_FROMDRV_SHIFT)) | \ | |
307 | (((val) & WL_SEQ_FROMDRV_MASK) << WL_SEQ_FROMDRV_SHIFT)) | |
308 | #define SET_WL_TO_REUSE_SEQ(x) WL_SEQ_SET_REUSE((x), 1) | |
309 | #define RESET_WL_TO_REUSE_SEQ(x) WL_SEQ_SET_REUSE((x), 0) | |
310 | ||
311 | /** Proptxstatus, related to reuse of d11 seq numbers when retransmitting */ | |
312 | #define IS_WL_TO_REUSE_SEQ(x) (((x) >> WL_SEQ_FROMDRV_SHIFT) & \ | |
313 | WL_SEQ_FROMDRV_MASK) | |
314 | ||
315 | #define WL_SEQ_NUM_MASK 0xfff /* allow 12 bit */ | |
316 | #define WL_SEQ_NUM_SHIFT 0 | |
317 | /** Proptxstatus, sets d11seq no in pkt tag, related to reuse of d11seq no when retransmitting */ | |
318 | #define WL_SEQ_SET_NUM(x, val) ((x) = \ | |
319 | ((x) & ~(WL_SEQ_NUM_MASK << WL_SEQ_NUM_SHIFT)) | \ | |
320 | (((val) & WL_SEQ_NUM_MASK) << WL_SEQ_NUM_SHIFT)) | |
321 | /** Proptxstatus, gets d11seq no from pkt tag, related to reuse of d11seq no when retransmitting */ | |
322 | #define WL_SEQ_GET_NUM(x) (((x) >> WL_SEQ_NUM_SHIFT) & \ | |
323 | WL_SEQ_NUM_MASK) | |
324 | ||
325 | #define WL_SEQ_AMSDU_SUPPR_MASK ((WL_SEQ_FROMDRV_MASK << WL_SEQ_FROMDRV_SHIFT) | \ | |
326 | (WL_SEQ_AMSDU_MASK << WL_SEQ_AMSDU_SHIFT) | \ | |
327 | (WL_SEQ_NUM_MASK << WL_SEQ_NUM_SHIFT)) | |
328 | ||
329 | /* 32 STA should be enough??, 6 bits; Must be power of 2 */ | |
330 | #define WLFC_MAC_DESC_TABLE_SIZE 32 | |
331 | #define WLFC_MAX_IFNUM 16 | |
332 | #define WLFC_MAC_DESC_ID_INVALID 0xff | |
333 | ||
334 | /* b[7:5] -reuse guard, b[4:0] -value */ | |
335 | #define WLFC_MAC_DESC_GET_LOOKUP_INDEX(x) ((x) & 0x1f) | |
336 | ||
337 | #define WLFC_PKTFLAG_SET_PKTREQUESTED(x) (x) |= \ | |
338 | (WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT) | |
339 | ||
340 | #define WLFC_PKTFLAG_CLR_PKTREQUESTED(x) (x) &= \ | |
341 | ~(WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT) | |
342 | ||
343 | #define WLFC_MAX_PENDING_DATALEN 120 | |
344 | ||
345 | /* host is free to discard the packet */ | |
346 | #define WLFC_CTL_PKTFLAG_DISCARD 0 | |
347 | /* D11 suppressed a packet */ | |
348 | #define WLFC_CTL_PKTFLAG_D11SUPPRESS 1 | |
349 | /* WL firmware suppressed a packet because MAC is | |
350 | already in PSMode (short time window) | |
351 | */ | |
352 | #define WLFC_CTL_PKTFLAG_WLSUPPRESS 2 | |
353 | /* Firmware tossed this packet */ | |
354 | #define WLFC_CTL_PKTFLAG_TOSSED_BYWLC 3 | |
355 | /* Firmware tossed after retries */ | |
356 | #define WLFC_CTL_PKTFLAG_DISCARD_NOACK 4 | |
357 | /* Firmware wrongly reported suppressed previously,now fixing to acked */ | |
358 | #define WLFC_CTL_PKTFLAG_SUPPRESS_ACKED 5 | |
359 | /* Firmware send this packet expired, lifetime expiration */ | |
360 | #define WLFC_CTL_PKTFLAG_EXPIRED 6 | |
361 | /* Firmware drop this packet for any other reason */ | |
362 | #define WLFC_CTL_PKTFLAG_DROPPED 7 | |
363 | /* Firmware free this packet */ | |
364 | #define WLFC_CTL_PKTFLAG_MKTFREE 8 | |
365 | /* Firmware dropped the frame after suppress retries reached max */ | |
366 | #define WLFC_CTL_PKTFLAG_MAX_SUP_RETR 9 | |
367 | ||
368 | /* Firmware forced packet lifetime expiry */ | |
369 | #define WLFC_CTL_PKTFLAG_FORCED_EXPIRED 10 | |
370 | ||
371 | #define WLFC_CTL_PKTFLAG_MASK (0x0f) /* For 4-bit mask with one extra bit */ | |
372 | ||
373 | #if defined(PROP_TXSTATUS_DEBUG) && !defined(BINCMP) | |
374 | #define WLFC_DBGMESG(x) printf x | |
375 | /* wlfc-breadcrumb */ | |
376 | #define WLFC_BREADCRUMB(x) do {if ((x) == NULL) \ | |
377 | {printf("WLFC :%d:caller:%p\n", \ | |
378 | __LINE__, CALL_SITE);}} while (0) | |
379 | #define WLFC_WHEREIS(s) printf("WLFC: at %d, %s\n", __LINE__, (s)) | |
380 | #else | |
381 | #define WLFC_DBGMESG(x) | |
382 | #define WLFC_BREADCRUMB(x) | |
383 | #define WLFC_WHEREIS(s) | |
384 | #endif /* PROP_TXSTATUS_DEBUG && !BINCMP */ | |
385 | ||
386 | /* AMPDU host reorder packet flags */ | |
387 | #define WLHOST_REORDERDATA_MAXFLOWS 256 | |
388 | #define WLHOST_REORDERDATA_LEN 10 | |
389 | #define WLHOST_REORDERDATA_TOTLEN (WLHOST_REORDERDATA_LEN + 1 + 1) /* +tag +len */ | |
390 | ||
391 | #define WLHOST_REORDERDATA_FLOWID_OFFSET 0 | |
392 | #define WLHOST_REORDERDATA_MAXIDX_OFFSET 2 | |
393 | #define WLHOST_REORDERDATA_FLAGS_OFFSET 4 | |
394 | #define WLHOST_REORDERDATA_CURIDX_OFFSET 6 | |
395 | #define WLHOST_REORDERDATA_EXPIDX_OFFSET 8 | |
396 | ||
397 | #define WLHOST_REORDERDATA_DEL_FLOW 0x01 | |
398 | #define WLHOST_REORDERDATA_FLUSH_ALL 0x02 | |
399 | #define WLHOST_REORDERDATA_CURIDX_VALID 0x04 | |
400 | #define WLHOST_REORDERDATA_EXPIDX_VALID 0x08 | |
401 | #define WLHOST_REORDERDATA_NEW_HOLE 0x10 | |
402 | ||
403 | /* transaction id data len byte 0: rsvd, byte 1: seqnumber, byte 2-5 will be used for timestampe */ | |
404 | #define WLFC_CTL_TRANS_ID_LEN 6 | |
405 | #define WLFC_TYPE_TRANS_ID_LEN 6 | |
406 | ||
407 | #define WLFC_MODE_HANGER 1 /* use hanger */ | |
408 | #define WLFC_MODE_AFQ 2 /* use afq (At Firmware Queue) */ | |
409 | #define WLFC_IS_OLD_DEF(x) ((x & 1) || (x & 2)) | |
410 | ||
411 | #define WLFC_MODE_AFQ_SHIFT 2 /* afq bit */ | |
412 | #define WLFC_SET_AFQ(x, val) ((x) = \ | |
413 | ((x) & ~(1 << WLFC_MODE_AFQ_SHIFT)) | \ | |
414 | (((val) & 1) << WLFC_MODE_AFQ_SHIFT)) | |
415 | /** returns TRUE if firmware supports 'at firmware queue' feature */ | |
416 | #define WLFC_GET_AFQ(x) (((x) >> WLFC_MODE_AFQ_SHIFT) & 1) | |
417 | ||
418 | #define WLFC_MODE_REUSESEQ_SHIFT 3 /* seq reuse bit */ | |
419 | #define WLFC_SET_REUSESEQ(x, val) ((x) = \ | |
420 | ((x) & ~(1 << WLFC_MODE_REUSESEQ_SHIFT)) | \ | |
421 | (((val) & 1) << WLFC_MODE_REUSESEQ_SHIFT)) | |
422 | ||
423 | /** returns TRUE if 'd11 sequence reuse' has been agreed upon between host and dongle */ | |
424 | #if defined(BCMPCIEDEV_ENABLED) && !defined(ROM_ENAB_RUNTIME_CHECK) | |
425 | /* GET_REUSESEQ is always TRUE in pciedev */ | |
426 | #define WLFC_GET_REUSESEQ(x) (TRUE) | |
427 | #else | |
428 | #define WLFC_GET_REUSESEQ(x) (((x) >> WLFC_MODE_REUSESEQ_SHIFT) & 1) | |
429 | #endif /* defined(BCMPCIEDEV_ENABLED) && !defined(ROM_ENAB_RUNTIME_CHECK) */ | |
430 | ||
431 | #define WLFC_MODE_REORDERSUPP_SHIFT 4 /* host reorder suppress pkt bit */ | |
432 | #define WLFC_SET_REORDERSUPP(x, val) ((x) = \ | |
433 | ((x) & ~(1 << WLFC_MODE_REORDERSUPP_SHIFT)) | \ | |
434 | (((val) & 1) << WLFC_MODE_REORDERSUPP_SHIFT)) | |
435 | /** returns TRUE if 'reorder suppress' has been agreed upon between host and dongle */ | |
436 | #define WLFC_GET_REORDERSUPP(x) (((x) >> WLFC_MODE_REORDERSUPP_SHIFT) & 1) | |
437 | ||
438 | #define FLOW_RING_CREATE 1u | |
439 | #define FLOW_RING_DELETE 2u | |
440 | #define FLOW_RING_FLUSH 3u | |
441 | #define FLOW_RING_OPEN 4u | |
442 | #define FLOW_RING_CLOSED 5u | |
443 | #define FLOW_RING_FLUSHED 6u | |
444 | #define FLOW_RING_TIM_SET 7u | |
445 | #define FLOW_RING_TIM_RESET 8u | |
446 | #define FLOW_RING_FLUSH_TXFIFO 9u | |
447 | #define FLOW_RING_GET_PKT_MAX 10u | |
448 | #define FLOW_RING_RESET_WEIGHT 11u | |
449 | #define FLOW_RING_UPD_PRIOMAP 12u | |
450 | #define FLOW_RING_HP2P_CREATE 13u | |
451 | #define FLOW_RING_HP2P_DELETE 14u | |
452 | #define FLOW_RING_GET_BUFFERED_TIME 15u | |
453 | #define FLOW_RING_HP2P_TXQ_STRT 16u | |
454 | #define FLOW_RING_HP2P_TXQ_STOP 17u | |
455 | ||
456 | /* bit 7, indicating if is TID(1) or AC(0) mapped info in tid field) */ | |
457 | #define PCIEDEV_IS_AC_TID_MAP_MASK 0x80 | |
458 | ||
459 | #define WLFC_PCIEDEV_AC_PRIO_MAP 0 | |
460 | #define WLFC_PCIEDEV_TID_PRIO_MAP 1 | |
461 | #define WLFC_PCIEDEV_LLR_PRIO_MAP 2 | |
462 | ||
463 | void wlc_wlfc_set_pkttime(void* pkt, uint16 time); | |
464 | ||
465 | #endif /* __wlfc_proto_definitions_h__ */ |