2 * Copyright (C) 1999-2011, Broadcom Corporation
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:
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.
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,v 1.1.6.2 2010-05-08 01:30:41 $
24 #ifndef __wlfc_proto_definitions_h__
25 #define __wlfc_proto_definitions_h__
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 ---------------------------------------------------------------------------
39 | 5 | 4 | see pkttag comments | PKKTTAG [host->firmware]
40 ---------------------------------------------------------------------------
41 | 6 | 8 | (handle, ifid, MAC) | MAC ADD
42 ---------------------------------------------------------------------------
43 | 7 | 8 | (handle, ifid, MAC) | MAC DEL
44 ---------------------------------------------------------------------------
45 | 8 | 1 | (rssi) | RSSI - RSSI value for the packet.
46 ---------------------------------------------------------------------------
47 | 9 | 1 | (interface ID) | Interface OPEN
48 ---------------------------------------------------------------------------
49 | 10 | 1 | (interface ID) | Interface CLOSE
50 ---------------------------------------------------------------------------
51 | 11 | 8 | fifo credit returns map | FIFO credits back to the host
53 | | | | --------------------------------------
54 | | | | | ac0 | ac1 | ac2 | ac3 | bcmc | atim |
55 | | | | --------------------------------------
57 ---------------------------------------------------------------------------
58 | 12 | 2 | MAC handle, | Host provides a bitmap of pending
59 | | | AC[0-3] traffic bitmap | unicast traffic for MAC-handle dstn.
60 | | | | [host->firmware]
61 ---------------------------------------------------------------------------
62 | 13 | 3 | (count, handle, prec_bmp)| One time request for packet to a specific
63 | | | | MAC destination.
64 ---------------------------------------------------------------------------
65 | 255 | N/A | N/A | FILLER - This is a special type
66 | | | | that has no length or value.
67 | | | | Typically used for padding.
68 ---------------------------------------------------------------------------
71 #define WLFC_CTL_TYPE_MAC_OPEN 1
72 #define WLFC_CTL_TYPE_MAC_CLOSE 2
73 #define WLFC_CTL_TYPE_MAC_REQUEST_CREDIT 3
74 #define WLFC_CTL_TYPE_TXSTATUS 4
75 #define WLFC_CTL_TYPE_PKTTAG 5
77 #define WLFC_CTL_TYPE_MACDESC_ADD 6
78 #define WLFC_CTL_TYPE_MACDESC_DEL 7
79 #define WLFC_CTL_TYPE_RSSI 8
81 #define WLFC_CTL_TYPE_INTERFACE_OPEN 9
82 #define WLFC_CTL_TYPE_INTERFACE_CLOSE 10
84 #define WLFC_CTL_TYPE_FIFO_CREDITBACK 11
86 #define WLFC_CTL_TYPE_PENDING_TRAFFIC_BMP 12
87 #define WLFC_CTL_TYPE_MAC_REQUEST_PACKET 13
89 #define WLFC_CTL_TYPE_FILLER 255
91 #define WLFC_CTL_VALUE_LEN_MACDESC 8 /* handle, interface, MAC */
93 #define WLFC_CTL_VALUE_LEN_MAC 1 /* MAC-handle */
94 #define WLFC_CTL_VALUE_LEN_RSSI 1
96 #define WLFC_CTL_VALUE_LEN_INTERFACE 1
97 #define WLFC_CTL_VALUE_LEN_PENDING_TRAFFIC_BMP 2
99 #define WLFC_CTL_VALUE_LEN_TXSTATUS 4
100 #define WLFC_CTL_VALUE_LEN_PKTTAG 4
102 /* enough space to host all 4 ACs, bc/mc and atim fifo credit */
103 #define WLFC_CTL_VALUE_LEN_FIFO_CREDITBACK 6
105 #define WLFC_CTL_VALUE_LEN_REQUEST_CREDIT 3 /* credit, MAC-handle, prec_bitmap */
106 #define WLFC_CTL_VALUE_LEN_REQUEST_PACKET 3 /* credit, MAC-handle, prec_bitmap */
110 #define WLFC_PKTID_GEN_MASK 0x80000000
111 #define WLFC_PKTID_GEN_SHIFT 31
113 #define WLFC_PKTID_GEN(x) (((x) & WLFC_PKTID_GEN_MASK) >> WLFC_PKTID_GEN_SHIFT)
114 #define WLFC_PKTID_SETGEN(x, gen) (x) = ((x) & ~WLFC_PKTID_GEN_MASK) | \
115 (((gen) << WLFC_PKTID_GEN_SHIFT) & WLFC_PKTID_GEN_MASK)
117 #define WLFC_PKTFLAG_PKTFROMHOST 0x01
118 #define WLFC_PKTFLAG_PKT_REQUESTED 0x02
120 #define WL_TXSTATUS_FLAGS_MASK 0xf /* allow 4 bits only */
121 #define WL_TXSTATUS_FLAGS_SHIFT 27
123 #define WL_TXSTATUS_SET_FLAGS(x, flags) ((x) = \
124 ((x) & ~(WL_TXSTATUS_FLAGS_MASK << WL_TXSTATUS_FLAGS_SHIFT)) | \
125 (((flags) & WL_TXSTATUS_FLAGS_MASK) << WL_TXSTATUS_FLAGS_SHIFT))
126 #define WL_TXSTATUS_GET_FLAGS(x) (((x) >> WL_TXSTATUS_FLAGS_SHIFT) & \
127 WL_TXSTATUS_FLAGS_MASK)
129 #define WL_TXSTATUS_FIFO_MASK 0x7 /* allow 3 bits for FIFO ID */
130 #define WL_TXSTATUS_FIFO_SHIFT 24
132 #define WL_TXSTATUS_SET_FIFO(x, flags) ((x) = \
133 ((x) & ~(WL_TXSTATUS_FIFO_MASK << WL_TXSTATUS_FIFO_SHIFT)) | \
134 (((flags) & WL_TXSTATUS_FIFO_MASK) << WL_TXSTATUS_FIFO_SHIFT))
135 #define WL_TXSTATUS_GET_FIFO(x) (((x) >> WL_TXSTATUS_FIFO_SHIFT) & WL_TXSTATUS_FIFO_MASK)
137 #define WL_TXSTATUS_PKTID_MASK 0xffffff /* allow 24 bits */
138 #define WL_TXSTATUS_SET_PKTID(x, num) ((x) = \
139 ((x) & ~WL_TXSTATUS_PKTID_MASK) | (num))
140 #define WL_TXSTATUS_GET_PKTID(x) ((x) & WL_TXSTATUS_PKTID_MASK)
142 /* 32 STA should be enough??, 6 bits; Must be power of 2 */
143 #define WLFC_MAC_DESC_TABLE_SIZE 32
144 #define WLFC_MAX_IFNUM 16
145 #define WLFC_MAC_DESC_ID_INVALID 0xff
147 /* b[7:5] -reuse guard, b[4:0] -value */
148 #define WLFC_MAC_DESC_GET_LOOKUP_INDEX(x) ((x) & 0x1f)
150 #define WLFC_PKTFLAG_SET_PKTREQUESTED(x) (x) |= \
151 (WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT)
153 #define WLFC_PKTFLAG_CLR_PKTREQUESTED(x) (x) &= \
154 ~(WLFC_PKTFLAG_PKT_REQUESTED << WL_TXSTATUS_FLAGS_SHIFT)
156 #define WL_TXSTATUS_GENERATION_MASK 1
157 #define WL_TXSTATUS_GENERATION_SHIFT 31
159 #define WLFC_PKTFLAG_SET_GENERATION(x, gen) ((x) = \
160 ((x) & ~(WL_TXSTATUS_GENERATION_MASK << WL_TXSTATUS_GENERATION_SHIFT)) | \
161 (((gen) & WL_TXSTATUS_GENERATION_MASK) << WL_TXSTATUS_GENERATION_SHIFT))
163 #define WLFC_PKTFLAG_GENERATION(x) (((x) >> WL_TXSTATUS_GENERATION_SHIFT) & \
164 WL_TXSTATUS_GENERATION_MASK)
166 #define WLFC_MAX_PENDING_DATALEN 120
168 /* host is free to discard the packet */
169 #define WLFC_CTL_PKTFLAG_DISCARD 0
170 /* D11 suppressed a packet */
171 #define WLFC_CTL_PKTFLAG_D11SUPPRESS 1
172 /* WL firmware suppressed a packet because MAC is
173 already in PSMode (short time window)
175 #define WLFC_CTL_PKTFLAG_WLSUPPRESS 2
176 /* Firmware tossed this packet */
177 #define WLFC_CTL_PKTFLAG_TOSSED_BYWLC 3
179 #define WLFC_D11_STATUS_INTERPRET(txs) ((((txs)->status & TX_STATUS_SUPR_MASK) >> \
180 TX_STATUS_SUPR_SHIFT)) ? WLFC_CTL_PKTFLAG_D11SUPPRESS : WLFC_CTL_PKTFLAG_DISCARD
182 #define WLFC_DBGMESG(x)
183 #define WLFC_BREADCRUMB(x)
184 #define WLFC_PRINTMAC(banner, ea)
185 #define WLFC_WHEREIS(s)
187 #endif /* __wlfc_proto_definitions_h__ */