wlfc_proto.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. /*
  2. * Portions of this code are copyright (c) 2020 Cypress Semiconductor Corporation
  3. *
  4. * Copyright (C) 1999-2020, Broadcom Corporation
  5. *
  6. * Unless you and Broadcom execute a separate written software license
  7. * agreement governing use of this software, this software is licensed to you
  8. * under the terms of the GNU General Public License version 2 (the "GPL"),
  9. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  10. * following added to such license:
  11. *
  12. * As a special exception, the copyright holders of this software give you
  13. * permission to link this software with independent modules, and to copy and
  14. * distribute the resulting executable under terms of your choice, provided that
  15. * you also meet, for each linked independent module, the terms and conditions of
  16. * the license of that module. An independent module is a module which is not
  17. * derived from this software. The special exception does not apply to any
  18. * modifications of the software.
  19. *
  20. * Notwithstanding the above, under no circumstances may you combine this
  21. * software in any way with any other Broadcom software provided under a license
  22. * other than the GPL, without Broadcom's express prior written consent.
  23. *
  24. *
  25. * <<Broadcom-WL-IPTag/Open:>>
  26. *
  27. * $Id: wlfc_proto.h 692466 2017-03-28 07:48:19Z $
  28. *
  29. */
  30. /** WL flow control for PROP_TXSTATUS. Related to host AMPDU reordering. */
  31. #ifndef __wlfc_proto_definitions_h__
  32. #define __wlfc_proto_definitions_h__
  33. /* Use TLV to convey WLFC information.
  34. ---------------------------------------------------------------------------
  35. | Type | Len | value | Description
  36. ---------------------------------------------------------------------------
  37. | 1 | 1 | (handle) | MAC OPEN
  38. ---------------------------------------------------------------------------
  39. | 2 | 1 | (handle) | MAC CLOSE
  40. ---------------------------------------------------------------------------
  41. | 3 | 2 | (count, handle, prec_bmp)| Set the credit depth for a MAC dstn
  42. ---------------------------------------------------------------------------
  43. | 4 | 4+ | see pkttag comments | TXSTATUS
  44. | | 12 | TX status & timestamps | Present only when pkt timestamp is enabled
  45. ---------------------------------------------------------------------------
  46. | 5 | 4 | see pkttag comments | PKKTTAG [host->firmware]
  47. ---------------------------------------------------------------------------
  48. | 6 | 8 | (handle, ifid, MAC) | MAC ADD
  49. ---------------------------------------------------------------------------
  50. | 7 | 8 | (handle, ifid, MAC) | MAC DEL
  51. ---------------------------------------------------------------------------
  52. | 8 | 1 | (rssi) | RSSI - RSSI value for the packet.
  53. ---------------------------------------------------------------------------
  54. | 9 | 1 | (interface ID) | Interface OPEN
  55. ---------------------------------------------------------------------------
  56. | 10 | 1 | (interface ID) | Interface CLOSE
  57. ---------------------------------------------------------------------------
  58. | 11 | 8 | fifo credit returns map | FIFO credits back to the host
  59. | | | |
  60. | | | | --------------------------------------
  61. | | | | | ac0 | ac1 | ac2 | ac3 | bcmc | atim |
  62. | | | | --------------------------------------
  63. | | | |
  64. ---------------------------------------------------------------------------
  65. | 12 | 2 | MAC handle, | Host provides a bitmap of pending
  66. | | | AC[0-3] traffic bitmap | unicast traffic for MAC-handle dstn.
  67. | | | | [host->firmware]
  68. ---------------------------------------------------------------------------
  69. | 13 | 3 | (count, handle, prec_bmp)| One time request for packet to a specific
  70. | | | | MAC destination.
  71. ---------------------------------------------------------------------------
  72. | 15 | 12 | (pkttag, timestamps) | Send TX timestamp at reception from host
  73. ---------------------------------------------------------------------------
  74. | 16 | 12 | (pkttag, timestamps) | Send WLAN RX timestamp along with RX frame
  75. ---------------------------------------------------------------------------
  76. | 255 | N/A | N/A | FILLER - This is a special type
  77. | | | | that has no length or value.
  78. | | | | Typically used for padding.
  79. ---------------------------------------------------------------------------
  80. */
  81. typedef enum {
  82. WLFC_CTL_TYPE_MAC_OPEN = 1,
  83. WLFC_CTL_TYPE_MAC_CLOSE = 2,
  84. WLFC_CTL_TYPE_MAC_REQUEST_CREDIT = 3,
  85. WLFC_CTL_TYPE_TXSTATUS = 4,
  86. WLFC_CTL_TYPE_PKTTAG = 5, /** host<->dongle */
  87. WLFC_CTL_TYPE_MACDESC_ADD = 6,
  88. WLFC_CTL_TYPE_MACDESC_DEL = 7,
  89. WLFC_CTL_TYPE_RSSI = 8,
  90. WLFC_CTL_TYPE_INTERFACE_OPEN = 9,
  91. WLFC_CTL_TYPE_INTERFACE_CLOSE = 10,
  92. WLFC_CTL_TYPE_FIFO_CREDITBACK = 11,
  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. WLFC_CTL_TYPE_TX_ENTRY_STAMP = 15,
  97. WLFC_CTL_TYPE_RX_STAMP = 16,
  98. WLFC_CTL_TYPE_TX_STATUS_STAMP = 17, /** obsolete */
  99. WLFC_CTL_TYPE_TRANS_ID = 18,
  100. WLFC_CTL_TYPE_COMP_TXSTATUS = 19,
  101. WLFC_CTL_TYPE_TID_OPEN = 20,
  102. WLFC_CTL_TYPE_TID_CLOSE = 21,
  103. WLFC_CTL_TYPE_UPD_FLR_WEIGHT = 22,
  104. WLFC_CTL_TYPE_ENAB_FFSCH = 23,
  105. WLFC_CTL_TYPE_UPDATE_FLAGS = 24, /* clear the flags set in flowring */
  106. WLFC_CTL_TYPE_CLEAR_SUPPR = 25, /* free the supression info in the flowring */
  107. WLFC_CTL_TYPE_FLOWID_OPEN = 26,
  108. WLFC_CTL_TYPE_FLOWID_CLOSE = 27,
  109. WLFC_CTL_TYPE_FILLER = 255
  110. } wlfc_ctl_type_t;
  111. #define WLFC_CTL_VALUE_LEN_FLOWID 2
  112. #define WLFC_CTL_VALUE_LEN_MACDESC 8 /** handle, interface, MAC */
  113. #define WLFC_CTL_VALUE_LEN_MAC 1 /** MAC-handle */
  114. #define WLFC_CTL_VALUE_LEN_RSSI 1
  115. #define WLFC_CTL_VALUE_LEN_INTERFACE 1
  116. #define WLFC_CTL_VALUE_LEN_PENDING_TRAFFIC_BMP 2
  117. #define WLFC_CTL_VALUE_LEN_TXSTATUS 4
  118. #define WLFC_CTL_VALUE_LEN_PKTTAG 4
  119. #define WLFC_CTL_VALUE_LEN_TIMESTAMP 12 /** 4-byte rate info + 2 TSF */
  120. #define WLFC_CTL_VALUE_LEN_SEQ 2
  121. /* Reset the flags set for the corresponding flowring of the SCB which is de-inited */
  122. /* FLOW_RING_FLAG_LAST_TIM | FLOW_RING_FLAG_INFORM_PKTPEND | FLOW_RING_FLAG_PKT_REQ */
  123. #define WLFC_RESET_ALL_FLAGS 0
  124. #define WLFC_CTL_VALUE_LEN_FLAGS 7 /** flags, MAC */
  125. /* free the data stored to be used for suppressed packets in future */
  126. #define WLFC_CTL_VALUE_LEN_SUPR 7 /** tid, MAC */
  127. /* The high bits of ratespec report in timestamp are used for various status */
  128. #define WLFC_TSFLAGS_RX_RETRY (1 << 31)
  129. #define WLFC_TSFLAGS_PM_ENABLED (1 << 30)
  130. #define WLFC_TSFLAGS_MASK (WLFC_TSFLAGS_RX_RETRY | WLFC_TSFLAGS_PM_ENABLED)
  131. /* enough space to host all 4 ACs, bc/mc and atim fifo credit */
  132. #define WLFC_CTL_VALUE_LEN_FIFO_CREDITBACK 6
  133. #define WLFC_CTL_VALUE_LEN_REQUEST_CREDIT 3 /* credit, MAC-handle, prec_bitmap */
  134. #define WLFC_CTL_VALUE_LEN_REQUEST_PACKET 3 /* credit, MAC-handle, prec_bitmap */
  135. #define WLFC_PKTFLAG_PKTFROMHOST 0x01
  136. #define WLFC_PKTFLAG_PKT_REQUESTED 0x02
  137. #define WLFC_PKTFLAG_PKT_SENDTOHOST 0x04
  138. #define WL_TXSTATUS_STATUS_MASK 0xff /* allow 8 bits */
  139. #define WL_TXSTATUS_STATUS_SHIFT 24
  140. #define WL_TXSTATUS_SET_STATUS(x, status) ((x) = \
  141. ((x) & ~(WL_TXSTATUS_STATUS_MASK << WL_TXSTATUS_STATUS_SHIFT)) | \
  142. (((status) & WL_TXSTATUS_STATUS_MASK) << WL_TXSTATUS_STATUS_SHIFT))
  143. #define WL_TXSTATUS_GET_STATUS(x) (((x) >> WL_TXSTATUS_STATUS_SHIFT) & \
  144. WL_TXSTATUS_STATUS_MASK)
  145. /**
  146. * Bit 31 of the 32-bit packet tag is defined as 'generation ID'. It is set by the host to the
  147. * "current" generation, and by the firmware to the "expected" generation, toggling on suppress. The
  148. * firmware accepts a packet when the generation matches; on reset (startup) both "current" and
  149. * "expected" are set to 0.
  150. */
  151. #define WL_TXSTATUS_GENERATION_MASK 1 /* allow 1 bit */
  152. #define WL_TXSTATUS_GENERATION_SHIFT 31
  153. #define WL_TXSTATUS_SET_GENERATION(x, gen) ((x) = \
  154. ((x) & ~(WL_TXSTATUS_GENERATION_MASK << WL_TXSTATUS_GENERATION_SHIFT)) | \
  155. (((gen) & WL_TXSTATUS_GENERATION_MASK) << WL_TXSTATUS_GENERATION_SHIFT))
  156. #define WL_TXSTATUS_GET_GENERATION(x) (((x) >> WL_TXSTATUS_GENERATION_SHIFT) & \
  157. WL_TXSTATUS_GENERATION_MASK)
  158. #define WL_TXSTATUS_FLAGS_MASK 0xf /* allow 4 bits only */
  159. #define WL_TXSTATUS_FLAGS_SHIFT 27
  160. #define WL_TXSTATUS_SET_FLAGS(x, flags) ((x) = \
  161. ((x) & ~(WL_TXSTATUS_FLAGS_MASK << WL_TXSTATUS_FLAGS_SHIFT)) | \
  162. (((flags) & WL_TXSTATUS_FLAGS_MASK) << WL_TXSTATUS_FLAGS_SHIFT))
  163. #define WL_TXSTATUS_GET_FLAGS(x) (((x) >> WL_TXSTATUS_FLAGS_SHIFT) & \
  164. WL_TXSTATUS_FLAGS_MASK)
  165. #define WL_TXSTATUS_FIFO_MASK 0x7 /* allow 3 bits for FIFO ID */
  166. #define WL_TXSTATUS_FIFO_SHIFT 24
  167. #define WL_TXSTATUS_SET_FIFO(x, flags) ((x) = \
  168. ((x) & ~(WL_TXSTATUS_FIFO_MASK << WL_TXSTATUS_FIFO_SHIFT)) | \
  169. (((flags) & WL_TXSTATUS_FIFO_MASK) << WL_TXSTATUS_FIFO_SHIFT))
  170. #define WL_TXSTATUS_GET_FIFO(x) (((x) >> WL_TXSTATUS_FIFO_SHIFT) & WL_TXSTATUS_FIFO_MASK)
  171. #define WL_TXSTATUS_PKTID_MASK 0xffffff /* allow 24 bits */
  172. #define WL_TXSTATUS_SET_PKTID(x, num) ((x) = \
  173. ((x) & ~WL_TXSTATUS_PKTID_MASK) | (num))
  174. #define WL_TXSTATUS_GET_PKTID(x) ((x) & WL_TXSTATUS_PKTID_MASK)
  175. #define WL_TXSTATUS_HSLOT_MASK 0xffff /* allow 16 bits */
  176. #define WL_TXSTATUS_HSLOT_SHIFT 8
  177. #define WL_TXSTATUS_SET_HSLOT(x, hslot) ((x) = \
  178. ((x) & ~(WL_TXSTATUS_HSLOT_MASK << WL_TXSTATUS_HSLOT_SHIFT)) | \
  179. (((hslot) & WL_TXSTATUS_HSLOT_MASK) << WL_TXSTATUS_HSLOT_SHIFT))
  180. #define WL_TXSTATUS_GET_HSLOT(x) (((x) >> WL_TXSTATUS_HSLOT_SHIFT)& \
  181. WL_TXSTATUS_HSLOT_MASK)
  182. #define WL_TXSTATUS_FREERUNCTR_MASK 0xff /* allow 8 bits */
  183. #define WL_TXSTATUS_SET_FREERUNCTR(x, ctr) ((x) = \
  184. ((x) & ~(WL_TXSTATUS_FREERUNCTR_MASK)) | \
  185. ((ctr) & WL_TXSTATUS_FREERUNCTR_MASK))
  186. #define WL_TXSTATUS_GET_FREERUNCTR(x) ((x)& WL_TXSTATUS_FREERUNCTR_MASK)
  187. /* AMSDU part of d11 seq number */
  188. #define WL_SEQ_AMSDU_MASK 0x1 /* allow 1 bit */
  189. #define WL_SEQ_AMSDU_SHIFT 14
  190. #define WL_SEQ_SET_AMSDU(x, val) ((x) = \
  191. ((x) & ~(WL_SEQ_AMSDU_MASK << WL_SEQ_AMSDU_SHIFT)) | \
  192. (((val) & WL_SEQ_AMSDU_MASK) << WL_SEQ_AMSDU_SHIFT)) /**< sets a single AMSDU bit */
  193. /** returns TRUE if ring item is AMSDU (seq = d11 seq nr) */
  194. #define WL_SEQ_IS_AMSDU(x) (((x) >> WL_SEQ_AMSDU_SHIFT) & \
  195. WL_SEQ_AMSDU_MASK)
  196. /* indicates last_suppr_seq is valid */
  197. #define WL_SEQ_VALIDSUPPR_MASK 0x1 /* allow 1 bit */
  198. #define WL_SEQ_VALIDSUPPR_SHIFT 12
  199. #define WL_SEQ_SET_VALIDSUPPR(x, val) ((x) = \
  200. ((x) & ~(WL_SEQ_VALIDSUPPR_MASK << WL_SEQ_VALIDSUPPR_SHIFT)) | \
  201. (((val) & WL_SEQ_VALIDSUPPR_MASK) << WL_SEQ_VALIDSUPPR_SHIFT))
  202. #define WL_SEQ_GET_VALIDSUPPR(x) (((x) >> WL_SEQ_VALIDSUPPR_SHIFT) & \
  203. WL_SEQ_VALIDSUPPR_MASK)
  204. #define WL_SEQ_FROMFW_MASK 0x1 /* allow 1 bit */
  205. #define WL_SEQ_FROMFW_SHIFT 13
  206. #define WL_SEQ_SET_FROMFW(x, val) ((x) = \
  207. ((x) & ~(WL_SEQ_FROMFW_MASK << WL_SEQ_FROMFW_SHIFT)) | \
  208. (((val) & WL_SEQ_FROMFW_MASK) << WL_SEQ_FROMFW_SHIFT))
  209. /** Set when firmware assigns D11 sequence number to packet */
  210. #define SET_WL_HAS_ASSIGNED_SEQ(x) WL_SEQ_SET_FROMFW((x), 1)
  211. /** returns TRUE if packet has been assigned a d11 seq number by the WL firmware layer */
  212. #define GET_WL_HAS_ASSIGNED_SEQ(x) (((x) >> WL_SEQ_FROMFW_SHIFT) & WL_SEQ_FROMFW_MASK)
  213. /**
  214. * Proptxstatus related.
  215. *
  216. * When a packet is suppressed by WL or the D11 core, the packet has to be retried. Assigning
  217. * a new d11 sequence number for the packet when retrying would cause the peer to be unable to
  218. * reorder the packets within an AMPDU. So, suppressed packet from bus layer (DHD for SDIO and
  219. * pciedev for PCIE) is re-using d11 seq number, so FW should not assign a new one.
  220. */
  221. #define WL_SEQ_FROMDRV_MASK 0x1 /* allow 1 bit */
  222. #define WL_SEQ_FROMDRV_SHIFT 12
  223. /**
  224. * Proptxstatus, host or fw PCIe layer requests WL layer to reuse d11 seq no. Bit is reset by WL
  225. * subsystem when it reuses the seq number.
  226. */
  227. #define WL_SEQ_SET_REUSE(x, val) ((x) = \
  228. ((x) & ~(WL_SEQ_FROMDRV_MASK << WL_SEQ_FROMDRV_SHIFT)) | \
  229. (((val) & WL_SEQ_FROMDRV_MASK) << WL_SEQ_FROMDRV_SHIFT))
  230. #define SET_WL_TO_REUSE_SEQ(x) WL_SEQ_SET_REUSE((x), 1)
  231. #define RESET_WL_TO_REUSE_SEQ(x) WL_SEQ_SET_REUSE((x), 0)
  232. /** Proptxstatus, related to reuse of d11 seq numbers when retransmitting */
  233. #define IS_WL_TO_REUSE_SEQ(x) (((x) >> WL_SEQ_FROMDRV_SHIFT) & \
  234. WL_SEQ_FROMDRV_MASK)
  235. #define WL_SEQ_NUM_MASK 0xfff /* allow 12 bit */
  236. #define WL_SEQ_NUM_SHIFT 0
  237. /** Proptxstatus, sets d11seq no in pkt tag, related to reuse of d11seq no when retransmitting */
  238. #define WL_SEQ_SET_NUM(x, val) ((x) = \
  239. ((x) & ~(WL_SEQ_NUM_MASK << WL_SEQ_NUM_SHIFT)) | \
  240. (((val) & WL_SEQ_NUM_MASK) << WL_SEQ_NUM_SHIFT))
  241. /** Proptxstatus, gets d11seq no from pkt tag, related to reuse of d11seq no when retransmitting */
  242. #define WL_SEQ_GET_NUM(x) (((x) >> WL_SEQ_NUM_SHIFT) & \
  243. WL_SEQ_NUM_MASK)
  244. #define WL_SEQ_AMSDU_SUPPR_MASK ((WL_SEQ_FROMDRV_MASK << WL_SEQ_FROMDRV_SHIFT) | \
  245. (WL_SEQ_AMSDU_MASK << WL_SEQ_AMSDU_SHIFT) | \
  246. (WL_SEQ_NUM_MASK << WL_SEQ_NUM_SHIFT))
  247. /* 32 STA should be enough??, 6 bits; Must be power of 2 */
  248. #define WLFC_MAC_DESC_TABLE_SIZE 32
  249. #define WLFC_MAX_IFNUM 16
  250. #define WLFC_MAC_DESC_ID_INVALID 0xff
  251. /* b[7:5] -reuse guard, b[4:0] -value */
  252. #define WLFC_MAC_DESC_GET_LOOKUP_INDEX(x) ((x) & 0x1f)
  253. #define WLFC_PKTFLAG_SET_PKTREQUESTED(x) (x) |= \
  254. (WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT)
  255. #define WLFC_PKTFLAG_CLR_PKTREQUESTED(x) (x) &= \
  256. ~(WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT)
  257. #define WLFC_MAX_PENDING_DATALEN 120
  258. /* host is free to discard the packet */
  259. #define WLFC_CTL_PKTFLAG_DISCARD 0
  260. /* D11 suppressed a packet */
  261. #define WLFC_CTL_PKTFLAG_D11SUPPRESS 1
  262. /* WL firmware suppressed a packet because MAC is
  263. already in PSMode (short time window)
  264. */
  265. #define WLFC_CTL_PKTFLAG_WLSUPPRESS 2
  266. /* Firmware tossed this packet */
  267. #define WLFC_CTL_PKTFLAG_TOSSED_BYWLC 3
  268. /* Firmware tossed after retries */
  269. #define WLFC_CTL_PKTFLAG_DISCARD_NOACK 4
  270. /* Firmware wrongly reported suppressed previously,now fixing to acked */
  271. #define WLFC_CTL_PKTFLAG_SUPPRESS_ACKED 5
  272. /* Firmware send this packet expired, lifetime expiration */
  273. #define WLFC_CTL_PKTFLAG_EXPIRED 6
  274. /* Firmware drop this packet for any other reason */
  275. #define WLFC_CTL_PKTFLAG_DROPPED 7
  276. /* Firmware free this packet */
  277. #define WLFC_CTL_PKTFLAG_MKTFREE 8
  278. #define WLFC_CTL_PKTFLAG_MASK (0x0f) /* For 4-bit mask with one extra bit */
  279. #ifdef PROP_TXSTATUS_DEBUG
  280. #define WLFC_DBGMESG(x) printf x
  281. /* wlfc-breadcrumb */
  282. #define WLFC_BREADCRUMB(x) do {if ((x) == NULL) \
  283. {printf("WLFC: %s():%d:caller:%p\n", \
  284. __FUNCTION__, __LINE__, CALL_SITE);}} while (0)
  285. #define WLFC_WHEREIS(s) printf("WLFC: at %s():%d, %s\n", __FUNCTION__, __LINE__, (s))
  286. #else
  287. #define WLFC_DBGMESG(x)
  288. #define WLFC_BREADCRUMB(x)
  289. #define WLFC_WHEREIS(s)
  290. #endif /* PROP_TXSTATUS_DEBUG */
  291. /* AMPDU host reorder packet flags */
  292. #define WLHOST_REORDERDATA_MAXFLOWS 256
  293. #define WLHOST_REORDERDATA_LEN 10
  294. #define WLHOST_REORDERDATA_TOTLEN (WLHOST_REORDERDATA_LEN + 1 + 1) /* +tag +len */
  295. #define WLHOST_REORDERDATA_FLOWID_OFFSET 0
  296. #define WLHOST_REORDERDATA_MAXIDX_OFFSET 2
  297. #define WLHOST_REORDERDATA_FLAGS_OFFSET 4
  298. #define WLHOST_REORDERDATA_CURIDX_OFFSET 6
  299. #define WLHOST_REORDERDATA_EXPIDX_OFFSET 8
  300. #define WLHOST_REORDERDATA_DEL_FLOW 0x01
  301. #define WLHOST_REORDERDATA_FLUSH_ALL 0x02
  302. #define WLHOST_REORDERDATA_CURIDX_VALID 0x04
  303. #define WLHOST_REORDERDATA_EXPIDX_VALID 0x08
  304. #define WLHOST_REORDERDATA_NEW_HOLE 0x10
  305. /* transaction id data len byte 0: rsvd, byte 1: seqnumber, byte 2-5 will be used for timestampe */
  306. #define WLFC_CTL_TRANS_ID_LEN 6
  307. #define WLFC_TYPE_TRANS_ID_LEN 6
  308. #define WLFC_MODE_HANGER 1 /* use hanger */
  309. #define WLFC_MODE_AFQ 2 /* use afq (At Firmware Queue) */
  310. #define WLFC_IS_OLD_DEF(x) ((x & 1) || (x & 2))
  311. #define WLFC_MODE_AFQ_SHIFT 2 /* afq bit */
  312. #define WLFC_SET_AFQ(x, val) ((x) = \
  313. ((x) & ~(1 << WLFC_MODE_AFQ_SHIFT)) | \
  314. (((val) & 1) << WLFC_MODE_AFQ_SHIFT))
  315. /** returns TRUE if firmware supports 'at firmware queue' feature */
  316. #define WLFC_GET_AFQ(x) (((x) >> WLFC_MODE_AFQ_SHIFT) & 1)
  317. #define WLFC_MODE_REUSESEQ_SHIFT 3 /* seq reuse bit */
  318. #define WLFC_SET_REUSESEQ(x, val) ((x) = \
  319. ((x) & ~(1 << WLFC_MODE_REUSESEQ_SHIFT)) | \
  320. (((val) & 1) << WLFC_MODE_REUSESEQ_SHIFT))
  321. /** returns TRUE if 'd11 sequence reuse' has been agreed upon between host and dongle */
  322. #if defined(BCMPCIEDEV_ENABLED) && !defined(ROM_ENAB_RUNTIME_CHECK)
  323. /* GET_REUSESEQ is always TRUE in pciedev */
  324. #define WLFC_GET_REUSESEQ(x) (TRUE)
  325. #else
  326. #define WLFC_GET_REUSESEQ(x) (((x) >> WLFC_MODE_REUSESEQ_SHIFT) & 1)
  327. #endif /* defined(BCMPCIEDEV_ENABLED) && !defined(ROM_ENAB_RUNTIME_CHECK) */
  328. #define WLFC_MODE_REORDERSUPP_SHIFT 4 /* host reorder suppress pkt bit */
  329. #define WLFC_SET_REORDERSUPP(x, val) ((x) = \
  330. ((x) & ~(1 << WLFC_MODE_REORDERSUPP_SHIFT)) | \
  331. (((val) & 1) << WLFC_MODE_REORDERSUPP_SHIFT))
  332. /** returns TRUE if 'reorder suppress' has been agreed upon between host and dongle */
  333. #define WLFC_GET_REORDERSUPP(x) (((x) >> WLFC_MODE_REORDERSUPP_SHIFT) & 1)
  334. #define FLOW_RING_CREATE 1
  335. #define FLOW_RING_DELETE 2
  336. #define FLOW_RING_FLUSH 3
  337. #define FLOW_RING_OPEN 4
  338. #define FLOW_RING_CLOSED 5
  339. #define FLOW_RING_FLUSHED 6
  340. #define FLOW_RING_TIM_SET 7
  341. #define FLOW_RING_TIM_RESET 8
  342. #define FLOW_RING_FLUSH_TXFIFO 9
  343. #define FLOW_RING_GET_PKT_MAX 10
  344. #define FLOW_RING_RESET_WEIGHT 11
  345. #define FLOW_RING_UPD_PRIOMAP 12
  346. /* bit 7, indicating if is TID(1) or AC(0) mapped info in tid field) */
  347. #define PCIEDEV_IS_AC_TID_MAP_MASK 0x80
  348. #endif /* __wlfc_proto_definitions_h__ */