2 * Copyright (C) 1999-2016, Broadcom Corporation
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:
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.
18 * Notwithstanding the above, under no circumstances may you combine this
19 * software in any way with any other Broadcom software provided under a license
20 * other than the GPL, without Broadcom's express prior written consent.
23 * <<Broadcom-WL-IPTag/Open:>>
25 * $Id: dhd_wlfc.h 557035 2015-05-15 18:48:57Z $
28 #ifndef __wlfc_host_driver_definitions_h__
29 #define __wlfc_host_driver_definitions_h__
32 /* #define OOO_DEBUG */
34 #define KERNEL_THREAD_RETURN_TYPE int
36 typedef int (*f_commitpkt_t
)(void* ctx
, void* p
);
37 typedef bool (*f_processpkt_t
)(void* p
, void* arg
);
39 #define WLFC_UNSUPPORTED -9999
41 #define WLFC_NO_TRAFFIC -1
42 #define WLFC_MULTI_TRAFFIC 0
44 #define BUS_RETRIES 1 /* # of retries before aborting a bus tx operation */
46 /** 16 bits will provide an absolute max of 65536 slots */
47 #define WLFC_HANGER_MAXITEMS 3072
49 #define WLFC_HANGER_ITEM_STATE_FREE 1
50 #define WLFC_HANGER_ITEM_STATE_INUSE 2
51 #define WLFC_HANGER_ITEM_STATE_INUSE_SUPPRESSED 3
52 #define WLFC_HANGER_ITEM_STATE_FLUSHED 4
54 #define WLFC_HANGER_PKT_STATE_TXSTATUS 1
55 #define WLFC_HANGER_PKT_STATE_BUSRETURNED 2
56 #define WLFC_HANGER_PKT_STATE_COMPLETE \
57 (WLFC_HANGER_PKT_STATE_TXSTATUS | WLFC_HANGER_PKT_STATE_BUSRETURNED)
60 Q_TYPE_PSQ
, /**< Power Save Queue, contains both delayed and suppressed packets */
61 Q_TYPE_AFQ
/**< At Firmware Queue */
64 typedef enum ewlfc_packet_state
{
65 eWLFC_PKTTYPE_NEW
, /**< unused in the code (Jan 2015) */
66 eWLFC_PKTTYPE_DELAYED
, /**< packet did not enter wlfc yet */
67 eWLFC_PKTTYPE_SUPPRESSED
, /**< packet entered wlfc and was suppressed by the dongle */
69 } ewlfc_packet_state_t
;
71 typedef enum ewlfc_mac_entry_action
{
72 eWLFC_MAC_ENTRY_ACTION_ADD
,
73 eWLFC_MAC_ENTRY_ACTION_DEL
,
74 eWLFC_MAC_ENTRY_ACTION_UPDATE
,
75 eWLFC_MAC_ENTRY_ACTION_MAX
76 } ewlfc_mac_entry_action_t
;
78 typedef struct wlfc_hanger_item
{
81 uint8 pkt_state
; /**< bitmask containing eg WLFC_HANGER_PKT_STATE_TXCOMPLETE */
85 #ifdef PROP_TXSTATUS_DEBUG
88 struct wlfc_hanger_item
*next
;
91 /** hanger contains packets that have been posted by the dhd to the dongle and are expected back */
92 typedef struct wlfc_hanger
{
96 uint32 failed_to_push
;
98 uint32 failed_slotfind
;
100 wlfc_hanger_item_t items
[1];
103 #define WLFC_HANGER_SIZE(n) ((sizeof(wlfc_hanger_t) - \
104 sizeof(wlfc_hanger_item_t)) + ((n)*sizeof(wlfc_hanger_item_t)))
106 #define WLFC_STATE_OPEN 1 /**< remote MAC is able to receive packets */
107 #define WLFC_STATE_CLOSE 2 /**< remote MAC is in power save mode */
109 #define WLFC_PSQ_PREC_COUNT ((AC_COUNT + 1) * 2) /**< 2 for each AC traffic and bc/mc */
110 #define WLFC_AFQ_PREC_COUNT (AC_COUNT + 1)
112 #define WLFC_PSQ_LEN 2048
114 #define WLFC_FLOWCONTROL_HIWATER (2048 - 256)
115 #define WLFC_FLOWCONTROL_LOWATER 256
117 #if (WLFC_FLOWCONTROL_HIWATER >= (WLFC_PSQ_LEN - 256))
118 #undef WLFC_FLOWCONTROL_HIWATER
119 #define WLFC_FLOWCONTROL_HIWATER (WLFC_PSQ_LEN - 256)
120 #undef WLFC_FLOWCONTROL_LOWATER
121 #define WLFC_FLOWCONTROL_LOWATER (WLFC_FLOWCONTROL_HIWATER / 4)
124 #define WLFC_LOG_BUF_SIZE (1024*1024)
126 /** Properties related to a remote MAC entity */
127 typedef struct wlfc_mac_descriptor
{
128 uint8 occupied
; /**< if 0, this descriptor is unused and thus can be (re)used */
130 uint8 iftype
; /**< eg WLC_E_IF_ROLE_STA */
131 uint8 state
; /**< eg WLFC_STATE_OPEN */
132 uint8 ac_bitmap
; /**< automatic power save delivery (APSD) */
133 uint8 requested_credit
;
134 uint8 requested_packet
; /**< unit: [number of packets] */
135 uint8 ea
[ETHER_ADDR_LEN
];
137 /** maintain (MAC,AC) based seq count for packets going to the device. As well as bc/mc. */
138 uint8 seq
[AC_COUNT
+ 1];
139 uint8 generation
; /**< toggles between 0 and 1 */
140 struct pktq psq
; /**< contains both 'delayed' and 'suppressed' packets */
141 /** packets at firmware queue */
143 /** The AC pending bitmap that was reported to the fw at last change */
144 uint8 traffic_lastreported_bmp
;
145 /** The new AC pending bitmap */
146 uint8 traffic_pending_bmp
;
147 /** 1= send on next opportunity */
148 uint8 send_tim_signal
;
149 uint8 mac_handle
; /**< mac handles are assigned by the dongle */
150 /** Number of packets at dongle for this entry. */
152 /** Number of suppression to wait before evict from delayQ */
153 int suppr_transit_count
;
154 /** pkt sent to bus but no bus TX complete yet */
155 int onbus_pkts_count
;
156 /** flag. TRUE when remote MAC is in suppressed state */
160 #ifdef PROP_TXSTATUS_DEBUG
161 uint32 dstncredit_sent_packets
;
162 uint32 dstncredit_acks
;
166 struct wlfc_mac_descriptor
* prev
;
167 struct wlfc_mac_descriptor
* next
;
168 } wlfc_mac_descriptor_t
;
170 /** A 'commit' is the hand over of a packet from the host OS layer to the layer below (eg DBUS) */
171 typedef struct dhd_wlfc_commit_info
{
173 uint8 ac_fifo_credit_spent
;
174 ewlfc_packet_state_t pkt_type
;
175 wlfc_mac_descriptor_t
* mac_entry
;
177 } dhd_wlfc_commit_info_t
;
179 #define WLFC_DECR_SEQCOUNT(entry, prec) do { if (entry->seq[(prec)] == 0) {\
180 entry->seq[prec] = 0xff; } else entry->seq[prec]--;} while (0)
182 #define WLFC_INCR_SEQCOUNT(entry, prec) entry->seq[(prec)]++
183 #define WLFC_SEQCOUNT(entry, prec) entry->seq[(prec)]
185 typedef struct athost_wl_stat_counters
{
190 uint32 tlv_parse_failed
;
192 uint32 rollback_failed
;
193 uint32 delayq_full_error
;
194 uint32 credit_request_failed
;
195 uint32 packet_request_failed
;
196 uint32 mac_update_failed
;
197 uint32 psmode_update_failed
;
198 uint32 interface_update_failed
;
199 uint32 wlfc_header_only_pkt
;
206 uint32 psq_wlsup_retx
;
207 uint32 psq_wlsup_enq
;
208 uint32 psq_d11sup_retx
;
209 uint32 psq_d11sup_enq
;
210 uint32 psq_hostq_retx
;
211 uint32 psq_hostq_enq
;
212 uint32 mac_handle_notfound
;
213 uint32 wlc_tossed_pkts
;
215 uint32 generic_error
;
216 /* an extra one for bc/mc traffic */
217 uint32 send_pkts
[AC_COUNT
+ 1];
218 uint32 drop_pkts
[WLFC_PSQ_PREC_COUNT
];
219 uint32 ooo_pkts
[AC_COUNT
+ 1];
220 #ifdef PROP_TXSTATUS_DEBUG
221 /** all pkt2bus -> txstatus latency accumulated */
222 uint32 latency_sample_count
;
223 uint32 total_status_latency
;
224 uint32 latency_most_recent
;
227 uint32 fifo_credits_sent
[6];
228 uint32 fifo_credits_back
[6];
229 uint32 dropped_qfull
[6];
230 uint32 signal_only_pkts_sent
;
231 uint32 signal_only_pkts_freed
;
233 uint32 cleanup_txq_cnt
;
234 uint32 cleanup_psq_cnt
;
235 uint32 cleanup_fw_cnt
;
236 } athost_wl_stat_counters_t
;
238 #ifdef PROP_TXSTATUS_DEBUG
239 #define WLFC_HOST_FIFO_CREDIT_INC_SENTCTRS(ctx, ac) do { \
240 (ctx)->stats.fifo_credits_sent[(ac)]++;} while (0)
241 #define WLFC_HOST_FIFO_CREDIT_INC_BACKCTRS(ctx, ac) do { \
242 (ctx)->stats.fifo_credits_back[(ac)]++;} while (0)
243 #define WLFC_HOST_FIFO_DROPPEDCTR_INC(ctx, ac) do { \
244 (ctx)->stats.dropped_qfull[(ac)]++;} while (0)
246 #define WLFC_HOST_FIFO_CREDIT_INC_SENTCTRS(ctx, ac) do {} while (0)
247 #define WLFC_HOST_FIFO_CREDIT_INC_BACKCTRS(ctx, ac) do {} while (0)
248 #define WLFC_HOST_FIFO_DROPPEDCTR_INC(ctx, ac) do {} while (0)
251 #define WLFC_FCMODE_NONE 0
252 #define WLFC_FCMODE_IMPLIED_CREDIT 1
253 #define WLFC_FCMODE_EXPLICIT_CREDIT 2
254 #define WLFC_ONLY_AMPDU_HOSTREORDER 3
256 /** Reserved credits ratio when borrowed by hihger priority */
257 #define WLFC_BORROW_LIMIT_RATIO 4
259 /** How long to defer borrowing in milliseconds */
260 #define WLFC_BORROW_DEFER_PERIOD_MS 100
262 /** How long to defer flow control in milliseconds */
263 #define WLFC_FC_DEFER_PERIOD_MS 200
265 /** How long to detect occurance per AC in miliseconds */
266 #define WLFC_RX_DETECTION_THRESHOLD_MS 100
268 /** Mask to represent available ACs (note: BC/MC is ignored) */
269 #define WLFC_AC_MASK 0xF
271 /** flow control specific information, only 1 instance during driver lifetime */
272 typedef struct athost_wl_status_info
{
273 uint8 last_seqid_to_wlc
;
277 /** dhd public struct pointer */
280 f_commitpkt_t fcommit
;
284 athost_wl_stat_counters_t stats
;
286 /** incremented on eg receiving a credit map event from the dongle */
287 int Init_FIFO_credit
[AC_COUNT
+ 2];
288 /** the additional ones are for bc/mc and ATIM FIFO */
289 int FIFO_credit
[AC_COUNT
+ 2];
290 /** Credit borrow counts for each FIFO from each of the other FIFOs */
291 int credits_borrowed
[AC_COUNT
+ 2][AC_COUNT
+ 2];
293 /** packet hanger and MAC->handle lookup table */
297 /** table for individual nodes */
298 wlfc_mac_descriptor_t nodes
[WLFC_MAC_DESC_TABLE_SIZE
];
299 /** table for interfaces */
300 wlfc_mac_descriptor_t interfaces
[WLFC_MAX_IFNUM
];
301 /* OS may send packets to unknown (unassociated) destinations */
302 /** A place holder for bc/mc and packets to unknown destinations */
303 wlfc_mac_descriptor_t other
;
304 } destination_entries
;
306 wlfc_mac_descriptor_t
*active_entry_head
; /**< a chain of MAC descriptors */
307 int active_entry_count
;
309 wlfc_mac_descriptor_t
*requested_entry
[WLFC_MAC_DESC_TABLE_SIZE
];
310 int requested_entry_count
;
312 /* pkt counts for each interface and ac */
313 int pkt_cnt_in_q
[WLFC_MAX_IFNUM
][AC_COUNT
+1];
314 int pkt_cnt_per_ac
[AC_COUNT
+1];
315 int pkt_cnt_in_drv
[WLFC_MAX_IFNUM
][AC_COUNT
+1];
317 uint8 allow_fc
; /**< Boolean */
318 uint32 fc_defer_timestamp
;
319 uint32 rx_timestamp
[AC_COUNT
+1];
321 /** ON/OFF state for flow control to the host network interface */
322 uint8 hostif_flow_state
[WLFC_MAX_IFNUM
];
325 /** to flow control an OS interface */
326 uint8 toggle_host_if
;
328 /** To borrow credits */
329 uint8 allow_credit_borrow
;
331 /** ac number for the first single ac traffic */
334 /** Timestamp for the first single ac traffic */
335 uint32 single_ac_timestamp
;
337 bool bcmc_credit_supported
;
339 } athost_wl_status_info_t
;
341 /** Please be mindful that total pkttag space is 32 octets only */
342 typedef struct dhd_pkttag
{
344 #ifdef BCM_OBJECT_TRACE
345 /* if use this field, keep it at the first 4 bytes */
347 #endif /* BCM_OBJECT_TRACE */
350 b[15] - 1 = wlfc packet
351 b[14:13] - encryption exemption
352 b[12 ] - 1 = event channel
353 b[11 ] - 1 = this packet was sent in response to one time packet request,
354 do not increment credit on status for this one. [WLFC_CTL_TYPE_MAC_REQUEST_PACKET].
355 b[10 ] - 1 = signal-only-packet to firmware [i.e. nothing to piggyback on]
356 b[9 ] - 1 = packet is host->firmware (transmit direction)
357 - 0 = packet received from firmware (firmware->host)
358 b[8 ] - 1 = packet was sent due to credit_request (pspoll),
359 packet does not count against FIFO credit.
360 - 0 = normal transaction, packet counts against FIFO credit
361 b[7 ] - 1 = AP, 0 = STA
362 b[6:4] - AC FIFO number
363 b[3:0] - interface index
368 * destination MAC address for this packet so that not every module needs to open the packet
371 uint8 dstn_ether
[ETHER_ADDR_LEN
];
373 /** This 32-bit goes from host to device for every packet. */
376 /** This 16-bit is original seq number for every suppress packet. */
379 /** This address is mac entry for every packet. */
382 /** bus specific stuff */
397 #define DHD_PKTTAG_WLFCPKT_MASK 0x1
398 #define DHD_PKTTAG_WLFCPKT_SHIFT 15
399 #define DHD_PKTTAG_WLFCPKT_SET(tag, value) ((dhd_pkttag_t*)(tag))->if_flags = \
400 (((dhd_pkttag_t*)(tag))->if_flags & \
401 ~(DHD_PKTTAG_WLFCPKT_MASK << DHD_PKTTAG_WLFCPKT_SHIFT)) | \
402 (((value) & DHD_PKTTAG_WLFCPKT_MASK) << DHD_PKTTAG_WLFCPKT_SHIFT)
403 #define DHD_PKTTAG_WLFCPKT(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
404 DHD_PKTTAG_WLFCPKT_SHIFT) & DHD_PKTTAG_WLFCPKT_MASK)
406 #define DHD_PKTTAG_EXEMPT_MASK 0x3
407 #define DHD_PKTTAG_EXEMPT_SHIFT 13
408 #define DHD_PKTTAG_EXEMPT_SET(tag, value) ((dhd_pkttag_t*)(tag))->if_flags = \
409 (((dhd_pkttag_t*)(tag))->if_flags & \
410 ~(DHD_PKTTAG_EXEMPT_MASK << DHD_PKTTAG_EXEMPT_SHIFT)) | \
411 (((value) & DHD_PKTTAG_EXEMPT_MASK) << DHD_PKTTAG_EXEMPT_SHIFT)
412 #define DHD_PKTTAG_EXEMPT(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
413 DHD_PKTTAG_EXEMPT_SHIFT) & DHD_PKTTAG_EXEMPT_MASK)
415 #define DHD_PKTTAG_EVENT_MASK 0x1
416 #define DHD_PKTTAG_EVENT_SHIFT 12
417 #define DHD_PKTTAG_SETEVENT(tag, event) ((dhd_pkttag_t*)(tag))->if_flags = \
418 (((dhd_pkttag_t*)(tag))->if_flags & \
419 ~(DHD_PKTTAG_EVENT_MASK << DHD_PKTTAG_EVENT_SHIFT)) | \
420 (((event) & DHD_PKTTAG_EVENT_MASK) << DHD_PKTTAG_EVENT_SHIFT)
421 #define DHD_PKTTAG_EVENT(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
422 DHD_PKTTAG_EVENT_SHIFT) & DHD_PKTTAG_EVENT_MASK)
424 #define DHD_PKTTAG_ONETIMEPKTRQST_MASK 0x1
425 #define DHD_PKTTAG_ONETIMEPKTRQST_SHIFT 11
426 #define DHD_PKTTAG_SETONETIMEPKTRQST(tag) ((dhd_pkttag_t*)(tag))->if_flags = \
427 (((dhd_pkttag_t*)(tag))->if_flags & \
428 ~(DHD_PKTTAG_ONETIMEPKTRQST_MASK << DHD_PKTTAG_ONETIMEPKTRQST_SHIFT)) | \
429 (1 << DHD_PKTTAG_ONETIMEPKTRQST_SHIFT)
430 #define DHD_PKTTAG_ONETIMEPKTRQST(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
431 DHD_PKTTAG_ONETIMEPKTRQST_SHIFT) & DHD_PKTTAG_ONETIMEPKTRQST_MASK)
433 #define DHD_PKTTAG_SIGNALONLY_MASK 0x1
434 #define DHD_PKTTAG_SIGNALONLY_SHIFT 10
435 #define DHD_PKTTAG_SETSIGNALONLY(tag, signalonly) ((dhd_pkttag_t*)(tag))->if_flags = \
436 (((dhd_pkttag_t*)(tag))->if_flags & \
437 ~(DHD_PKTTAG_SIGNALONLY_MASK << DHD_PKTTAG_SIGNALONLY_SHIFT)) | \
438 (((signalonly) & DHD_PKTTAG_SIGNALONLY_MASK) << DHD_PKTTAG_SIGNALONLY_SHIFT)
439 #define DHD_PKTTAG_SIGNALONLY(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
440 DHD_PKTTAG_SIGNALONLY_SHIFT) & DHD_PKTTAG_SIGNALONLY_MASK)
442 #define DHD_PKTTAG_PKTDIR_MASK 0x1
443 #define DHD_PKTTAG_PKTDIR_SHIFT 9
444 #define DHD_PKTTAG_SETPKTDIR(tag, dir) ((dhd_pkttag_t*)(tag))->if_flags = \
445 (((dhd_pkttag_t*)(tag))->if_flags & \
446 ~(DHD_PKTTAG_PKTDIR_MASK << DHD_PKTTAG_PKTDIR_SHIFT)) | \
447 (((dir) & DHD_PKTTAG_PKTDIR_MASK) << DHD_PKTTAG_PKTDIR_SHIFT)
448 #define DHD_PKTTAG_PKTDIR(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
449 DHD_PKTTAG_PKTDIR_SHIFT) & DHD_PKTTAG_PKTDIR_MASK)
451 #define DHD_PKTTAG_CREDITCHECK_MASK 0x1
452 #define DHD_PKTTAG_CREDITCHECK_SHIFT 8
453 #define DHD_PKTTAG_SETCREDITCHECK(tag, check) ((dhd_pkttag_t*)(tag))->if_flags = \
454 (((dhd_pkttag_t*)(tag))->if_flags & \
455 ~(DHD_PKTTAG_CREDITCHECK_MASK << DHD_PKTTAG_CREDITCHECK_SHIFT)) | \
456 (((check) & DHD_PKTTAG_CREDITCHECK_MASK) << DHD_PKTTAG_CREDITCHECK_SHIFT)
457 #define DHD_PKTTAG_CREDITCHECK(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
458 DHD_PKTTAG_CREDITCHECK_SHIFT) & DHD_PKTTAG_CREDITCHECK_MASK)
460 #define DHD_PKTTAG_IFTYPE_MASK 0x1
461 #define DHD_PKTTAG_IFTYPE_SHIFT 7
462 #define DHD_PKTTAG_SETIFTYPE(tag, isAP) ((dhd_pkttag_t*)(tag))->if_flags = \
463 (((dhd_pkttag_t*)(tag))->if_flags & \
464 ~(DHD_PKTTAG_IFTYPE_MASK << DHD_PKTTAG_IFTYPE_SHIFT)) | \
465 (((isAP) & DHD_PKTTAG_IFTYPE_MASK) << DHD_PKTTAG_IFTYPE_SHIFT)
466 #define DHD_PKTTAG_IFTYPE(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
467 DHD_PKTTAG_IFTYPE_SHIFT) & DHD_PKTTAG_IFTYPE_MASK)
469 #define DHD_PKTTAG_FIFO_MASK 0x7
470 #define DHD_PKTTAG_FIFO_SHIFT 4
471 #define DHD_PKTTAG_SETFIFO(tag, fifo) ((dhd_pkttag_t*)(tag))->if_flags = \
472 (((dhd_pkttag_t*)(tag))->if_flags & ~(DHD_PKTTAG_FIFO_MASK << DHD_PKTTAG_FIFO_SHIFT)) | \
473 (((fifo) & DHD_PKTTAG_FIFO_MASK) << DHD_PKTTAG_FIFO_SHIFT)
474 #define DHD_PKTTAG_FIFO(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
475 DHD_PKTTAG_FIFO_SHIFT) & DHD_PKTTAG_FIFO_MASK)
477 #define DHD_PKTTAG_IF_MASK 0xf
478 #define DHD_PKTTAG_IF_SHIFT 0
479 #define DHD_PKTTAG_SETIF(tag, if) ((dhd_pkttag_t*)(tag))->if_flags = \
480 (((dhd_pkttag_t*)(tag))->if_flags & ~(DHD_PKTTAG_IF_MASK << DHD_PKTTAG_IF_SHIFT)) | \
481 (((if) & DHD_PKTTAG_IF_MASK) << DHD_PKTTAG_IF_SHIFT)
482 #define DHD_PKTTAG_IF(tag) ((((dhd_pkttag_t*)(tag))->if_flags >> \
483 DHD_PKTTAG_IF_SHIFT) & DHD_PKTTAG_IF_MASK)
485 #define DHD_PKTTAG_SETDSTN(tag, dstn_MAC_ea) memcpy(((dhd_pkttag_t*)((tag)))->dstn_ether, \
486 (dstn_MAC_ea), ETHER_ADDR_LEN)
487 #define DHD_PKTTAG_DSTN(tag) ((dhd_pkttag_t*)(tag))->dstn_ether
489 #define DHD_PKTTAG_SET_H2DTAG(tag, h2dvalue) ((dhd_pkttag_t*)(tag))->htod_tag = (h2dvalue)
490 #define DHD_PKTTAG_H2DTAG(tag) (((dhd_pkttag_t*)(tag))->htod_tag)
492 #define DHD_PKTTAG_SET_H2DSEQ(tag, seq) ((dhd_pkttag_t*)(tag))->htod_seq = (seq)
493 #define DHD_PKTTAG_H2DSEQ(tag) (((dhd_pkttag_t*)(tag))->htod_seq)
495 #define DHD_PKTTAG_SET_ENTRY(tag, entry) ((dhd_pkttag_t*)(tag))->entry = (entry)
496 #define DHD_PKTTAG_ENTRY(tag) (((dhd_pkttag_t*)(tag))->entry)
498 #define PSQ_SUP_IDX(x) (x * 2 + 1)
499 #define PSQ_DLY_IDX(x) (x * 2)
501 #ifdef PROP_TXSTATUS_DEBUG
502 #define DHD_WLFC_CTRINC_MAC_CLOSE(entry) do { (entry)->closed_ct++; } while (0)
503 #define DHD_WLFC_CTRINC_MAC_OPEN(entry) do { (entry)->opened_ct++; } while (0)
505 #define DHD_WLFC_CTRINC_MAC_CLOSE(entry) do {} while (0)
506 #define DHD_WLFC_CTRINC_MAC_OPEN(entry) do {} while (0)
509 #ifdef BCM_OBJECT_TRACE
510 #define DHD_PKTTAG_SET_SN(tag, val) ((dhd_pkttag_t*)(tag))->sn = (val)
511 #define DHD_PKTTAG_SN(tag) (((dhd_pkttag_t*)(tag))->sn)
512 #endif /* BCM_OBJECT_TRACE */
514 /* public functions */
515 int dhd_wlfc_parse_header_info(dhd_pub_t
*dhd
, void* pktbuf
, int tlv_hdr_len
,
516 uchar
*reorder_info_buf
, uint
*reorder_info_len
);
517 KERNEL_THREAD_RETURN_TYPE
dhd_wlfc_transfer_packets(void *data
);
518 int dhd_wlfc_commit_packets(dhd_pub_t
*dhdp
, f_commitpkt_t fcommit
,
519 void* commit_ctx
, void *pktbuf
, bool need_toggle_host_if
);
520 int dhd_wlfc_txcomplete(dhd_pub_t
*dhd
, void *txp
, bool success
);
521 int dhd_wlfc_init(dhd_pub_t
*dhd
);
522 #ifdef SUPPORT_P2P_GO_PS
523 int dhd_wlfc_suspend(dhd_pub_t
*dhd
);
524 int dhd_wlfc_resume(dhd_pub_t
*dhd
);
525 #endif /* SUPPORT_P2P_GO_PS */
526 int dhd_wlfc_hostreorder_init(dhd_pub_t
*dhd
);
527 int dhd_wlfc_cleanup_txq(dhd_pub_t
*dhd
, f_processpkt_t fn
, void *arg
);
528 int dhd_wlfc_cleanup(dhd_pub_t
*dhd
, f_processpkt_t fn
, void* arg
);
529 int dhd_wlfc_deinit(dhd_pub_t
*dhd
);
530 int dhd_wlfc_interface_event(dhd_pub_t
*dhdp
, uint8 action
, uint8 ifid
, uint8 iftype
, uint8
* ea
);
531 int dhd_wlfc_FIFOcreditmap_event(dhd_pub_t
*dhdp
, uint8
* event_data
);
532 int dhd_wlfc_BCMCCredit_support_event(dhd_pub_t
*dhdp
);
533 int dhd_wlfc_enable(dhd_pub_t
*dhdp
);
534 int dhd_wlfc_dump(dhd_pub_t
*dhdp
, struct bcmstrbuf
*strbuf
);
535 int dhd_wlfc_clear_counts(dhd_pub_t
*dhd
);
536 int dhd_wlfc_get_enable(dhd_pub_t
*dhd
, bool *val
);
537 int dhd_wlfc_get_mode(dhd_pub_t
*dhd
, int *val
);
538 int dhd_wlfc_set_mode(dhd_pub_t
*dhd
, int val
);
539 bool dhd_wlfc_is_supported(dhd_pub_t
*dhd
);
540 bool dhd_wlfc_is_header_only_pkt(dhd_pub_t
* dhd
, void *pktbuf
);
541 int dhd_wlfc_flowcontrol(dhd_pub_t
*dhdp
, bool state
, bool bAcquireLock
);
542 int dhd_wlfc_save_rxpath_ac_time(dhd_pub_t
* dhd
, uint8 prio
);
544 int dhd_wlfc_get_module_ignore(dhd_pub_t
*dhd
, int *val
);
545 int dhd_wlfc_set_module_ignore(dhd_pub_t
*dhd
, int val
);
546 int dhd_wlfc_get_credit_ignore(dhd_pub_t
*dhd
, int *val
);
547 int dhd_wlfc_set_credit_ignore(dhd_pub_t
*dhd
, int val
);
548 int dhd_wlfc_get_txstatus_ignore(dhd_pub_t
*dhd
, int *val
);
549 int dhd_wlfc_set_txstatus_ignore(dhd_pub_t
*dhd
, int val
);
551 int dhd_wlfc_get_rxpkt_chk(dhd_pub_t
*dhd
, int *val
);
552 int dhd_wlfc_set_rxpkt_chk(dhd_pub_t
*dhd
, int val
);
554 #endif /* __wlfc_host_driver_definitions_h__ */