GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / include / bcm_ol_msg.h
blob03abf8ce98c78358a4aff8b67a9253ab98f2a840
1 /*
2 * Broadcom 802.11 Message infra (pcie<-> CR4) used for RX offloads
5 * Copyright (C) 2012, Broadcom Corporation
6 * All Rights Reserved.
7 *
8 * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation;
9 * the contents of this file may not be disclosed to third parties, copied
10 * or duplicated in any form, in whole or in part, without the prior
11 * written permission of Broadcom Corporation.
13 * $Id: bcm_ol_msg.h chandrum $
16 #ifndef _BCM_OL_MSG_H_
17 #define _BCM_OL_MSG_H_
19 #include <epivers.h>
20 #include <typedefs.h>
21 #ifdef WLRXOE
22 #include <ethernet.h>
23 #endif
24 #include <bcmdevs.h>
25 #include <proto/bcmip.h>
26 #include <proto/bcmipv6.h>
28 #define OLMSG_RW_MAX_ENTRIES 2
30 /* Dongle indecies */
31 #define OLMSG_READ_DONGLE_INDEX 0
32 #define OLMSG_WRITE_DONGLE_INDEX 1
34 /* Host indecies */
35 #define OLMSG_READ_HOST_INDEX 1
36 #define OLMSG_WRITE_HOST_INDEX 0
38 #define OLMSG_BUF_SZ 0x100000 /* 1MB */
39 #define OLMSG_MGMT_BUFF_SZ 0x100 /* 256B */
40 #define OLMSG_HOST_BUF_SZ 0x40000 /* 256KB */
41 #define OLMSG_DGL_BUF_SZ 0x40000 /* 256KB */
43 #define OLMSG_MGMT_BUFF_OFFSET 0
44 #define OLMSG_HOST_BUFF_OFFSET 256 /* Starting at 256K */
45 #define OLMSG_DGL_BUFF_OFFSET 0x80000 /* Starting at 512K */
47 /* Maximum IE id for non vendor specific IE */
48 #define OLMSG_BCN_MAX_IE 222
49 #define MAX_VNDR_IE 50 /* Needs to be looked into */
50 #define MAX_IE_LENGTH_BUF 2048
51 #define MAX_STAT_ENTRIES 16
52 #define NEXT_STAT(x) ((x + 1) & ((MAX_STAT_ENTRIES) - 1))
54 #ifdef WLRXOE
55 typedef struct rxoe_info rxoe_info_t;
56 typedef struct rxoe_bcn_info rxoe_bcn_info_t;
57 typedef struct rxoe_arp_info rxoe_arp_info_t;
58 typedef struct rxoe_nd_info rxoe_nd_info_t;
59 #endif
61 enum {
62 BCM_OL_BEACON_ENABLE,
63 BCM_OL_BEACON_DISABLE,
64 BCM_OL_ARP_ENABLE,
65 BCM_OL_ARP_SETIP,
66 BCM_OL_ARP_DISABLE,
67 BCM_OL_ND_ENABLE,
68 BCM_OL_ND_SETIP,
69 BCM_OL_ND_DISABLE,
70 BCM_OL_RESET,
71 BCM_OL_FIFODEL,
72 BCM_OL_MSG_TEST,
73 BCM_OL_MSG_IE_NOTIFICATION_FLAG,
74 BCM_OL_MSG_IE_NOTIFICATION,
75 BCM_OL_MSG_MAX
79 #include <packed_section_start.h>
81 typedef BWL_PRE_PACKED_STRUCT struct olmsg_arp_stats_t {
82 struct ipv4_addr src_ip;
83 struct ipv4_addr dest_ip;
84 uint8 suppressed;
85 uint8 is_request;
86 } BWL_POST_PACKED_STRUCT olmsg_arp_stats;
88 typedef BWL_PRE_PACKED_STRUCT struct olmsg_nd_stats_t {
89 struct ipv6_addr dest_ip;
90 uint8 suppressed;
91 uint8 is_request;
92 } BWL_POST_PACKED_STRUCT olmsg_nd_stats;
94 typedef BWL_PRE_PACKED_STRUCT struct olmsg_dump_stats_info_t {
95 uint32 rxoe_bcncount;
96 uint32 rxoe_cleardefcnt;
97 uint32 rxoe_bssidmiss_cnt;
98 uint32 rxoe_capmiss_cnt;
99 uint32 rxoe_bimiss_cnt;
100 uint32 rxoe_bcnlosscnt;
101 uint16 iechanged[OLMSG_BCN_MAX_IE];
102 uint16 rxoe_arpcnt;
103 olmsg_arp_stats arp_stats[MAX_STAT_ENTRIES];
104 uint16 rxoe_ndcnt;
105 olmsg_nd_stats nd_stats[MAX_STAT_ENTRIES];
106 } BWL_POST_PACKED_STRUCT olmsg_dump_stats;
108 typedef BWL_PRE_PACKED_STRUCT struct olmsg_shared_info_t {
109 uint32 msgbufaddr_low;
110 uint32 msgbufaddr_high;
111 uint32 msgbuf_sz;
112 olmsg_dump_stats stats;
113 uint32 console_addr;
114 } BWL_POST_PACKED_STRUCT olmsg_shared_info;
116 /* Message buffer start addreses is written at the end of
117 * ARM memroy, 32 bytes additional.
119 #define sz sizeof(olmsg_shared_info)
120 #define OLMSG_SHARED_INFO_SZ (sz + 32 + (sz%4))
123 typedef BWL_PRE_PACKED_STRUCT struct vndriemask_info_t {
124 union {
125 struct ouidata {
126 uint8 id[3];
127 uint8 type;
128 } b;
129 uint32 mask;
130 } oui;
131 } BWL_POST_PACKED_STRUCT vndriemask_info;
133 /* Read/Write Context */
134 typedef BWL_PRE_PACKED_STRUCT struct olmsg_buf_info_t {
135 uint32 offset;
136 uint32 size;
137 uint32 rx;
138 uint32 wx;
139 } BWL_POST_PACKED_STRUCT olmsg_buf_info;
141 /* TBD: Should be a packed structure */
142 typedef BWL_PRE_PACKED_STRUCT struct olmsg_header_t {
143 uint32 type;
144 uint32 seq;
145 uint32 len;
146 } BWL_POST_PACKED_STRUCT olmsg_header;
148 typedef BWL_PRE_PACKED_STRUCT struct olmsg_test_t {
149 olmsg_header hdr;
150 uint32 data;
151 } BWL_POST_PACKED_STRUCT olmsg_test;
153 typedef BWL_PRE_PACKED_STRUCT struct olmsg_reset_t {
154 olmsg_header hdr;
155 } BWL_POST_PACKED_STRUCT olmsg_reset;
157 typedef BWL_PRE_PACKED_STRUCT struct olmsg_fifodel_t {
158 olmsg_header hdr;
159 uint8 enable;
160 } BWL_POST_PACKED_STRUCT olmsg_fifodel;
162 typedef BWL_PRE_PACKED_STRUCT struct olmsg_bcn_enable_t {
163 olmsg_header hdr;
164 /* Deferral count to inform ucode */
165 uint32 defcnt;
167 /* BSSID beacon length */
168 uint32 bcn_length;
169 /* BSSID to support per interface */
170 struct ether_addr BSSID; /* BSSID (associated) */
172 struct ether_addr cur_etheraddr;
174 /* beacon interval */
175 uint16 bi; /* units are Kusec */
177 /* Beacon capability */
178 uint16 capability;
180 /* Beacon received channel */
181 uint32 rxchannel;
184 /* association aid */
185 uint32 aid;
187 uint8 frame_del;
189 uint8 iemask[CEIL((OLMSG_BCN_MAX_IE+1), 8)];
191 vndriemask_info vndriemask[MAX_VNDR_IE];
193 uint32 iedatalen;
195 uint8 iedata[1]; /* Elements */
196 } BWL_POST_PACKED_STRUCT olmsg_bcn_enable;
199 typedef BWL_PRE_PACKED_STRUCT struct olmsg_bcn_disable_t {
200 olmsg_header hdr;
201 struct ether_addr BSSID;
202 } BWL_POST_PACKED_STRUCT olmsg_bcn_disable;
204 typedef BWL_PRE_PACKED_STRUCT struct olmsg_arp_enable_t {
205 olmsg_header hdr;
206 struct ether_addr host_mac;
207 struct ipv4_addr host_ip;
208 int8 iv_len;
209 } BWL_POST_PACKED_STRUCT olmsg_arp_enable;
211 typedef BWL_PRE_PACKED_STRUCT struct olmsg_arp_disable_t {
212 olmsg_header hdr;
213 } BWL_POST_PACKED_STRUCT olmsg_arp_disable;
215 typedef BWL_PRE_PACKED_STRUCT struct olmsg_arp_setip_t {
216 olmsg_header hdr;
217 struct ipv4_addr host_ip;
218 } BWL_POST_PACKED_STRUCT olmsg_arp_setip;
220 typedef BWL_PRE_PACKED_STRUCT struct olmsg_nd_enable_t {
221 olmsg_header hdr;
222 struct ether_addr host_mac;
223 struct ipv6_addr host_ip;
224 int8 iv_len;
225 } BWL_POST_PACKED_STRUCT olmsg_nd_enable;
227 typedef BWL_PRE_PACKED_STRUCT struct olmsg_nd_disable_t {
228 olmsg_header hdr;
229 } BWL_POST_PACKED_STRUCT olmsg_nd_disable;
231 typedef BWL_PRE_PACKED_STRUCT struct olmsg_nd_setip_t {
232 olmsg_header hdr;
233 struct ipv6_addr host_ip;
234 } BWL_POST_PACKED_STRUCT olmsg_nd_setip;
236 /* Add IE NOTIFICATION STRUCT HERE */
237 typedef BWL_PRE_PACKED_STRUCT struct olmsg_ie_notification_enable_t {
238 olmsg_header hdr; /* Message Header */
239 struct ether_addr BSSID; /* Associated with BSSID */
240 struct ether_addr cur_etheraddr; /* Current Ethernet Address */
241 uint32 id; /* IE Mask for standard IE */
242 uint32 enable; /* IE Mask enable/disable flag */
244 } BWL_POST_PACKED_STRUCT olmsg_ie_notification_enable;
246 #include <packed_section_end.h>
248 typedef struct olmsg_info_t {
249 uchar *msg_buff;
250 uint32 len;
251 olmsg_buf_info *write;
252 olmsg_buf_info *read;
253 uint32 next_seq;
254 } olmsg_info;
256 #ifdef WLRXOE
257 /* This needs to be moved to private place */
258 extern olmsg_shared_info *ppcie_shared;
259 #define RXOEINC(a) (ppcie_shared->stats.a++)
260 #define RXOEINCIE(a, i) ((ppcie_shared->stats.a[i])++)
262 #define RXOEINC_N(a, n) (a = ((a + 1) & ((n) - 1)))
263 #define RXOEADDARPENTRY(entry) ({ uint8 i = ppcie_shared->stats.rxoe_arpcnt; \
264 bcopy(&entry, &ppcie_shared->stats.arp_stats[i], sizeof(olmsg_arp_stats)); \
265 RXOEINC_N(ppcie_shared->stats.rxoe_arpcnt, MAX_STAT_ENTRIES); })
266 #define RXOEADDNDENTRY(entry) ({ uint8 i = ppcie_shared->stats.rxoe_ndcnt; \
267 bcopy(&entry, &ppcie_shared->stats.nd_stats[i], sizeof(olmsg_nd_stats)); \
268 RXOEINC_N(ppcie_shared->stats.rxoe_ndcnt, MAX_STAT_ENTRIES); })
269 #endif
270 extern int
271 bcm_olmsg_create(uchar *buf, uint32 len);
273 /* Initialize message buffer */
274 extern int
275 bcm_olmsg_init(olmsg_info *ol_info, uchar *buf, uint32 len, uint8 rx, uint8 wx);
277 extern void
278 bcm_olmsg_deinit(olmsg_info *ol_info);
280 /* Copies the next message to be read into buf
281 Updates the read pointer
282 returns size of the message
283 Pass NULL to retrieve the size of the message
285 extern int
286 bcm_olmsg_getnext(olmsg_info *ol_info, char *buf, uint32 size);
288 /* same as bcm_olmsg_getnext, except that read pointer it not updated
291 bcm_olmsg_peeknext(olmsg_info *ol_info, char *buf, uint32 size);
294 /* Writes the message to the shared buffer
295 Updates the write pointer
296 returns TRUE/FALSE depending on the availability of the space
297 Pass NULL to retrieve the size of the message
299 extern bool
300 bcm_olmsg_write(olmsg_info *ol_info, char *buf, uint32 size);
303 * Returns TRUE if the message buffer is full, else FALSE
305 extern bool
306 bcm_olmsg_isfull(olmsg_info *ol_info);
309 * Returns TRUE if the message buffer is empty, else FALSE
311 extern bool
312 bcm_olmsg_isempty(olmsg_info *ol_info);
315 * Returns free space of the message buffer
317 extern uint32
318 bcm_olmsg_avail(olmsg_info *ol_info);
320 extern bool
321 bcm_olmsg_is_writebuf_full(olmsg_info *ol_info);
323 extern int
324 bcm_olmsg_writemsg(olmsg_info *ol, uchar *buf, uint16 len);
326 extern uint32
327 bcm_olmsg_bytes_to_read(olmsg_info *ol_info);
329 extern bool
330 bcm_olmsg_is_readbuf_empty(olmsg_info *ol_info);
333 extern uint32
334 bcm_olmsg_peekbytes(olmsg_info *ol, uchar *dst, uint32 len);
336 extern uint32
337 bcm_olmsg_readbytes(olmsg_info *ol, uchar *dst, uint32 len);
339 extern uint16
340 bcm_olmsg_peekmsg_len(olmsg_info *ol);
342 extern uint16
343 bcm_olmsg_readmsg(olmsg_info *ol, uchar *buf, uint16 len);
345 extern void
346 bcm_olmsg_dump_msg(olmsg_info *ol, olmsg_header *hdr);
348 extern void
349 bcm_olmsg_dump_record(olmsg_info *ol);
351 #endif /* _BCM_OL_MSG_H_ */