1 /* 2 * Copyright (C) 1999-2013, 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 381382 2013-01-27 07:13:00Z $ 22 * 23 */ 24 #ifndef __wlfc_proto_definitions_h__ 25 #define __wlfc_proto_definitions_h__ 26 27 /* Use TLV to convey WLFC information. 28 --------------------------------------------------------------------------- 29 | Type | Len | value | Description 30 --------------------------------------------------------------------------- 31 | 1 | 1 | (handle) | MAC OPEN 32 --------------------------------------------------------------------------- 33 | 2 | 1 | (handle) | MAC CLOSE 34 --------------------------------------------------------------------------- 35 | 3 | 2 | (count, handle, prec_bmp)| Set the credit depth for a MAC dstn 36 --------------------------------------------------------------------------- 37 | 4 | 4+ | see pkttag comments | TXSTATUS 38 | | | TX status & timestamps | Present only when pkt timestamp is enabled 39 --------------------------------------------------------------------------- 40 | 5 | 4 | see pkttag comments | PKKTTAG [host->firmware] 41 --------------------------------------------------------------------------- 42 | 6 | 8 | (handle, ifid, MAC) | MAC ADD 43 --------------------------------------------------------------------------- 44 | 7 | 8 | (handle, ifid, MAC) | MAC DEL 45 --------------------------------------------------------------------------- 46 | 8 | 1 | (rssi) | RSSI - RSSI value for the packet. 47 --------------------------------------------------------------------------- 48 | 9 | 1 | (interface ID) | Interface OPEN 49 --------------------------------------------------------------------------- 50 | 10 | 1 | (interface ID) | Interface CLOSE 51 --------------------------------------------------------------------------- 52 | 11 | 8 | fifo credit returns map | FIFO credits back to the host 53 | | | | 54 | | | | -------------------------------------- 55 | | | | | ac0 | ac1 | ac2 | ac3 | bcmc | atim | 56 | | | | -------------------------------------- 57 | | | | 58 --------------------------------------------------------------------------- 59 | 12 | 2 | MAC handle, | Host provides a bitmap of pending 60 | | | AC[0-3] traffic bitmap | unicast traffic for MAC-handle dstn. 61 | | | | [host->firmware] 62 --------------------------------------------------------------------------- 63 | 13 | 3 | (count, handle, prec_bmp)| One time request for packet to a specific 64 | | | | MAC destination. 65 --------------------------------------------------------------------------- 66 | 15 | 12 | (pkttag, timestamps) | Send TX timestamp at reception from host 67 --------------------------------------------------------------------------- 68 | 16 | 12 | (pkttag, timestamps) | Send WLAN RX timestamp along with RX frame 69 --------------------------------------------------------------------------- 70 | 255 | N/A | N/A | FILLER - This is a special type 71 | | | | that has no length or value. 72 | | | | Typically used for padding. 73 --------------------------------------------------------------------------- 74 */ 75 76 #define WLFC_CTL_TYPE_MAC_OPEN 1 77 #define WLFC_CTL_TYPE_MAC_CLOSE 2 78 #define WLFC_CTL_TYPE_MAC_REQUEST_CREDIT 3 79 #define WLFC_CTL_TYPE_TXSTATUS 4 80 #define WLFC_CTL_TYPE_PKTTAG 5 81 82 #define WLFC_CTL_TYPE_MACDESC_ADD 6 83 #define WLFC_CTL_TYPE_MACDESC_DEL 7 84 #define WLFC_CTL_TYPE_RSSI 8 85 86 #define WLFC_CTL_TYPE_INTERFACE_OPEN 9 87 #define WLFC_CTL_TYPE_INTERFACE_CLOSE 10 88 89 #define WLFC_CTL_TYPE_FIFO_CREDITBACK 11 90 91 #define WLFC_CTL_TYPE_PENDING_TRAFFIC_BMP 12 92 #define WLFC_CTL_TYPE_MAC_REQUEST_PACKET 13 93 #define WLFC_CTL_TYPE_HOST_REORDER_RXPKTS 14 94 95 #define WLFC_CTL_TYPE_TX_ENTRY_STAMP 15 96 #define WLFC_CTL_TYPE_RX_STAMP 16 97 98 #define WLFC_CTL_TYPE_TRANS_ID 18 99 #define WLFC_CTL_TYPE_COMP_TXSTATUS 19 100 101 102 #define WLFC_CTL_TYPE_FILLER 255 103 104 #define WLFC_CTL_VALUE_LEN_MACDESC 8 /* handle, interface, MAC */ 105 106 #define WLFC_CTL_VALUE_LEN_MAC 1 /* MAC-handle */ 107 #define WLFC_CTL_VALUE_LEN_RSSI 1 108 109 #define WLFC_CTL_VALUE_LEN_INTERFACE 1 110 #define WLFC_CTL_VALUE_LEN_PENDING_TRAFFIC_BMP 2 111 112 #define WLFC_CTL_VALUE_LEN_TXSTATUS 4 113 #define WLFC_CTL_VALUE_LEN_PKTTAG 4 114 115 /* enough space to host all 4 ACs, bc/mc and atim fifo credit */ 116 #define WLFC_CTL_VALUE_LEN_FIFO_CREDITBACK 6 117 118 #define WLFC_CTL_VALUE_LEN_REQUEST_CREDIT 3 /* credit, MAC-handle, prec_bitmap */ 119 #define WLFC_CTL_VALUE_LEN_REQUEST_PACKET 3 /* credit, MAC-handle, prec_bitmap */ 120 121 122 #define WLFC_PKTID_GEN_MASK 0x80000000 123 #define WLFC_PKTID_GEN_SHIFT 31 124 125 #define WLFC_PKTID_GEN(x) (((x) & WLFC_PKTID_GEN_MASK) >> WLFC_PKTID_GEN_SHIFT) 126 #define WLFC_PKTID_SETGEN(x, gen) (x) = ((x) & ~WLFC_PKTID_GEN_MASK) | \ 127 (((gen) << WLFC_PKTID_GEN_SHIFT) & WLFC_PKTID_GEN_MASK) 128 129 #define WLFC_PKTFLAG_PKTFROMHOST 0x01 130 #define WLFC_PKTFLAG_PKT_REQUESTED 0x02 131 132 #define WL_TXSTATUS_FLAGS_MASK 0xf /* allow 4 bits only */ 133 #define WL_TXSTATUS_FLAGS_SHIFT 27 134 135 #define WL_TXSTATUS_SET_FLAGS(x, flags) ((x) = \ 136 ((x) & ~(WL_TXSTATUS_FLAGS_MASK << WL_TXSTATUS_FLAGS_SHIFT)) | \ 137 (((flags) & WL_TXSTATUS_FLAGS_MASK) << WL_TXSTATUS_FLAGS_SHIFT)) 138 #define WL_TXSTATUS_GET_FLAGS(x) (((x) >> WL_TXSTATUS_FLAGS_SHIFT) & \ 139 WL_TXSTATUS_FLAGS_MASK) 140 141 #define WL_TXSTATUS_FIFO_MASK 0x7 /* allow 3 bits for FIFO ID */ 142 #define WL_TXSTATUS_FIFO_SHIFT 24 143 144 #define WL_TXSTATUS_SET_FIFO(x, flags) ((x) = \ 145 ((x) & ~(WL_TXSTATUS_FIFO_MASK << WL_TXSTATUS_FIFO_SHIFT)) | \ 146 (((flags) & WL_TXSTATUS_FIFO_MASK) << WL_TXSTATUS_FIFO_SHIFT)) 147 #define WL_TXSTATUS_GET_FIFO(x) (((x) >> WL_TXSTATUS_FIFO_SHIFT) & WL_TXSTATUS_FIFO_MASK) 148 149 #define WL_TXSTATUS_PKTID_MASK 0xffffff /* allow 24 bits */ 150 #define WL_TXSTATUS_SET_PKTID(x, num) ((x) = \ 151 ((x) & ~WL_TXSTATUS_PKTID_MASK) | (num)) 152 #define WL_TXSTATUS_GET_PKTID(x) ((x) & WL_TXSTATUS_PKTID_MASK) 153 154 /* 32 STA should be enough??, 6 bits; Must be power of 2 */ 155 #define WLFC_MAC_DESC_TABLE_SIZE 32 156 #define WLFC_MAX_IFNUM 16 157 #define WLFC_MAC_DESC_ID_INVALID 0xff 158 159 /* b[7:5] -reuse guard, b[4:0] -value */ 160 #define WLFC_MAC_DESC_GET_LOOKUP_INDEX(x) ((x) & 0x1f) 161 162 #define WLFC_PKTFLAG_SET_PKTREQUESTED(x) (x) |= \ 163 (WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT) 164 165 #define WLFC_PKTFLAG_CLR_PKTREQUESTED(x) (x) &= \ 166 ~(WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT) 167 168 #define WL_TXSTATUS_GENERATION_MASK 1 169 #define WL_TXSTATUS_GENERATION_SHIFT 31 170 171 #define WLFC_PKTFLAG_SET_GENERATION(x, gen) ((x) = \ 172 ((x) & ~(WL_TXSTATUS_GENERATION_MASK << WL_TXSTATUS_GENERATION_SHIFT)) | \ 173 (((gen) & WL_TXSTATUS_GENERATION_MASK) << WL_TXSTATUS_GENERATION_SHIFT)) 174 175 #define WLFC_PKTFLAG_GENERATION(x) (((x) >> WL_TXSTATUS_GENERATION_SHIFT) & \ 176 WL_TXSTATUS_GENERATION_MASK) 177 178 #define WLFC_MAX_PENDING_DATALEN 120 179 180 /* host is free to discard the packet */ 181 #define WLFC_CTL_PKTFLAG_DISCARD 0 182 /* D11 suppressed a packet */ 183 #define WLFC_CTL_PKTFLAG_D11SUPPRESS 1 184 /* WL firmware suppressed a packet because MAC is 185 already in PSMode (short time window) 186 */ 187 #define WLFC_CTL_PKTFLAG_WLSUPPRESS 2 188 /* Firmware tossed this packet */ 189 #define WLFC_CTL_PKTFLAG_TOSSED_BYWLC 3 190 191 #define WLFC_D11_STATUS_INTERPRET(txs) \ 192 (((txs)->status.suppr_ind != 0) ? WLFC_CTL_PKTFLAG_D11SUPPRESS : WLFC_CTL_PKTFLAG_DISCARD) 193 194 #ifdef PROP_TXSTATUS_DEBUG 195 #define WLFC_DBGMESG(x) printf x 196 /* wlfc-breadcrumb */ 197 #define WLFC_BREADCRUMB(x) do {if ((x) == NULL) \ 198 {printf("WLFC: %s():%d:caller:%p\n", \ 199 __FUNCTION__, __LINE__, __builtin_return_address(0));}} while (0) 200 #define WLFC_PRINTMAC(banner, ea) do {printf("%s MAC: [%02x:%02x:%02x:%02x:%02x:%02x]\n", \ 201 banner, ea[0], ea[1], ea[2], ea[3], ea[4], ea[5]); } while (0) 202 #define WLFC_WHEREIS(s) printf("WLFC: at %s():%d, %s\n", __FUNCTION__, __LINE__, (s)) 203 #else 204 #define WLFC_DBGMESG(x) 205 #define WLFC_BREADCRUMB(x) 206 #define WLFC_PRINTMAC(banner, ea) 207 #define WLFC_WHEREIS(s) 208 #endif 209 210 /* AMPDU host reorder packet flags */ 211 #define WLHOST_REORDERDATA_MAXFLOWS 256 212 #define WLHOST_REORDERDATA_LEN 10 213 #define WLHOST_REORDERDATA_TOTLEN (WLHOST_REORDERDATA_LEN + 1 + 1) /* +tag +len */ 214 215 #define WLHOST_REORDERDATA_FLOWID_OFFSET 0 216 #define WLHOST_REORDERDATA_MAXIDX_OFFSET 2 217 #define WLHOST_REORDERDATA_FLAGS_OFFSET 4 218 #define WLHOST_REORDERDATA_CURIDX_OFFSET 6 219 #define WLHOST_REORDERDATA_EXPIDX_OFFSET 8 220 221 #define WLHOST_REORDERDATA_DEL_FLOW 0x01 222 #define WLHOST_REORDERDATA_FLUSH_ALL 0x02 223 #define WLHOST_REORDERDATA_CURIDX_VALID 0x04 224 #define WLHOST_REORDERDATA_EXPIDX_VALID 0x08 225 #define WLHOST_REORDERDATA_NEW_HOLE 0x10 226 227 /* transaction id data len byte 0: rsvd, byte 1: seqnumber, byte 2-5 will be used for timestampe */ 228 #define WLFC_CTL_TRANS_ID_LEN 6 229 230 #endif /* __wlfc_proto_definitions_h__ */ 231