PageRenderTime 24ms CodeModel.GetById 36ms RepoModel.GetById 1ms app.codeStats 0ms

/drivers/net/wireless/bcmdhd_b1/src/include/wlfc_proto.h

https://bitbucket.org/cyanogenmod/lge-kernel-iproj
C Header | 216 lines | 101 code | 38 blank | 77 comment | 4 complexity | 632219a4683daa4aa7597da208f55057 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
  1. /*
  2. * Copyright (C) 1999-2012, Broadcom Corporation
  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. * 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.
  21. * $Id: wlfc_proto.h 309193 2012-01-19 00:03:57Z $
  22. *
  23. */
  24. #ifndef __wlfc_proto_definitions_h__
  25. #define __wlfc_proto_definitions_h__
  26. /* Use TLV to convey WLFC information.
  27. ---------------------------------------------------------------------------
  28. | Type | Len | value | Description
  29. ---------------------------------------------------------------------------
  30. | 1 | 1 | (handle) | MAC OPEN
  31. ---------------------------------------------------------------------------
  32. | 2 | 1 | (handle) | MAC CLOSE
  33. ---------------------------------------------------------------------------
  34. | 3 | 2 | (count, handle, prec_bmp)| Set the credit depth for a MAC dstn
  35. ---------------------------------------------------------------------------
  36. | 4 | 4 | see pkttag comments | TXSTATUS
  37. ---------------------------------------------------------------------------
  38. | 5 | 4 | see pkttag comments | PKKTTAG [host->firmware]
  39. ---------------------------------------------------------------------------
  40. | 6 | 8 | (handle, ifid, MAC) | MAC ADD
  41. ---------------------------------------------------------------------------
  42. | 7 | 8 | (handle, ifid, MAC) | MAC DEL
  43. ---------------------------------------------------------------------------
  44. | 8 | 1 | (rssi) | RSSI - RSSI value for the packet.
  45. ---------------------------------------------------------------------------
  46. | 9 | 1 | (interface ID) | Interface OPEN
  47. ---------------------------------------------------------------------------
  48. | 10 | 1 | (interface ID) | Interface CLOSE
  49. ---------------------------------------------------------------------------
  50. | 11 | 8 | fifo credit returns map | FIFO credits back to the host
  51. | | | |
  52. | | | | --------------------------------------
  53. | | | | | ac0 | ac1 | ac2 | ac3 | bcmc | atim |
  54. | | | | --------------------------------------
  55. | | | |
  56. ---------------------------------------------------------------------------
  57. | 12 | 2 | MAC handle, | Host provides a bitmap of pending
  58. | | | AC[0-3] traffic bitmap | unicast traffic for MAC-handle dstn.
  59. | | | | [host->firmware]
  60. ---------------------------------------------------------------------------
  61. | 13 | 3 | (count, handle, prec_bmp)| One time request for packet to a specific
  62. | | | | MAC destination.
  63. ---------------------------------------------------------------------------
  64. | 255 | N/A | N/A | FILLER - This is a special type
  65. | | | | that has no length or value.
  66. | | | | Typically used for padding.
  67. ---------------------------------------------------------------------------
  68. */
  69. #define WLFC_CTL_TYPE_MAC_OPEN 1
  70. #define WLFC_CTL_TYPE_MAC_CLOSE 2
  71. #define WLFC_CTL_TYPE_MAC_REQUEST_CREDIT 3
  72. #define WLFC_CTL_TYPE_TXSTATUS 4
  73. #define WLFC_CTL_TYPE_PKTTAG 5
  74. #define WLFC_CTL_TYPE_MACDESC_ADD 6
  75. #define WLFC_CTL_TYPE_MACDESC_DEL 7
  76. #define WLFC_CTL_TYPE_RSSI 8
  77. #define WLFC_CTL_TYPE_INTERFACE_OPEN 9
  78. #define WLFC_CTL_TYPE_INTERFACE_CLOSE 10
  79. #define WLFC_CTL_TYPE_FIFO_CREDITBACK 11
  80. #define WLFC_CTL_TYPE_PENDING_TRAFFIC_BMP 12
  81. #define WLFC_CTL_TYPE_MAC_REQUEST_PACKET 13
  82. #define WLFC_CTL_TYPE_HOST_REORDER_RXPKTS 14
  83. #define WLFC_CTL_TYPE_FILLER 255
  84. #define WLFC_CTL_VALUE_LEN_MACDESC 8 /* handle, interface, MAC */
  85. #define WLFC_CTL_VALUE_LEN_MAC 1 /* MAC-handle */
  86. #define WLFC_CTL_VALUE_LEN_RSSI 1
  87. #define WLFC_CTL_VALUE_LEN_INTERFACE 1
  88. #define WLFC_CTL_VALUE_LEN_PENDING_TRAFFIC_BMP 2
  89. #define WLFC_CTL_VALUE_LEN_TXSTATUS 4
  90. #define WLFC_CTL_VALUE_LEN_PKTTAG 4
  91. /* enough space to host all 4 ACs, bc/mc and atim fifo credit */
  92. #define WLFC_CTL_VALUE_LEN_FIFO_CREDITBACK 6
  93. #define WLFC_CTL_VALUE_LEN_REQUEST_CREDIT 3 /* credit, MAC-handle, prec_bitmap */
  94. #define WLFC_CTL_VALUE_LEN_REQUEST_PACKET 3 /* credit, MAC-handle, prec_bitmap */
  95. #define WLFC_PKTID_GEN_MASK 0x80000000
  96. #define WLFC_PKTID_GEN_SHIFT 31
  97. #define WLFC_PKTID_GEN(x) (((x) & WLFC_PKTID_GEN_MASK) >> WLFC_PKTID_GEN_SHIFT)
  98. #define WLFC_PKTID_SETGEN(x, gen) (x) = ((x) & ~WLFC_PKTID_GEN_MASK) | \
  99. (((gen) << WLFC_PKTID_GEN_SHIFT) & WLFC_PKTID_GEN_MASK)
  100. #define WLFC_PKTFLAG_PKTFROMHOST 0x01
  101. #define WLFC_PKTFLAG_PKT_REQUESTED 0x02
  102. #define WL_TXSTATUS_FLAGS_MASK 0xf /* allow 4 bits only */
  103. #define WL_TXSTATUS_FLAGS_SHIFT 27
  104. #define WL_TXSTATUS_SET_FLAGS(x, flags) ((x) = \
  105. ((x) & ~(WL_TXSTATUS_FLAGS_MASK << WL_TXSTATUS_FLAGS_SHIFT)) | \
  106. (((flags) & WL_TXSTATUS_FLAGS_MASK) << WL_TXSTATUS_FLAGS_SHIFT))
  107. #define WL_TXSTATUS_GET_FLAGS(x) (((x) >> WL_TXSTATUS_FLAGS_SHIFT) & \
  108. WL_TXSTATUS_FLAGS_MASK)
  109. #define WL_TXSTATUS_FIFO_MASK 0x7 /* allow 3 bits for FIFO ID */
  110. #define WL_TXSTATUS_FIFO_SHIFT 24
  111. #define WL_TXSTATUS_SET_FIFO(x, flags) ((x) = \
  112. ((x) & ~(WL_TXSTATUS_FIFO_MASK << WL_TXSTATUS_FIFO_SHIFT)) | \
  113. (((flags) & WL_TXSTATUS_FIFO_MASK) << WL_TXSTATUS_FIFO_SHIFT))
  114. #define WL_TXSTATUS_GET_FIFO(x) (((x) >> WL_TXSTATUS_FIFO_SHIFT) & WL_TXSTATUS_FIFO_MASK)
  115. #define WL_TXSTATUS_PKTID_MASK 0xffffff /* allow 24 bits */
  116. #define WL_TXSTATUS_SET_PKTID(x, num) ((x) = \
  117. ((x) & ~WL_TXSTATUS_PKTID_MASK) | (num))
  118. #define WL_TXSTATUS_GET_PKTID(x) ((x) & WL_TXSTATUS_PKTID_MASK)
  119. /* 32 STA should be enough??, 6 bits; Must be power of 2 */
  120. #define WLFC_MAC_DESC_TABLE_SIZE 32
  121. #define WLFC_MAX_IFNUM 16
  122. #define WLFC_MAC_DESC_ID_INVALID 0xff
  123. /* b[7:5] -reuse guard, b[4:0] -value */
  124. #define WLFC_MAC_DESC_GET_LOOKUP_INDEX(x) ((x) & 0x1f)
  125. #define WLFC_PKTFLAG_SET_PKTREQUESTED(x) (x) |= \
  126. (WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT)
  127. #define WLFC_PKTFLAG_CLR_PKTREQUESTED(x) (x) &= \
  128. ~(WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT)
  129. #define WL_TXSTATUS_GENERATION_MASK 1
  130. #define WL_TXSTATUS_GENERATION_SHIFT 31
  131. #define WLFC_PKTFLAG_SET_GENERATION(x, gen) ((x) = \
  132. ((x) & ~(WL_TXSTATUS_GENERATION_MASK << WL_TXSTATUS_GENERATION_SHIFT)) | \
  133. (((gen) & WL_TXSTATUS_GENERATION_MASK) << WL_TXSTATUS_GENERATION_SHIFT))
  134. #define WLFC_PKTFLAG_GENERATION(x) (((x) >> WL_TXSTATUS_GENERATION_SHIFT) & \
  135. WL_TXSTATUS_GENERATION_MASK)
  136. #define WLFC_MAX_PENDING_DATALEN 120
  137. /* host is free to discard the packet */
  138. #define WLFC_CTL_PKTFLAG_DISCARD 0
  139. /* D11 suppressed a packet */
  140. #define WLFC_CTL_PKTFLAG_D11SUPPRESS 1
  141. /* WL firmware suppressed a packet because MAC is
  142. already in PSMode (short time window)
  143. */
  144. #define WLFC_CTL_PKTFLAG_WLSUPPRESS 2
  145. /* Firmware tossed this packet */
  146. #define WLFC_CTL_PKTFLAG_TOSSED_BYWLC 3
  147. #define WLFC_D11_STATUS_INTERPRET(txs) \
  148. (((txs)->status.suppr_ind != 0) ? WLFC_CTL_PKTFLAG_D11SUPPRESS : WLFC_CTL_PKTFLAG_DISCARD)
  149. #ifdef PROP_TXSTATUS_DEBUG
  150. #define WLFC_DBGMESG(x) printf x
  151. /* wlfc-breadcrumb */
  152. #define WLFC_BREADCRUMB(x) do {if ((x) == NULL) \
  153. {printf("WLFC: %s():%d:caller:%p\n", \
  154. __FUNCTION__, __LINE__, __builtin_return_address(0));}} while (0)
  155. #define WLFC_PRINTMAC(banner, ea) do {printf("%s MAC: [%02x:%02x:%02x:%02x:%02x:%02x]\n", \
  156. banner, ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]); } while (0)
  157. #define WLFC_WHEREIS(s) printf("WLFC: at %s():%d, %s\n", __FUNCTION__, __LINE__, (s))
  158. #else
  159. #define WLFC_DBGMESG(x)
  160. #define WLFC_BREADCRUMB(x)
  161. #define WLFC_PRINTMAC(banner, ea)
  162. #define WLFC_WHEREIS(s)
  163. #endif
  164. /* AMPDU host reorder packet flags */
  165. #define WLHOST_REORDERDATA_MAXFLOWS 256
  166. #define WLHOST_REORDERDATA_LEN 10
  167. #define WLHOST_REORDERDATA_TOTLEN (WLHOST_REORDERDATA_LEN + 1 + 1) /* +tag +len */
  168. #define WLHOST_REORDERDATA_FLOWID_OFFSET 0
  169. #define WLHOST_REORDERDATA_MAXIDX_OFFSET 2
  170. #define WLHOST_REORDERDATA_FLAGS_OFFSET 4
  171. #define WLHOST_REORDERDATA_CURIDX_OFFSET 6
  172. #define WLHOST_REORDERDATA_EXPIDX_OFFSET 8
  173. #define WLHOST_REORDERDATA_DEL_FLOW 0x01
  174. #define WLHOST_REORDERDATA_FLUSH_ALL 0x02
  175. #define WLHOST_REORDERDATA_CURIDX_VALID 0x04
  176. #define WLHOST_REORDERDATA_EXPIDX_VALID 0x08
  177. #define WLHOST_REORDERDATA_NEW_HOLE 0x10
  178. #endif /* __wlfc_proto_definitions_h__ */