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, /* open flowring/s with tid */ 106 WLFC_CTL_TYPE_TID_CLOSE = 21, /* close flowring/s with tid */ 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, /* open flowring with flowid */ 114 WLFC_CTL_TYPE_FLOWID_CLOSE = 27, /* close flowring with flowid */ 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, /* Upd flow's max rate dynamically */ 120 WLFC_CTL_TYPE_AMSDU_STATE = 30, /* Upd flow's AMSDU state(Enabled/Disabled) */ 121 WLFC_CTL_TYPE_APP_STATE = 31, /* Upd flow's APP state, enable/disable APP */ 122 WLFC_CTL_TYPE_HP2P_EXT_TXSTATUS = 32, /* Hp2p extended tx status */ 123 WLFC_CTL_TYPE_HP2P_ACTIVE_STATE = 33, /* Get status of HP2P ring active or not */ 124 WLFC_CTL_TYPE_HP2P_QUERY_LIFETIME = 34, /* Query lifetime for last unacked */ 125 WLFC_CTL_TYPE_FILLER = 255 126 } wlfc_ctl_type_t; 127 128 #define WLFC_CTL_VALUE_LEN_FLOWID 2u /* flowid legth in TLV */ 129 130 #define WLFC_CTL_VALUE_LEN_MACDESC 8u /** handle, interface, MAC */ 131 132 #define WLFC_CTL_VALUE_LEN_MAC 1u /** MAC-handle */ 133 #define WLFC_CTL_VALUE_LEN_RSSI 1u 134 135 #define WLFC_CTL_VALUE_LEN_INTERFACE 1u 136 #define WLFC_CTL_VALUE_LEN_PENDING_TRAFFIC_BMP 2u 137 138 #define WLFC_CTL_VALUE_LEN_TXSTATUS 4u 139 #define WLFC_CTL_VALUE_LEN_PKTTAG 4u 140 #define WLFC_CTL_VALUE_LEN_TIMESTAMP 12u /** 4-byte rate info + 2 TSF */ 141 142 #define WLFC_CTL_VALUE_LEN_SEQ 2u 143 #define WLFC_CTL_VALUE_LEN_TID 3u /* interface index, TID */ 144 145 #define WLFC_CTL_EXT_TXSTATUS_PAYLOAD_LEN 8u /* Payload legnth of extention tx status */ 146 147 /* Reset the flags set for the corresponding flowring of the SCB which is de-inited */ 148 /* FLOW_RING_FLAG_LAST_TIM | FLOW_RING_FLAG_INFORM_PKTPEND | FLOW_RING_FLAG_PKT_REQ */ 149 #define WLFC_RESET_ALL_FLAGS 0 150 #define WLFC_CTL_VALUE_LEN_FLAGS 7 /** flags, MAC */ 151 152 /* free the data stored to be used for suppressed packets in future */ 153 #define WLFC_CTL_VALUE_LEN_SUPR 8 /** ifindex, tid, MAC */ 154 155 #define WLFC_CTL_VALUE_LEN_SCB_RATESEL_CHANGE 7 /* ifindex, MAC */ 156 /* enough space to host all 4 ACs, bc/mc and atim fifo credit */ 157 #define WLFC_CTL_VALUE_LEN_FIFO_CREDITBACK 6 158 159 #define WLFC_CTL_VALUE_LEN_REQUEST_CREDIT 3 /* credit, MAC-handle, prec_bitmap */ 160 #define WLFC_CTL_VALUE_LEN_REQUEST_PACKET 3 /* credit, MAC-handle, prec_bitmap */ 161 162 /* 163 WLFC packet identifier: b[31:0] (WLFC_CTL_TYPE_PKTTAG) 164 165 Generation : b[31] => generation number for this packet [host->fw] 166 OR, current generation number [fw->host] 167 Flags : b[30:27] => command, status flags 168 FIFO-AC : b[26:24] => AC-FIFO id 169 170 h-slot : b[23:8] => hanger-slot 171 freerun : b[7:0] => A free running counter? 172 173 As far as the firmware is concerned, host generated b[23:0] should be just 174 reflected back on txstatus. 175 */ 176 177 #ifndef WLFC_PKTFLAG_COMPAT 178 #define WLFC_PKTFLAG_PKTFROMHOST 0x01 179 #define WLFC_PKTFLAG_PKT_REQUESTED 0x02 180 #define WLFC_PKTFLAG_PKT_SENDTOHOST 0x04 181 #define WLFC_PKTFLAG_PKT_FLUSHED 0x08 182 #else 183 #define WLFC_PKTFLAG_PKTFROMHOST_MASK 0x01 184 #define WLFC_PKTFLAG_PKT_REQUESTED_MASK 0x02 185 #define WLFC_PKTFLAG_PKT_SENDTOHOST_MASK 0x04 186 #define WLFC_PKTFLAG_PKT_FLUSHED_MASK 0x08 187 #endif /* WLFC_PKTFLAG_COMPAT */ 188 189 #define WL_TXSTATUS_STATUS_MASK 0xff /* allow 8 bits */ 190 #define WL_TXSTATUS_STATUS_SHIFT 24 191 192 #define WL_TXSTATUS_SET_STATUS(x, status) ((x) = \ 193 ((x) & ~(WL_TXSTATUS_STATUS_MASK << WL_TXSTATUS_STATUS_SHIFT)) | \ 194 (((status) & WL_TXSTATUS_STATUS_MASK) << WL_TXSTATUS_STATUS_SHIFT)) 195 #define WL_TXSTATUS_GET_STATUS(x) (((x) >> WL_TXSTATUS_STATUS_SHIFT) & \ 196 WL_TXSTATUS_STATUS_MASK) 197 198 /** 199 * Bit 31 of the 32-bit packet tag is defined as 'generation ID'. It is set by the host to the 200 * "current" generation, and by the firmware to the "expected" generation, toggling on suppress. The 201 * firmware accepts a packet when the generation matches; on reset (startup) both "current" and 202 * "expected" are set to 0. 203 */ 204 #define WL_TXSTATUS_GENERATION_MASK 1 /* allow 1 bit */ 205 #define WL_TXSTATUS_GENERATION_SHIFT 31 206 207 #define WL_TXSTATUS_SET_GENERATION(x, gen) ((x) = \ 208 ((x) & ~(WL_TXSTATUS_GENERATION_MASK << WL_TXSTATUS_GENERATION_SHIFT)) | \ 209 (((gen) & WL_TXSTATUS_GENERATION_MASK) << WL_TXSTATUS_GENERATION_SHIFT)) 210 211 #define WL_TXSTATUS_GET_GENERATION(x) (((x) >> WL_TXSTATUS_GENERATION_SHIFT) & \ 212 WL_TXSTATUS_GENERATION_MASK) 213 214 #define WL_TXSTATUS_FLAGS_MASK 0xf /* allow 4 bits only */ 215 #define WL_TXSTATUS_FLAGS_SHIFT 27 216 217 #define WL_TXSTATUS_SET_FLAGS(x, flags) ((x) = \ 218 ((x) & ~(WL_TXSTATUS_FLAGS_MASK << WL_TXSTATUS_FLAGS_SHIFT)) | \ 219 (((flags) & WL_TXSTATUS_FLAGS_MASK) << WL_TXSTATUS_FLAGS_SHIFT)) 220 #define WL_TXSTATUS_GET_FLAGS(x) (((x) >> WL_TXSTATUS_FLAGS_SHIFT) & \ 221 WL_TXSTATUS_FLAGS_MASK) 222 #define WL_TXSTATUS_CLEAR_FLAGS(x, flags) ((x) = \ 223 ((x) & ~(((flags) & WL_TXSTATUS_FLAGS_MASK) << WL_TXSTATUS_FLAGS_SHIFT))) 224 225 #define WL_TXSTATUS_FIFO_MASK 0x7 /* allow 3 bits for FIFO ID */ 226 #define WL_TXSTATUS_FIFO_SHIFT 24 227 228 #define WL_TXSTATUS_SET_FIFO(x, flags) ((x) = \ 229 ((x) & ~(WL_TXSTATUS_FIFO_MASK << WL_TXSTATUS_FIFO_SHIFT)) | \ 230 (((flags) & WL_TXSTATUS_FIFO_MASK) << WL_TXSTATUS_FIFO_SHIFT)) 231 #define WL_TXSTATUS_GET_FIFO(x) (((x) >> WL_TXSTATUS_FIFO_SHIFT) & WL_TXSTATUS_FIFO_MASK) 232 233 #define WL_TXSTATUS_PKTID_MASK 0xffffff /* allow 24 bits */ 234 #define WL_TXSTATUS_SET_PKTID(x, num) ((x) = \ 235 ((x) & ~WL_TXSTATUS_PKTID_MASK) | (num)) 236 #define WL_TXSTATUS_GET_PKTID(x) ((x) & WL_TXSTATUS_PKTID_MASK) 237 238 #define WL_TXSTATUS_HSLOT_MASK 0xffff /* allow 16 bits */ 239 #define WL_TXSTATUS_HSLOT_SHIFT 8 240 241 #define WL_TXSTATUS_SET_HSLOT(x, hslot) ((x) = \ 242 ((x) & ~(WL_TXSTATUS_HSLOT_MASK << WL_TXSTATUS_HSLOT_SHIFT)) | \ 243 (((hslot) & WL_TXSTATUS_HSLOT_MASK) << WL_TXSTATUS_HSLOT_SHIFT)) 244 #define WL_TXSTATUS_GET_HSLOT(x) (((x) >> WL_TXSTATUS_HSLOT_SHIFT)& \ 245 WL_TXSTATUS_HSLOT_MASK) 246 247 #define WL_TXSTATUS_FREERUNCTR_MASK 0xff /* allow 8 bits */ 248 249 #define WL_TXSTATUS_SET_FREERUNCTR(x, ctr) ((x) = \ 250 ((x) & ~(WL_TXSTATUS_FREERUNCTR_MASK)) | \ 251 ((ctr) & WL_TXSTATUS_FREERUNCTR_MASK)) 252 #define WL_TXSTATUS_GET_FREERUNCTR(x) ((x)& WL_TXSTATUS_FREERUNCTR_MASK) 253 254 /* packet prio phase bit updated */ 255 #define WL_SEQ_PKTPRIO_PHASE_MASK 0x1 256 #define WL_SEQ_PKTPRIO_PHASE_SHIFT 15 257 #define WL_SEQ_SET_PKTPRIO_PHASE(x, val) ((x) = \ 258 ((x) & ~(WL_SEQ_PKTPRIO_PHASE_MASK << WL_SEQ_PKTPRIO_PHASE_SHIFT)) | \ 259 (((val) & WL_SEQ_PKTPRIO_PHASE_MASK) << WL_SEQ_PKTPRIO_PHASE_SHIFT)) 260 #define WL_SEQ_PKTPRIO_PHASE(x) (((x) >> WL_SEQ_PKTPRIO_PHASE_SHIFT) & \ 261 WL_SEQ_PKTPRIO_PHASE_MASK) 262 263 /* AMSDU part of d11 seq number */ 264 #define WL_SEQ_AMSDU_MASK 0x1 /* allow 1 bit */ 265 #define WL_SEQ_AMSDU_SHIFT 14 266 #define WL_SEQ_SET_AMSDU(x, val) ((x) = \ 267 ((x) & ~(WL_SEQ_AMSDU_MASK << WL_SEQ_AMSDU_SHIFT)) | \ 268 (((val) & WL_SEQ_AMSDU_MASK) << WL_SEQ_AMSDU_SHIFT)) /**< sets a single AMSDU bit */ 269 /** returns TRUE if ring item is AMSDU (seq = d11 seq nr) */ 270 #define WL_SEQ_IS_AMSDU(x) (((x) >> WL_SEQ_AMSDU_SHIFT) & \ 271 WL_SEQ_AMSDU_MASK) 272 273 /* indicates last_suppr_seq is valid */ 274 #define WL_SEQ_VALIDSUPPR_MASK 0x1 /* allow 1 bit */ 275 #define WL_SEQ_VALIDSUPPR_SHIFT 12 276 #define WL_SEQ_SET_VALIDSUPPR(x, val) ((x) = \ 277 ((x) & ~(WL_SEQ_VALIDSUPPR_MASK << WL_SEQ_VALIDSUPPR_SHIFT)) | \ 278 (((val) & WL_SEQ_VALIDSUPPR_MASK) << WL_SEQ_VALIDSUPPR_SHIFT)) 279 #define WL_SEQ_GET_VALIDSUPPR(x) (((x) >> WL_SEQ_VALIDSUPPR_SHIFT) & \ 280 WL_SEQ_VALIDSUPPR_MASK) 281 282 #define WL_SEQ_FROMFW_MASK 0x1 /* allow 1 bit */ 283 #define WL_SEQ_FROMFW_SHIFT 13 284 #define WL_SEQ_SET_FROMFW(x, val) ((x) = \ 285 ((x) & ~(WL_SEQ_FROMFW_MASK << WL_SEQ_FROMFW_SHIFT)) | \ 286 (((val) & WL_SEQ_FROMFW_MASK) << WL_SEQ_FROMFW_SHIFT)) 287 /** Set when firmware assigns D11 sequence number to packet */ 288 #define SET_WL_HAS_ASSIGNED_SEQ(x) WL_SEQ_SET_FROMFW((x), 1) 289 290 /** returns TRUE if packet has been assigned a d11 seq number by the WL firmware layer */ 291 #define GET_WL_HAS_ASSIGNED_SEQ(x) (((x) >> WL_SEQ_FROMFW_SHIFT) & WL_SEQ_FROMFW_MASK) 292 293 #ifdef WLFC_PKTFLAG_COMPAT 294 /* Helper macros for WLFC pktflags */ 295 #define WLFC_PKTFLAG_PKTFROMHOST(p) \ 296 (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKTFROMHOST_MASK) 297 #define WLFC_PKTFLAG_PKT_REQUESTED(p) \ 298 (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKT_REQUESTED_MASK) 299 #define WLFC_PKTFLAG_PKT_SENDTOHOST(p) \ 300 (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKT_SENDTOHOST_MASK) 301 #define WLFC_PKTFLAG_PKT_FLUSHED(p) \ 302 (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKT_FLUSHED_MASK) 303 #endif /* WLFC_PKTFLAG_COMPAT */ 304 305 /** 306 * Proptxstatus related. 307 * 308 * When a packet is suppressed by WL or the D11 core, the packet has to be retried. Assigning 309 * a new d11 sequence number for the packet when retrying would cause the peer to be unable to 310 * reorder the packets within an AMPDU. So, suppressed packet from bus layer (DHD for SDIO and 311 * pciedev for PCIE) is re-using d11 seq number, so FW should not assign a new one. 312 */ 313 #define WL_SEQ_FROMDRV_MASK 0x1 /* allow 1 bit */ 314 #define WL_SEQ_FROMDRV_SHIFT 12 315 316 /** 317 * Proptxstatus, host or fw PCIe layer requests WL layer to reuse d11 seq no. Bit is reset by WL 318 * subsystem when it reuses the seq number. 319 */ 320 #define WL_SEQ_SET_REUSE(x, val) ((x) = \ 321 ((x) & ~(WL_SEQ_FROMDRV_MASK << WL_SEQ_FROMDRV_SHIFT)) | \ 322 (((val) & WL_SEQ_FROMDRV_MASK) << WL_SEQ_FROMDRV_SHIFT)) 323 #define SET_WL_TO_REUSE_SEQ(x) WL_SEQ_SET_REUSE((x), 1) 324 #define RESET_WL_TO_REUSE_SEQ(x) WL_SEQ_SET_REUSE((x), 0) 325 326 /** Proptxstatus, related to reuse of d11 seq numbers when retransmitting */ 327 #define IS_WL_TO_REUSE_SEQ(x) (((x) >> WL_SEQ_FROMDRV_SHIFT) & \ 328 WL_SEQ_FROMDRV_MASK) 329 330 #define WL_SEQ_NUM_MASK 0xfff /* allow 12 bit */ 331 #define WL_SEQ_NUM_SHIFT 0 332 /** Proptxstatus, sets d11seq no in pkt tag, related to reuse of d11seq no when retransmitting */ 333 #define WL_SEQ_SET_NUM(x, val) ((x) = \ 334 ((x) & ~(WL_SEQ_NUM_MASK << WL_SEQ_NUM_SHIFT)) | \ 335 (((val) & WL_SEQ_NUM_MASK) << WL_SEQ_NUM_SHIFT)) 336 /** Proptxstatus, gets d11seq no from pkt tag, related to reuse of d11seq no when retransmitting */ 337 #define WL_SEQ_GET_NUM(x) (((x) >> WL_SEQ_NUM_SHIFT) & \ 338 WL_SEQ_NUM_MASK) 339 340 #define WL_SEQ_AMSDU_SUPPR_MASK ((WL_SEQ_FROMDRV_MASK << WL_SEQ_FROMDRV_SHIFT) | \ 341 (WL_SEQ_AMSDU_MASK << WL_SEQ_AMSDU_SHIFT) | \ 342 (WL_SEQ_NUM_MASK << WL_SEQ_NUM_SHIFT)) 343 344 /* 32 STA should be enough??, 6 bits; Must be power of 2 */ 345 #define WLFC_MAC_DESC_TABLE_SIZE 32 346 #define WLFC_MAX_IFNUM 16 347 #define WLFC_MAC_DESC_ID_INVALID 0xff 348 349 /* b[7:5] -reuse guard, b[4:0] -value */ 350 #define WLFC_MAC_DESC_GET_LOOKUP_INDEX(x) ((x) & 0x1f) 351 352 #define WLFC_PKTFLAG_SET_PKTREQUESTED(x) (x) |= \ 353 (WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT) 354 355 #define WLFC_PKTFLAG_CLR_PKTREQUESTED(x) (x) &= \ 356 ~(WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT) 357 358 #define WLFC_MAX_PENDING_DATALEN 120 359 360 /* host is free to discard the packet */ 361 #define WLFC_CTL_PKTFLAG_DISCARD 0 362 /* D11 suppressed a packet */ 363 #define WLFC_CTL_PKTFLAG_D11SUPPRESS 1 364 /* WL firmware suppressed a packet because MAC is 365 already in PSMode (short time window) 366 */ 367 #define WLFC_CTL_PKTFLAG_WLSUPPRESS 2 368 /* Firmware tossed this packet */ 369 #define WLFC_CTL_PKTFLAG_TOSSED_BYWLC 3 370 /* Firmware tossed after retries */ 371 #define WLFC_CTL_PKTFLAG_DISCARD_NOACK 4 372 /* Firmware wrongly reported suppressed previously,now fixing to acked */ 373 #define WLFC_CTL_PKTFLAG_SUPPRESS_ACKED 5 374 /* Firmware send this packet expired, lifetime expiration */ 375 #define WLFC_CTL_PKTFLAG_EXPIRED 6 376 /* Firmware drop this packet for any other reason */ 377 #define WLFC_CTL_PKTFLAG_DROPPED 7 378 /* Firmware free this packet */ 379 #define WLFC_CTL_PKTFLAG_MKTFREE 8 380 /* Firmware dropped the frame after suppress retries reached max */ 381 #define WLFC_CTL_PKTFLAG_MAX_SUP_RETR 9 382 383 /* Firmware forced packet lifetime expiry */ 384 #define WLFC_CTL_PKTFLAG_FORCED_EXPIRED 10 385 386 #define WLFC_CTL_PKTFLAG_MASK (0x0f) /* For 4-bit mask with one extra bit */ 387 388 #if defined(PROP_TXSTATUS_DEBUG) && !defined(BINCMP) 389 #define WLFC_DBGMESG(x) printf x 390 /* wlfc-breadcrumb */ 391 #define WLFC_BREADCRUMB(x) do {if ((x) == NULL) \ 392 {printf("WLFC :%d:caller:%p\n", \ 393 __LINE__, CALL_SITE);}} while (0) 394 #define WLFC_WHEREIS(s) printf("WLFC: at %d, %s\n", __LINE__, (s)) 395 #else 396 #define WLFC_DBGMESG(x) 397 #define WLFC_BREADCRUMB(x) 398 #define WLFC_WHEREIS(s) 399 #endif /* PROP_TXSTATUS_DEBUG && !BINCMP */ 400 401 /* AMPDU host reorder packet flags */ 402 #define WLHOST_REORDERDATA_MAXFLOWS 256 403 #define WLHOST_REORDERDATA_LEN 10 404 #define WLHOST_REORDERDATA_TOTLEN (WLHOST_REORDERDATA_LEN + 1 + 1) /* +tag +len */ 405 406 #define WLHOST_REORDERDATA_FLOWID_OFFSET 0 407 #define WLHOST_REORDERDATA_MAXIDX_OFFSET 2 408 #define WLHOST_REORDERDATA_FLAGS_OFFSET 4 409 #define WLHOST_REORDERDATA_CURIDX_OFFSET 6 410 #define WLHOST_REORDERDATA_EXPIDX_OFFSET 8 411 412 #define WLHOST_REORDERDATA_DEL_FLOW 0x01 413 #define WLHOST_REORDERDATA_FLUSH_ALL 0x02 414 #define WLHOST_REORDERDATA_CURIDX_VALID 0x04 415 #define WLHOST_REORDERDATA_EXPIDX_VALID 0x08 416 #define WLHOST_REORDERDATA_NEW_HOLE 0x10 417 418 /* transaction id data len byte 0: rsvd, byte 1: seqnumber, byte 2-5 will be used for timestampe */ 419 #define WLFC_CTL_TRANS_ID_LEN 6 420 #define WLFC_TYPE_TRANS_ID_LEN 6 421 422 #define WLFC_MODE_HANGER 1 /* use hanger */ 423 #define WLFC_MODE_AFQ 2 /* use afq (At Firmware Queue) */ 424 #define WLFC_IS_OLD_DEF(x) ((x & 1) || (x & 2)) 425 426 #define WLFC_MODE_AFQ_SHIFT 2 /* afq bit */ 427 #define WLFC_SET_AFQ(x, val) ((x) = \ 428 ((x) & ~(1 << WLFC_MODE_AFQ_SHIFT)) | \ 429 (((val) & 1) << WLFC_MODE_AFQ_SHIFT)) 430 /** returns TRUE if firmware supports 'at firmware queue' feature */ 431 #define WLFC_GET_AFQ(x) (((x) >> WLFC_MODE_AFQ_SHIFT) & 1) 432 433 #define WLFC_MODE_REUSESEQ_SHIFT 3 /* seq reuse bit */ 434 #define WLFC_SET_REUSESEQ(x, val) ((x) = \ 435 ((x) & ~(1 << WLFC_MODE_REUSESEQ_SHIFT)) | \ 436 (((val) & 1) << WLFC_MODE_REUSESEQ_SHIFT)) 437 438 /** returns TRUE if 'd11 sequence reuse' has been agreed upon between host and dongle */ 439 #if defined(BCMPCIEDEV_ENABLED) && !defined(ROM_ENAB_RUNTIME_CHECK) 440 /* GET_REUSESEQ is always TRUE in pciedev */ 441 #define WLFC_GET_REUSESEQ(x) (TRUE) 442 #else 443 #define WLFC_GET_REUSESEQ(x) (((x) >> WLFC_MODE_REUSESEQ_SHIFT) & 1) 444 #endif /* defined(BCMPCIEDEV_ENABLED) && !defined(ROM_ENAB_RUNTIME_CHECK) */ 445 446 #define WLFC_MODE_REORDERSUPP_SHIFT 4 /* host reorder suppress pkt bit */ 447 #define WLFC_SET_REORDERSUPP(x, val) ((x) = \ 448 ((x) & ~(1 << WLFC_MODE_REORDERSUPP_SHIFT)) | \ 449 (((val) & 1) << WLFC_MODE_REORDERSUPP_SHIFT)) 450 /** returns TRUE if 'reorder suppress' has been agreed upon between host and dongle */ 451 #define WLFC_GET_REORDERSUPP(x) (((x) >> WLFC_MODE_REORDERSUPP_SHIFT) & 1) 452 453 #define FLOW_RING_CREATE 1u 454 #define FLOW_RING_DELETE 2u 455 #define FLOW_RING_FLUSH 3u 456 #define FLOW_RING_OPEN 4u 457 #define FLOW_RING_CLOSED 5u 458 #define FLOW_RING_FLUSHED 6u 459 #define FLOW_RING_TIM_SET 7u 460 #define FLOW_RING_TIM_RESET 8u 461 #define FLOW_RING_FLUSH_TXFIFO 9u 462 #define FLOW_RING_GET_PKT_MAX 10u 463 #define FLOW_RING_RESET_WEIGHT 11u 464 #define FLOW_RING_UPD_PRIOMAP 12u 465 #define FLOW_RING_HP2P_CREATE 13u 466 #define FLOW_RING_HP2P_DELETE 14u 467 #define FLOW_RING_GET_BUFFERED_TIME 15u 468 #define FLOW_RING_HP2P_TXQ_STRT 16u 469 #define FLOW_RING_HP2P_TXQ_STOP 17u 470 471 /* bit 7, indicating if is TID(1) or AC(0) mapped info in tid field) */ 472 #define PCIEDEV_IS_AC_TID_MAP_MASK 0x80 473 474 #define WLFC_PCIEDEV_AC_PRIO_MAP 0 475 #define WLFC_PCIEDEV_TID_PRIO_MAP 1 476 #define WLFC_PCIEDEV_LLR_PRIO_MAP 2 477 478 void wlc_wlfc_set_pkttime(void* pkt, uint16 time); 479 480 /* reason for disabling APP, when none are set, APP will be enabled */ 481 typedef enum { 482 APP_STS_FLOWRING_NO_APP = 0u, /* Reason code used by pciedev */ 483 APP_STS_FLOWRING_CLOSED = 1u, /* Disable APP as flowring is closed */ 484 APP_STS_CRYPTO_UNSUPPORTED = 2u, /* Secuirity type doesn't support APP */ 485 APP_STS_80211_FRAGMENTATION = 3u, /* 802.11 fragmentation enabled */ 486 APP_STS_MAX = 4u /* MAX */ 487 } app_disable_reason_s; 488 489 /* shared structure between wlc and pciedev layer to set/reset a reason code */ 490 typedef struct app_upd_sts { 491 bool set; /* if set, app is disabled for reason rsn */ 492 bool sta; /* set if scb/flowring belong to sta */ 493 app_disable_reason_s rsn; /* APP disable reason codes. */ 494 } app_upd_sts_t; 495 496 #endif /* __wlfc_proto_definitions_h__ */ 497