1*4882a593Smuzhiyun /* 2*4882a593Smuzhiyun * Copyright (C) 2020, Broadcom. 3*4882a593Smuzhiyun * 4*4882a593Smuzhiyun * Unless you and Broadcom execute a separate written software license 5*4882a593Smuzhiyun * agreement governing use of this software, this software is licensed to you 6*4882a593Smuzhiyun * under the terms of the GNU General Public License version 2 (the "GPL"), 7*4882a593Smuzhiyun * available at http://www.broadcom.com/licenses/GPLv2.php, with the 8*4882a593Smuzhiyun * following added to such license: 9*4882a593Smuzhiyun * 10*4882a593Smuzhiyun * As a special exception, the copyright holders of this software give you 11*4882a593Smuzhiyun * permission to link this software with independent modules, and to copy and 12*4882a593Smuzhiyun * distribute the resulting executable under terms of your choice, provided that 13*4882a593Smuzhiyun * you also meet, for each linked independent module, the terms and conditions of 14*4882a593Smuzhiyun * the license of that module. An independent module is a module which is not 15*4882a593Smuzhiyun * derived from this software. The special exception does not apply to any 16*4882a593Smuzhiyun * modifications of the software. 17*4882a593Smuzhiyun * 18*4882a593Smuzhiyun * 19*4882a593Smuzhiyun * <<Broadcom-WL-IPTag/Dual:>> 20*4882a593Smuzhiyun * 21*4882a593Smuzhiyun */ 22*4882a593Smuzhiyun 23*4882a593Smuzhiyun /** WL flow control for PROP_TXSTATUS. Related to host AMPDU reordering. */ 24*4882a593Smuzhiyun 25*4882a593Smuzhiyun #ifndef __wlfc_proto_definitions_h__ 26*4882a593Smuzhiyun #define __wlfc_proto_definitions_h__ 27*4882a593Smuzhiyun 28*4882a593Smuzhiyun /* Use TLV to convey WLFC information. 29*4882a593Smuzhiyun --------------------------------------------------------------------------- 30*4882a593Smuzhiyun | Type | Len | value | Description 31*4882a593Smuzhiyun --------------------------------------------------------------------------- 32*4882a593Smuzhiyun | 1 | 1 | (handle) | MAC OPEN 33*4882a593Smuzhiyun --------------------------------------------------------------------------- 34*4882a593Smuzhiyun | 2 | 1 | (handle) | MAC CLOSE 35*4882a593Smuzhiyun --------------------------------------------------------------------------- 36*4882a593Smuzhiyun | 3 | 2 | (count, handle, prec_bmp)| Set the credit depth for a MAC dstn 37*4882a593Smuzhiyun --------------------------------------------------------------------------- 38*4882a593Smuzhiyun | 4 | 4+ | see pkttag comments | TXSTATUS 39*4882a593Smuzhiyun | | 12 | TX status & timestamps | Present only when pkt timestamp is enabled 40*4882a593Smuzhiyun --------------------------------------------------------------------------- 41*4882a593Smuzhiyun | 5 | 4 | see pkttag comments | PKKTTAG [host->firmware] 42*4882a593Smuzhiyun --------------------------------------------------------------------------- 43*4882a593Smuzhiyun | 6 | 8 | (handle, ifid, MAC) | MAC ADD 44*4882a593Smuzhiyun --------------------------------------------------------------------------- 45*4882a593Smuzhiyun | 7 | 8 | (handle, ifid, MAC) | MAC DEL 46*4882a593Smuzhiyun --------------------------------------------------------------------------- 47*4882a593Smuzhiyun | 8 | 1 | (rssi) | RSSI - RSSI value for the packet. 48*4882a593Smuzhiyun --------------------------------------------------------------------------- 49*4882a593Smuzhiyun | 9 | 1 | (interface ID) | Interface OPEN 50*4882a593Smuzhiyun --------------------------------------------------------------------------- 51*4882a593Smuzhiyun | 10 | 1 | (interface ID) | Interface CLOSE 52*4882a593Smuzhiyun --------------------------------------------------------------------------- 53*4882a593Smuzhiyun | 11 | 8 | fifo credit returns map | FIFO credits back to the host 54*4882a593Smuzhiyun | | | | 55*4882a593Smuzhiyun | | | | -------------------------------------- 56*4882a593Smuzhiyun | | | | | ac0 | ac1 | ac2 | ac3 | bcmc | atim | 57*4882a593Smuzhiyun | | | | -------------------------------------- 58*4882a593Smuzhiyun | | | | 59*4882a593Smuzhiyun --------------------------------------------------------------------------- 60*4882a593Smuzhiyun | 12 | 2 | MAC handle, | Host provides a bitmap of pending 61*4882a593Smuzhiyun | | | AC[0-3] traffic bitmap | unicast traffic for MAC-handle dstn. 62*4882a593Smuzhiyun | | | | [host->firmware] 63*4882a593Smuzhiyun --------------------------------------------------------------------------- 64*4882a593Smuzhiyun | 13 | 3 | (count, handle, prec_bmp)| One time request for packet to a specific 65*4882a593Smuzhiyun | | | | MAC destination. 66*4882a593Smuzhiyun --------------------------------------------------------------------------- 67*4882a593Smuzhiyun | 15 | 12 | (pkttag, timestamps) | Send TX timestamp at reception from host 68*4882a593Smuzhiyun --------------------------------------------------------------------------- 69*4882a593Smuzhiyun | 16 | 12 | (pkttag, timestamps) | Send WLAN RX timestamp along with RX frame 70*4882a593Smuzhiyun --------------------------------------------------------------------------- 71*4882a593Smuzhiyun | 255 | N/A | N/A | FILLER - This is a special type 72*4882a593Smuzhiyun | | | | that has no length or value. 73*4882a593Smuzhiyun | | | | Typically used for padding. 74*4882a593Smuzhiyun --------------------------------------------------------------------------- 75*4882a593Smuzhiyun */ 76*4882a593Smuzhiyun 77*4882a593Smuzhiyun typedef enum { 78*4882a593Smuzhiyun WLFC_CTL_TYPE_MAC_OPEN = 1, 79*4882a593Smuzhiyun WLFC_CTL_TYPE_MAC_CLOSE = 2, 80*4882a593Smuzhiyun WLFC_CTL_TYPE_MAC_REQUEST_CREDIT = 3, 81*4882a593Smuzhiyun WLFC_CTL_TYPE_TXSTATUS = 4, 82*4882a593Smuzhiyun WLFC_CTL_TYPE_PKTTAG = 5, /** host<->dongle */ 83*4882a593Smuzhiyun 84*4882a593Smuzhiyun WLFC_CTL_TYPE_MACDESC_ADD = 6, 85*4882a593Smuzhiyun WLFC_CTL_TYPE_MACDESC_DEL = 7, 86*4882a593Smuzhiyun WLFC_CTL_TYPE_RSSI = 8, 87*4882a593Smuzhiyun 88*4882a593Smuzhiyun WLFC_CTL_TYPE_INTERFACE_OPEN = 9, 89*4882a593Smuzhiyun WLFC_CTL_TYPE_INTERFACE_CLOSE = 10, 90*4882a593Smuzhiyun 91*4882a593Smuzhiyun WLFC_CTL_TYPE_FIFO_CREDITBACK = 11, 92*4882a593Smuzhiyun 93*4882a593Smuzhiyun WLFC_CTL_TYPE_PENDING_TRAFFIC_BMP = 12, /** host->dongle */ 94*4882a593Smuzhiyun WLFC_CTL_TYPE_MAC_REQUEST_PACKET = 13, 95*4882a593Smuzhiyun WLFC_CTL_TYPE_HOST_REORDER_RXPKTS = 14, 96*4882a593Smuzhiyun 97*4882a593Smuzhiyun WLFC_CTL_TYPE_TX_ENTRY_STAMP = 15, 98*4882a593Smuzhiyun WLFC_CTL_TYPE_RX_STAMP = 16, 99*4882a593Smuzhiyun 100*4882a593Smuzhiyun WLFC_CTL_TYPE_UPD_FLR_FETCH = 17, /* PCIE_FLOWCTL: Update Flowring Fetch */ 101*4882a593Smuzhiyun 102*4882a593Smuzhiyun WLFC_CTL_TYPE_TRANS_ID = 18, 103*4882a593Smuzhiyun WLFC_CTL_TYPE_COMP_TXSTATUS = 19, 104*4882a593Smuzhiyun 105*4882a593Smuzhiyun WLFC_CTL_TYPE_TID_OPEN = 20, /* open flowring/s with tid */ 106*4882a593Smuzhiyun WLFC_CTL_TYPE_TID_CLOSE = 21, /* close flowring/s with tid */ 107*4882a593Smuzhiyun WLFC_CTL_TYPE_UPD_FLR_WEIGHT = 22, /* WLATF_DONGLE */ 108*4882a593Smuzhiyun WLFC_CTL_TYPE_ENAB_FFSCH = 23, /* WLATF_DONGLE */ 109*4882a593Smuzhiyun 110*4882a593Smuzhiyun WLFC_CTL_TYPE_UPDATE_FLAGS = 24, /* clear the flags set in flowring */ 111*4882a593Smuzhiyun WLFC_CTL_TYPE_CLEAR_SUPPR = 25, /* free the supression info in the flowring */ 112*4882a593Smuzhiyun 113*4882a593Smuzhiyun WLFC_CTL_TYPE_FLOWID_OPEN = 26, /* open flowring with flowid */ 114*4882a593Smuzhiyun WLFC_CTL_TYPE_FLOWID_CLOSE = 27, /* close flowring with flowid */ 115*4882a593Smuzhiyun 116*4882a593Smuzhiyun WLFC_CTL_TYPE_PENDING_TX_PKTS = 28, /* Get the outstandinding packets in host 117*4882a593Smuzhiyun * flowring for the given interface. 118*4882a593Smuzhiyun */ 119*4882a593Smuzhiyun WLFC_CTL_TYPE_UPD_SCB_RATESEL_CHANGE = 29, /* Upd flow's max rate dynamically */ 120*4882a593Smuzhiyun WLFC_CTL_TYPE_AMSDU_STATE = 30, /* Upd flow's AMSDU state(Enabled/Disabled) */ 121*4882a593Smuzhiyun WLFC_CTL_TYPE_APP_STATE = 31, /* Upd flow's APP state, enable/disable APP */ 122*4882a593Smuzhiyun WLFC_CTL_TYPE_HP2P_EXT_TXSTATUS = 32, /* Hp2p extended tx status */ 123*4882a593Smuzhiyun WLFC_CTL_TYPE_HP2P_ACTIVE_STATE = 33, /* Get status of HP2P ring active or not */ 124*4882a593Smuzhiyun WLFC_CTL_TYPE_HP2P_QUERY_LIFETIME = 34, /* Query lifetime for last unacked */ 125*4882a593Smuzhiyun WLFC_CTL_TYPE_FILLER = 255 126*4882a593Smuzhiyun } wlfc_ctl_type_t; 127*4882a593Smuzhiyun 128*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_FLOWID 2u /* flowid legth in TLV */ 129*4882a593Smuzhiyun 130*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_MACDESC 8u /** handle, interface, MAC */ 131*4882a593Smuzhiyun 132*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_MAC 1u /** MAC-handle */ 133*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_RSSI 1u 134*4882a593Smuzhiyun 135*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_INTERFACE 1u 136*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_PENDING_TRAFFIC_BMP 2u 137*4882a593Smuzhiyun 138*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_TXSTATUS 4u 139*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_PKTTAG 4u 140*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_TIMESTAMP 12u /** 4-byte rate info + 2 TSF */ 141*4882a593Smuzhiyun 142*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_SEQ 2u 143*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_TID 3u /* interface index, TID */ 144*4882a593Smuzhiyun 145*4882a593Smuzhiyun #define WLFC_CTL_EXT_TXSTATUS_PAYLOAD_LEN 8u /* Payload legnth of extention tx status */ 146*4882a593Smuzhiyun 147*4882a593Smuzhiyun /* Reset the flags set for the corresponding flowring of the SCB which is de-inited */ 148*4882a593Smuzhiyun /* FLOW_RING_FLAG_LAST_TIM | FLOW_RING_FLAG_INFORM_PKTPEND | FLOW_RING_FLAG_PKT_REQ */ 149*4882a593Smuzhiyun #define WLFC_RESET_ALL_FLAGS 0 150*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_FLAGS 7 /** flags, MAC */ 151*4882a593Smuzhiyun 152*4882a593Smuzhiyun /* free the data stored to be used for suppressed packets in future */ 153*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_SUPR 8 /** ifindex, tid, MAC */ 154*4882a593Smuzhiyun 155*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_SCB_RATESEL_CHANGE 7 /* ifindex, MAC */ 156*4882a593Smuzhiyun /* enough space to host all 4 ACs, bc/mc and atim fifo credit */ 157*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_FIFO_CREDITBACK 6 158*4882a593Smuzhiyun 159*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_REQUEST_CREDIT 3 /* credit, MAC-handle, prec_bitmap */ 160*4882a593Smuzhiyun #define WLFC_CTL_VALUE_LEN_REQUEST_PACKET 3 /* credit, MAC-handle, prec_bitmap */ 161*4882a593Smuzhiyun 162*4882a593Smuzhiyun /* 163*4882a593Smuzhiyun WLFC packet identifier: b[31:0] (WLFC_CTL_TYPE_PKTTAG) 164*4882a593Smuzhiyun 165*4882a593Smuzhiyun Generation : b[31] => generation number for this packet [host->fw] 166*4882a593Smuzhiyun OR, current generation number [fw->host] 167*4882a593Smuzhiyun Flags : b[30:27] => command, status flags 168*4882a593Smuzhiyun FIFO-AC : b[26:24] => AC-FIFO id 169*4882a593Smuzhiyun 170*4882a593Smuzhiyun h-slot : b[23:8] => hanger-slot 171*4882a593Smuzhiyun freerun : b[7:0] => A free running counter? 172*4882a593Smuzhiyun 173*4882a593Smuzhiyun As far as the firmware is concerned, host generated b[23:0] should be just 174*4882a593Smuzhiyun reflected back on txstatus. 175*4882a593Smuzhiyun */ 176*4882a593Smuzhiyun 177*4882a593Smuzhiyun #ifndef WLFC_PKTFLAG_COMPAT 178*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKTFROMHOST 0x01 179*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKT_REQUESTED 0x02 180*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKT_SENDTOHOST 0x04 181*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKT_FLUSHED 0x08 182*4882a593Smuzhiyun #else 183*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKTFROMHOST_MASK 0x01 184*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKT_REQUESTED_MASK 0x02 185*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKT_SENDTOHOST_MASK 0x04 186*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKT_FLUSHED_MASK 0x08 187*4882a593Smuzhiyun #endif /* WLFC_PKTFLAG_COMPAT */ 188*4882a593Smuzhiyun 189*4882a593Smuzhiyun #define WL_TXSTATUS_STATUS_MASK 0xff /* allow 8 bits */ 190*4882a593Smuzhiyun #define WL_TXSTATUS_STATUS_SHIFT 24 191*4882a593Smuzhiyun 192*4882a593Smuzhiyun #define WL_TXSTATUS_SET_STATUS(x, status) ((x) = \ 193*4882a593Smuzhiyun ((x) & ~(WL_TXSTATUS_STATUS_MASK << WL_TXSTATUS_STATUS_SHIFT)) | \ 194*4882a593Smuzhiyun (((status) & WL_TXSTATUS_STATUS_MASK) << WL_TXSTATUS_STATUS_SHIFT)) 195*4882a593Smuzhiyun #define WL_TXSTATUS_GET_STATUS(x) (((x) >> WL_TXSTATUS_STATUS_SHIFT) & \ 196*4882a593Smuzhiyun WL_TXSTATUS_STATUS_MASK) 197*4882a593Smuzhiyun 198*4882a593Smuzhiyun /** 199*4882a593Smuzhiyun * Bit 31 of the 32-bit packet tag is defined as 'generation ID'. It is set by the host to the 200*4882a593Smuzhiyun * "current" generation, and by the firmware to the "expected" generation, toggling on suppress. The 201*4882a593Smuzhiyun * firmware accepts a packet when the generation matches; on reset (startup) both "current" and 202*4882a593Smuzhiyun * "expected" are set to 0. 203*4882a593Smuzhiyun */ 204*4882a593Smuzhiyun #define WL_TXSTATUS_GENERATION_MASK 1 /* allow 1 bit */ 205*4882a593Smuzhiyun #define WL_TXSTATUS_GENERATION_SHIFT 31 206*4882a593Smuzhiyun 207*4882a593Smuzhiyun #define WL_TXSTATUS_SET_GENERATION(x, gen) ((x) = \ 208*4882a593Smuzhiyun ((x) & ~(WL_TXSTATUS_GENERATION_MASK << WL_TXSTATUS_GENERATION_SHIFT)) | \ 209*4882a593Smuzhiyun (((gen) & WL_TXSTATUS_GENERATION_MASK) << WL_TXSTATUS_GENERATION_SHIFT)) 210*4882a593Smuzhiyun 211*4882a593Smuzhiyun #define WL_TXSTATUS_GET_GENERATION(x) (((x) >> WL_TXSTATUS_GENERATION_SHIFT) & \ 212*4882a593Smuzhiyun WL_TXSTATUS_GENERATION_MASK) 213*4882a593Smuzhiyun 214*4882a593Smuzhiyun #define WL_TXSTATUS_FLAGS_MASK 0xf /* allow 4 bits only */ 215*4882a593Smuzhiyun #define WL_TXSTATUS_FLAGS_SHIFT 27 216*4882a593Smuzhiyun 217*4882a593Smuzhiyun #define WL_TXSTATUS_SET_FLAGS(x, flags) ((x) = \ 218*4882a593Smuzhiyun ((x) & ~(WL_TXSTATUS_FLAGS_MASK << WL_TXSTATUS_FLAGS_SHIFT)) | \ 219*4882a593Smuzhiyun (((flags) & WL_TXSTATUS_FLAGS_MASK) << WL_TXSTATUS_FLAGS_SHIFT)) 220*4882a593Smuzhiyun #define WL_TXSTATUS_GET_FLAGS(x) (((x) >> WL_TXSTATUS_FLAGS_SHIFT) & \ 221*4882a593Smuzhiyun WL_TXSTATUS_FLAGS_MASK) 222*4882a593Smuzhiyun #define WL_TXSTATUS_CLEAR_FLAGS(x, flags) ((x) = \ 223*4882a593Smuzhiyun ((x) & ~(((flags) & WL_TXSTATUS_FLAGS_MASK) << WL_TXSTATUS_FLAGS_SHIFT))) 224*4882a593Smuzhiyun 225*4882a593Smuzhiyun #define WL_TXSTATUS_FIFO_MASK 0x7 /* allow 3 bits for FIFO ID */ 226*4882a593Smuzhiyun #define WL_TXSTATUS_FIFO_SHIFT 24 227*4882a593Smuzhiyun 228*4882a593Smuzhiyun #define WL_TXSTATUS_SET_FIFO(x, flags) ((x) = \ 229*4882a593Smuzhiyun ((x) & ~(WL_TXSTATUS_FIFO_MASK << WL_TXSTATUS_FIFO_SHIFT)) | \ 230*4882a593Smuzhiyun (((flags) & WL_TXSTATUS_FIFO_MASK) << WL_TXSTATUS_FIFO_SHIFT)) 231*4882a593Smuzhiyun #define WL_TXSTATUS_GET_FIFO(x) (((x) >> WL_TXSTATUS_FIFO_SHIFT) & WL_TXSTATUS_FIFO_MASK) 232*4882a593Smuzhiyun 233*4882a593Smuzhiyun #define WL_TXSTATUS_PKTID_MASK 0xffffff /* allow 24 bits */ 234*4882a593Smuzhiyun #define WL_TXSTATUS_SET_PKTID(x, num) ((x) = \ 235*4882a593Smuzhiyun ((x) & ~WL_TXSTATUS_PKTID_MASK) | (num)) 236*4882a593Smuzhiyun #define WL_TXSTATUS_GET_PKTID(x) ((x) & WL_TXSTATUS_PKTID_MASK) 237*4882a593Smuzhiyun 238*4882a593Smuzhiyun #define WL_TXSTATUS_HSLOT_MASK 0xffff /* allow 16 bits */ 239*4882a593Smuzhiyun #define WL_TXSTATUS_HSLOT_SHIFT 8 240*4882a593Smuzhiyun 241*4882a593Smuzhiyun #define WL_TXSTATUS_SET_HSLOT(x, hslot) ((x) = \ 242*4882a593Smuzhiyun ((x) & ~(WL_TXSTATUS_HSLOT_MASK << WL_TXSTATUS_HSLOT_SHIFT)) | \ 243*4882a593Smuzhiyun (((hslot) & WL_TXSTATUS_HSLOT_MASK) << WL_TXSTATUS_HSLOT_SHIFT)) 244*4882a593Smuzhiyun #define WL_TXSTATUS_GET_HSLOT(x) (((x) >> WL_TXSTATUS_HSLOT_SHIFT)& \ 245*4882a593Smuzhiyun WL_TXSTATUS_HSLOT_MASK) 246*4882a593Smuzhiyun 247*4882a593Smuzhiyun #define WL_TXSTATUS_FREERUNCTR_MASK 0xff /* allow 8 bits */ 248*4882a593Smuzhiyun 249*4882a593Smuzhiyun #define WL_TXSTATUS_SET_FREERUNCTR(x, ctr) ((x) = \ 250*4882a593Smuzhiyun ((x) & ~(WL_TXSTATUS_FREERUNCTR_MASK)) | \ 251*4882a593Smuzhiyun ((ctr) & WL_TXSTATUS_FREERUNCTR_MASK)) 252*4882a593Smuzhiyun #define WL_TXSTATUS_GET_FREERUNCTR(x) ((x)& WL_TXSTATUS_FREERUNCTR_MASK) 253*4882a593Smuzhiyun 254*4882a593Smuzhiyun /* packet prio phase bit updated */ 255*4882a593Smuzhiyun #define WL_SEQ_PKTPRIO_PHASE_MASK 0x1 256*4882a593Smuzhiyun #define WL_SEQ_PKTPRIO_PHASE_SHIFT 15 257*4882a593Smuzhiyun #define WL_SEQ_SET_PKTPRIO_PHASE(x, val) ((x) = \ 258*4882a593Smuzhiyun ((x) & ~(WL_SEQ_PKTPRIO_PHASE_MASK << WL_SEQ_PKTPRIO_PHASE_SHIFT)) | \ 259*4882a593Smuzhiyun (((val) & WL_SEQ_PKTPRIO_PHASE_MASK) << WL_SEQ_PKTPRIO_PHASE_SHIFT)) 260*4882a593Smuzhiyun #define WL_SEQ_PKTPRIO_PHASE(x) (((x) >> WL_SEQ_PKTPRIO_PHASE_SHIFT) & \ 261*4882a593Smuzhiyun WL_SEQ_PKTPRIO_PHASE_MASK) 262*4882a593Smuzhiyun 263*4882a593Smuzhiyun /* AMSDU part of d11 seq number */ 264*4882a593Smuzhiyun #define WL_SEQ_AMSDU_MASK 0x1 /* allow 1 bit */ 265*4882a593Smuzhiyun #define WL_SEQ_AMSDU_SHIFT 14 266*4882a593Smuzhiyun #define WL_SEQ_SET_AMSDU(x, val) ((x) = \ 267*4882a593Smuzhiyun ((x) & ~(WL_SEQ_AMSDU_MASK << WL_SEQ_AMSDU_SHIFT)) | \ 268*4882a593Smuzhiyun (((val) & WL_SEQ_AMSDU_MASK) << WL_SEQ_AMSDU_SHIFT)) /**< sets a single AMSDU bit */ 269*4882a593Smuzhiyun /** returns TRUE if ring item is AMSDU (seq = d11 seq nr) */ 270*4882a593Smuzhiyun #define WL_SEQ_IS_AMSDU(x) (((x) >> WL_SEQ_AMSDU_SHIFT) & \ 271*4882a593Smuzhiyun WL_SEQ_AMSDU_MASK) 272*4882a593Smuzhiyun 273*4882a593Smuzhiyun /* indicates last_suppr_seq is valid */ 274*4882a593Smuzhiyun #define WL_SEQ_VALIDSUPPR_MASK 0x1 /* allow 1 bit */ 275*4882a593Smuzhiyun #define WL_SEQ_VALIDSUPPR_SHIFT 12 276*4882a593Smuzhiyun #define WL_SEQ_SET_VALIDSUPPR(x, val) ((x) = \ 277*4882a593Smuzhiyun ((x) & ~(WL_SEQ_VALIDSUPPR_MASK << WL_SEQ_VALIDSUPPR_SHIFT)) | \ 278*4882a593Smuzhiyun (((val) & WL_SEQ_VALIDSUPPR_MASK) << WL_SEQ_VALIDSUPPR_SHIFT)) 279*4882a593Smuzhiyun #define WL_SEQ_GET_VALIDSUPPR(x) (((x) >> WL_SEQ_VALIDSUPPR_SHIFT) & \ 280*4882a593Smuzhiyun WL_SEQ_VALIDSUPPR_MASK) 281*4882a593Smuzhiyun 282*4882a593Smuzhiyun #define WL_SEQ_FROMFW_MASK 0x1 /* allow 1 bit */ 283*4882a593Smuzhiyun #define WL_SEQ_FROMFW_SHIFT 13 284*4882a593Smuzhiyun #define WL_SEQ_SET_FROMFW(x, val) ((x) = \ 285*4882a593Smuzhiyun ((x) & ~(WL_SEQ_FROMFW_MASK << WL_SEQ_FROMFW_SHIFT)) | \ 286*4882a593Smuzhiyun (((val) & WL_SEQ_FROMFW_MASK) << WL_SEQ_FROMFW_SHIFT)) 287*4882a593Smuzhiyun /** Set when firmware assigns D11 sequence number to packet */ 288*4882a593Smuzhiyun #define SET_WL_HAS_ASSIGNED_SEQ(x) WL_SEQ_SET_FROMFW((x), 1) 289*4882a593Smuzhiyun 290*4882a593Smuzhiyun /** returns TRUE if packet has been assigned a d11 seq number by the WL firmware layer */ 291*4882a593Smuzhiyun #define GET_WL_HAS_ASSIGNED_SEQ(x) (((x) >> WL_SEQ_FROMFW_SHIFT) & WL_SEQ_FROMFW_MASK) 292*4882a593Smuzhiyun 293*4882a593Smuzhiyun #ifdef WLFC_PKTFLAG_COMPAT 294*4882a593Smuzhiyun /* Helper macros for WLFC pktflags */ 295*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKTFROMHOST(p) \ 296*4882a593Smuzhiyun (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKTFROMHOST_MASK) 297*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKT_REQUESTED(p) \ 298*4882a593Smuzhiyun (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKT_REQUESTED_MASK) 299*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKT_SENDTOHOST(p) \ 300*4882a593Smuzhiyun (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKT_SENDTOHOST_MASK) 301*4882a593Smuzhiyun #define WLFC_PKTFLAG_PKT_FLUSHED(p) \ 302*4882a593Smuzhiyun (WL_TXSTATUS_GET_FLAGS(WLPKTTAG(p)->wl_hdr_information) & WLFC_PKTFLAG_PKT_FLUSHED_MASK) 303*4882a593Smuzhiyun #endif /* WLFC_PKTFLAG_COMPAT */ 304*4882a593Smuzhiyun 305*4882a593Smuzhiyun /** 306*4882a593Smuzhiyun * Proptxstatus related. 307*4882a593Smuzhiyun * 308*4882a593Smuzhiyun * When a packet is suppressed by WL or the D11 core, the packet has to be retried. Assigning 309*4882a593Smuzhiyun * a new d11 sequence number for the packet when retrying would cause the peer to be unable to 310*4882a593Smuzhiyun * reorder the packets within an AMPDU. So, suppressed packet from bus layer (DHD for SDIO and 311*4882a593Smuzhiyun * pciedev for PCIE) is re-using d11 seq number, so FW should not assign a new one. 312*4882a593Smuzhiyun */ 313*4882a593Smuzhiyun #define WL_SEQ_FROMDRV_MASK 0x1 /* allow 1 bit */ 314*4882a593Smuzhiyun #define WL_SEQ_FROMDRV_SHIFT 12 315*4882a593Smuzhiyun 316*4882a593Smuzhiyun /** 317*4882a593Smuzhiyun * Proptxstatus, host or fw PCIe layer requests WL layer to reuse d11 seq no. Bit is reset by WL 318*4882a593Smuzhiyun * subsystem when it reuses the seq number. 319*4882a593Smuzhiyun */ 320*4882a593Smuzhiyun #define WL_SEQ_SET_REUSE(x, val) ((x) = \ 321*4882a593Smuzhiyun ((x) & ~(WL_SEQ_FROMDRV_MASK << WL_SEQ_FROMDRV_SHIFT)) | \ 322*4882a593Smuzhiyun (((val) & WL_SEQ_FROMDRV_MASK) << WL_SEQ_FROMDRV_SHIFT)) 323*4882a593Smuzhiyun #define SET_WL_TO_REUSE_SEQ(x) WL_SEQ_SET_REUSE((x), 1) 324*4882a593Smuzhiyun #define RESET_WL_TO_REUSE_SEQ(x) WL_SEQ_SET_REUSE((x), 0) 325*4882a593Smuzhiyun 326*4882a593Smuzhiyun /** Proptxstatus, related to reuse of d11 seq numbers when retransmitting */ 327*4882a593Smuzhiyun #define IS_WL_TO_REUSE_SEQ(x) (((x) >> WL_SEQ_FROMDRV_SHIFT) & \ 328*4882a593Smuzhiyun WL_SEQ_FROMDRV_MASK) 329*4882a593Smuzhiyun 330*4882a593Smuzhiyun #define WL_SEQ_NUM_MASK 0xfff /* allow 12 bit */ 331*4882a593Smuzhiyun #define WL_SEQ_NUM_SHIFT 0 332*4882a593Smuzhiyun /** Proptxstatus, sets d11seq no in pkt tag, related to reuse of d11seq no when retransmitting */ 333*4882a593Smuzhiyun #define WL_SEQ_SET_NUM(x, val) ((x) = \ 334*4882a593Smuzhiyun ((x) & ~(WL_SEQ_NUM_MASK << WL_SEQ_NUM_SHIFT)) | \ 335*4882a593Smuzhiyun (((val) & WL_SEQ_NUM_MASK) << WL_SEQ_NUM_SHIFT)) 336*4882a593Smuzhiyun /** Proptxstatus, gets d11seq no from pkt tag, related to reuse of d11seq no when retransmitting */ 337*4882a593Smuzhiyun #define WL_SEQ_GET_NUM(x) (((x) >> WL_SEQ_NUM_SHIFT) & \ 338*4882a593Smuzhiyun WL_SEQ_NUM_MASK) 339*4882a593Smuzhiyun 340*4882a593Smuzhiyun #define WL_SEQ_AMSDU_SUPPR_MASK ((WL_SEQ_FROMDRV_MASK << WL_SEQ_FROMDRV_SHIFT) | \ 341*4882a593Smuzhiyun (WL_SEQ_AMSDU_MASK << WL_SEQ_AMSDU_SHIFT) | \ 342*4882a593Smuzhiyun (WL_SEQ_NUM_MASK << WL_SEQ_NUM_SHIFT)) 343*4882a593Smuzhiyun 344*4882a593Smuzhiyun /* 32 STA should be enough??, 6 bits; Must be power of 2 */ 345*4882a593Smuzhiyun #define WLFC_MAC_DESC_TABLE_SIZE 32 346*4882a593Smuzhiyun #define WLFC_MAX_IFNUM 16 347*4882a593Smuzhiyun #define WLFC_MAC_DESC_ID_INVALID 0xff 348*4882a593Smuzhiyun 349*4882a593Smuzhiyun /* b[7:5] -reuse guard, b[4:0] -value */ 350*4882a593Smuzhiyun #define WLFC_MAC_DESC_GET_LOOKUP_INDEX(x) ((x) & 0x1f) 351*4882a593Smuzhiyun 352*4882a593Smuzhiyun #define WLFC_PKTFLAG_SET_PKTREQUESTED(x) (x) |= \ 353*4882a593Smuzhiyun (WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT) 354*4882a593Smuzhiyun 355*4882a593Smuzhiyun #define WLFC_PKTFLAG_CLR_PKTREQUESTED(x) (x) &= \ 356*4882a593Smuzhiyun ~(WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT) 357*4882a593Smuzhiyun 358*4882a593Smuzhiyun #define WLFC_MAX_PENDING_DATALEN 120 359*4882a593Smuzhiyun 360*4882a593Smuzhiyun /* host is free to discard the packet */ 361*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_DISCARD 0 362*4882a593Smuzhiyun /* D11 suppressed a packet */ 363*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_D11SUPPRESS 1 364*4882a593Smuzhiyun /* WL firmware suppressed a packet because MAC is 365*4882a593Smuzhiyun already in PSMode (short time window) 366*4882a593Smuzhiyun */ 367*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_WLSUPPRESS 2 368*4882a593Smuzhiyun /* Firmware tossed this packet */ 369*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_TOSSED_BYWLC 3 370*4882a593Smuzhiyun /* Firmware tossed after retries */ 371*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_DISCARD_NOACK 4 372*4882a593Smuzhiyun /* Firmware wrongly reported suppressed previously,now fixing to acked */ 373*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_SUPPRESS_ACKED 5 374*4882a593Smuzhiyun /* Firmware send this packet expired, lifetime expiration */ 375*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_EXPIRED 6 376*4882a593Smuzhiyun /* Firmware drop this packet for any other reason */ 377*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_DROPPED 7 378*4882a593Smuzhiyun /* Firmware free this packet */ 379*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_MKTFREE 8 380*4882a593Smuzhiyun /* Firmware dropped the frame after suppress retries reached max */ 381*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_MAX_SUP_RETR 9 382*4882a593Smuzhiyun 383*4882a593Smuzhiyun /* Firmware forced packet lifetime expiry */ 384*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_FORCED_EXPIRED 10 385*4882a593Smuzhiyun 386*4882a593Smuzhiyun #define WLFC_CTL_PKTFLAG_MASK (0x0f) /* For 4-bit mask with one extra bit */ 387*4882a593Smuzhiyun 388*4882a593Smuzhiyun #if defined(PROP_TXSTATUS_DEBUG) && !defined(BINCMP) 389*4882a593Smuzhiyun #define WLFC_DBGMESG(x) printf x 390*4882a593Smuzhiyun /* wlfc-breadcrumb */ 391*4882a593Smuzhiyun #define WLFC_BREADCRUMB(x) do {if ((x) == NULL) \ 392*4882a593Smuzhiyun {printf("WLFC :%d:caller:%p\n", \ 393*4882a593Smuzhiyun __LINE__, CALL_SITE);}} while (0) 394*4882a593Smuzhiyun #define WLFC_WHEREIS(s) printf("WLFC: at %d, %s\n", __LINE__, (s)) 395*4882a593Smuzhiyun #else 396*4882a593Smuzhiyun #define WLFC_DBGMESG(x) 397*4882a593Smuzhiyun #define WLFC_BREADCRUMB(x) 398*4882a593Smuzhiyun #define WLFC_WHEREIS(s) 399*4882a593Smuzhiyun #endif /* PROP_TXSTATUS_DEBUG && !BINCMP */ 400*4882a593Smuzhiyun 401*4882a593Smuzhiyun /* AMPDU host reorder packet flags */ 402*4882a593Smuzhiyun #define WLHOST_REORDERDATA_MAXFLOWS 256 403*4882a593Smuzhiyun #define WLHOST_REORDERDATA_LEN 10 404*4882a593Smuzhiyun #define WLHOST_REORDERDATA_TOTLEN (WLHOST_REORDERDATA_LEN + 1 + 1) /* +tag +len */ 405*4882a593Smuzhiyun 406*4882a593Smuzhiyun #define WLHOST_REORDERDATA_FLOWID_OFFSET 0 407*4882a593Smuzhiyun #define WLHOST_REORDERDATA_MAXIDX_OFFSET 2 408*4882a593Smuzhiyun #define WLHOST_REORDERDATA_FLAGS_OFFSET 4 409*4882a593Smuzhiyun #define WLHOST_REORDERDATA_CURIDX_OFFSET 6 410*4882a593Smuzhiyun #define WLHOST_REORDERDATA_EXPIDX_OFFSET 8 411*4882a593Smuzhiyun 412*4882a593Smuzhiyun #define WLHOST_REORDERDATA_DEL_FLOW 0x01 413*4882a593Smuzhiyun #define WLHOST_REORDERDATA_FLUSH_ALL 0x02 414*4882a593Smuzhiyun #define WLHOST_REORDERDATA_CURIDX_VALID 0x04 415*4882a593Smuzhiyun #define WLHOST_REORDERDATA_EXPIDX_VALID 0x08 416*4882a593Smuzhiyun #define WLHOST_REORDERDATA_NEW_HOLE 0x10 417*4882a593Smuzhiyun 418*4882a593Smuzhiyun /* transaction id data len byte 0: rsvd, byte 1: seqnumber, byte 2-5 will be used for timestampe */ 419*4882a593Smuzhiyun #define WLFC_CTL_TRANS_ID_LEN 6 420*4882a593Smuzhiyun #define WLFC_TYPE_TRANS_ID_LEN 6 421*4882a593Smuzhiyun 422*4882a593Smuzhiyun #define WLFC_MODE_HANGER 1 /* use hanger */ 423*4882a593Smuzhiyun #define WLFC_MODE_AFQ 2 /* use afq (At Firmware Queue) */ 424*4882a593Smuzhiyun #define WLFC_IS_OLD_DEF(x) ((x & 1) || (x & 2)) 425*4882a593Smuzhiyun 426*4882a593Smuzhiyun #define WLFC_MODE_AFQ_SHIFT 2 /* afq bit */ 427*4882a593Smuzhiyun #define WLFC_SET_AFQ(x, val) ((x) = \ 428*4882a593Smuzhiyun ((x) & ~(1 << WLFC_MODE_AFQ_SHIFT)) | \ 429*4882a593Smuzhiyun (((val) & 1) << WLFC_MODE_AFQ_SHIFT)) 430*4882a593Smuzhiyun /** returns TRUE if firmware supports 'at firmware queue' feature */ 431*4882a593Smuzhiyun #define WLFC_GET_AFQ(x) (((x) >> WLFC_MODE_AFQ_SHIFT) & 1) 432*4882a593Smuzhiyun 433*4882a593Smuzhiyun #define WLFC_MODE_REUSESEQ_SHIFT 3 /* seq reuse bit */ 434*4882a593Smuzhiyun #define WLFC_SET_REUSESEQ(x, val) ((x) = \ 435*4882a593Smuzhiyun ((x) & ~(1 << WLFC_MODE_REUSESEQ_SHIFT)) | \ 436*4882a593Smuzhiyun (((val) & 1) << WLFC_MODE_REUSESEQ_SHIFT)) 437*4882a593Smuzhiyun 438*4882a593Smuzhiyun /** returns TRUE if 'd11 sequence reuse' has been agreed upon between host and dongle */ 439*4882a593Smuzhiyun #if defined(BCMPCIEDEV_ENABLED) && !defined(ROM_ENAB_RUNTIME_CHECK) 440*4882a593Smuzhiyun /* GET_REUSESEQ is always TRUE in pciedev */ 441*4882a593Smuzhiyun #define WLFC_GET_REUSESEQ(x) (TRUE) 442*4882a593Smuzhiyun #else 443*4882a593Smuzhiyun #define WLFC_GET_REUSESEQ(x) (((x) >> WLFC_MODE_REUSESEQ_SHIFT) & 1) 444*4882a593Smuzhiyun #endif /* defined(BCMPCIEDEV_ENABLED) && !defined(ROM_ENAB_RUNTIME_CHECK) */ 445*4882a593Smuzhiyun 446*4882a593Smuzhiyun #define WLFC_MODE_REORDERSUPP_SHIFT 4 /* host reorder suppress pkt bit */ 447*4882a593Smuzhiyun #define WLFC_SET_REORDERSUPP(x, val) ((x) = \ 448*4882a593Smuzhiyun ((x) & ~(1 << WLFC_MODE_REORDERSUPP_SHIFT)) | \ 449*4882a593Smuzhiyun (((val) & 1) << WLFC_MODE_REORDERSUPP_SHIFT)) 450*4882a593Smuzhiyun /** returns TRUE if 'reorder suppress' has been agreed upon between host and dongle */ 451*4882a593Smuzhiyun #define WLFC_GET_REORDERSUPP(x) (((x) >> WLFC_MODE_REORDERSUPP_SHIFT) & 1) 452*4882a593Smuzhiyun 453*4882a593Smuzhiyun #define FLOW_RING_CREATE 1u 454*4882a593Smuzhiyun #define FLOW_RING_DELETE 2u 455*4882a593Smuzhiyun #define FLOW_RING_FLUSH 3u 456*4882a593Smuzhiyun #define FLOW_RING_OPEN 4u 457*4882a593Smuzhiyun #define FLOW_RING_CLOSED 5u 458*4882a593Smuzhiyun #define FLOW_RING_FLUSHED 6u 459*4882a593Smuzhiyun #define FLOW_RING_TIM_SET 7u 460*4882a593Smuzhiyun #define FLOW_RING_TIM_RESET 8u 461*4882a593Smuzhiyun #define FLOW_RING_FLUSH_TXFIFO 9u 462*4882a593Smuzhiyun #define FLOW_RING_GET_PKT_MAX 10u 463*4882a593Smuzhiyun #define FLOW_RING_RESET_WEIGHT 11u 464*4882a593Smuzhiyun #define FLOW_RING_UPD_PRIOMAP 12u 465*4882a593Smuzhiyun #define FLOW_RING_HP2P_CREATE 13u 466*4882a593Smuzhiyun #define FLOW_RING_HP2P_DELETE 14u 467*4882a593Smuzhiyun #define FLOW_RING_GET_BUFFERED_TIME 15u 468*4882a593Smuzhiyun #define FLOW_RING_HP2P_TXQ_STRT 16u 469*4882a593Smuzhiyun #define FLOW_RING_HP2P_TXQ_STOP 17u 470*4882a593Smuzhiyun 471*4882a593Smuzhiyun /* bit 7, indicating if is TID(1) or AC(0) mapped info in tid field) */ 472*4882a593Smuzhiyun #define PCIEDEV_IS_AC_TID_MAP_MASK 0x80 473*4882a593Smuzhiyun 474*4882a593Smuzhiyun #define WLFC_PCIEDEV_AC_PRIO_MAP 0 475*4882a593Smuzhiyun #define WLFC_PCIEDEV_TID_PRIO_MAP 1 476*4882a593Smuzhiyun #define WLFC_PCIEDEV_LLR_PRIO_MAP 2 477*4882a593Smuzhiyun 478*4882a593Smuzhiyun void wlc_wlfc_set_pkttime(void* pkt, uint16 time); 479*4882a593Smuzhiyun 480*4882a593Smuzhiyun /* reason for disabling APP, when none are set, APP will be enabled */ 481*4882a593Smuzhiyun typedef enum { 482*4882a593Smuzhiyun APP_STS_FLOWRING_NO_APP = 0u, /* Reason code used by pciedev */ 483*4882a593Smuzhiyun APP_STS_FLOWRING_CLOSED = 1u, /* Disable APP as flowring is closed */ 484*4882a593Smuzhiyun APP_STS_CRYPTO_UNSUPPORTED = 2u, /* Secuirity type doesn't support APP */ 485*4882a593Smuzhiyun APP_STS_80211_FRAGMENTATION = 3u, /* 802.11 fragmentation enabled */ 486*4882a593Smuzhiyun APP_STS_MAX = 4u /* MAX */ 487*4882a593Smuzhiyun } app_disable_reason_s; 488*4882a593Smuzhiyun 489*4882a593Smuzhiyun /* shared structure between wlc and pciedev layer to set/reset a reason code */ 490*4882a593Smuzhiyun typedef struct app_upd_sts { 491*4882a593Smuzhiyun bool set; /* if set, app is disabled for reason rsn */ 492*4882a593Smuzhiyun bool sta; /* set if scb/flowring belong to sta */ 493*4882a593Smuzhiyun app_disable_reason_s rsn; /* APP disable reason codes. */ 494*4882a593Smuzhiyun } app_upd_sts_t; 495*4882a593Smuzhiyun 496*4882a593Smuzhiyun #endif /* __wlfc_proto_definitions_h__ */ 497