Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lmac.h
Go to the documentation of this file.
1 /*
2  * LMAC Interface specific definitions for mac80211 Prism54 drivers
3  *
4  * Copyright (c) 2006, Michael Wu <[email protected]>
5  * Copyright (c) 2007 - 2009, Christian Lamparter <[email protected]>
6  *
7  * Based on:
8  * - the islsm (softmac prism54) driver, which is:
9  * Copyright 2004-2006 Jean-Baptiste Note <[email protected]>, et al.
10  *
11  * - LMAC API interface header file for STLC4560 (lmac_longbow.h)
12  * Copyright (C) 2007 Conexant Systems, Inc.
13  *
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License version 2 as
16  * published by the Free Software Foundation.
17  */
18 
19 #ifndef LMAC_H
20 #define LMAC_H
21 
50 };
51 
52 #define P54_HDR_FLAG_CONTROL BIT(15)
53 #define P54_HDR_FLAG_CONTROL_OPSET (BIT(15) + BIT(0))
54 #define P54_HDR_FLAG_DATA_ALIGN BIT(14)
55 
56 #define P54_HDR_FLAG_DATA_OUT_PROMISC BIT(0)
57 #define P54_HDR_FLAG_DATA_OUT_TIMESTAMP BIT(1)
58 #define P54_HDR_FLAG_DATA_OUT_SEQNR BIT(2)
59 #define P54_HDR_FLAG_DATA_OUT_BIT3 BIT(3)
60 #define P54_HDR_FLAG_DATA_OUT_BURST BIT(4)
61 #define P54_HDR_FLAG_DATA_OUT_NOCANCEL BIT(5)
62 #define P54_HDR_FLAG_DATA_OUT_CLEARTIM BIT(6)
63 #define P54_HDR_FLAG_DATA_OUT_HITCHHIKE BIT(7)
64 #define P54_HDR_FLAG_DATA_OUT_COMPRESS BIT(8)
65 #define P54_HDR_FLAG_DATA_OUT_CONCAT BIT(9)
66 #define P54_HDR_FLAG_DATA_OUT_PCS_ACCEPT BIT(10)
67 #define P54_HDR_FLAG_DATA_OUT_WAITEOSP BIT(11)
68 
69 #define P54_HDR_FLAG_DATA_IN_FCS_GOOD BIT(0)
70 #define P54_HDR_FLAG_DATA_IN_MATCH_MAC BIT(1)
71 #define P54_HDR_FLAG_DATA_IN_MCBC BIT(2)
72 #define P54_HDR_FLAG_DATA_IN_BEACON BIT(3)
73 #define P54_HDR_FLAG_DATA_IN_MATCH_BSS BIT(4)
74 #define P54_HDR_FLAG_DATA_IN_BCAST_BSS BIT(5)
75 #define P54_HDR_FLAG_DATA_IN_DATA BIT(6)
76 #define P54_HDR_FLAG_DATA_IN_TRUNCATED BIT(7)
77 #define P54_HDR_FLAG_DATA_IN_BIT8 BIT(8)
78 #define P54_HDR_FLAG_DATA_IN_TRANSPARENT BIT(9)
79 
80 struct p54_hdr {
84  __le16 type; /* enum p54_control_frame_types */
87  u8 data[0];
88 } __packed;
89 
90 #define GET_REQ_ID(skb) \
91  (((struct p54_hdr *) ((struct sk_buff *) skb)->data)->req_id) \
92 
93 #define FREE_AFTER_TX(skb) \
94  ((((struct p54_hdr *) ((struct sk_buff *) skb)->data)-> \
95  flags) == cpu_to_le16(P54_HDR_FLAG_CONTROL_OPSET))
96 
97 #define IS_DATA_FRAME(skb) \
98  (!((((struct p54_hdr *) ((struct sk_buff *) skb)->data)-> \
99  flags) & cpu_to_le16(P54_HDR_FLAG_CONTROL)))
100 
101 #define GET_HW_QUEUE(skb) \
102  (((struct p54_tx_data *)((struct p54_hdr *) \
103  skb->data)->data)->hw_queue)
104 
105 /*
106  * shared interface ID definitions
107  * The interface ID is a unique identification of a specific interface.
108  * The following values are reserved: 0x0000, 0x0002, 0x0012, 0x0014, 0x0015
109  */
110 #define IF_ID_ISL36356A 0x0001 /* ISL36356A <-> Firmware */
111 #define IF_ID_MVC 0x0003 /* MAC Virtual Coprocessor */
112 #define IF_ID_DEBUG 0x0008 /* PolDebug Interface */
113 #define IF_ID_PRODUCT 0x0009
114 #define IF_ID_OEM 0x000a
115 #define IF_ID_PCI3877 0x000b /* 3877 <-> Host PCI */
116 #define IF_ID_ISL37704C 0x000c /* ISL37704C <-> Fw */
117 #define IF_ID_ISL39000 0x000f /* ISL39000 <-> Fw */
118 #define IF_ID_ISL39300A 0x0010 /* ISL39300A <-> Fw */
119 #define IF_ID_ISL37700_UAP 0x0016 /* ISL37700 uAP Fw <-> Fw */
120 #define IF_ID_ISL39000_UAP 0x0017 /* ISL39000 uAP Fw <-> Fw */
121 #define IF_ID_LMAC 0x001a /* Interface exposed by LMAC */
122 
123 struct exp_if {
129 } __packed;
130 
131 struct dep_if {
135 } __packed;
136 
137 /* driver <-> lmac definitions */
139  union {
140  struct {
143  u8 data[0];
144  } __packed v1;
145  struct {
147  __le16 len;
150  u8 magic[4];
151  u8 data[0];
152  } __packed v2;
153  } __packed;
154 } __packed;
155 
168 };
169 
170 struct p54_rx_data {
182  u8 align[0];
183 } __packed;
184 
196 };
197 
198 struct p54_trap {
201 } __packed;
202 
208 };
209 
218 } __packed;
219 
229 };
230 
237 
243 
244  /* keep last */
246 };
247 
248 #define IS_QOS_QUEUE(n) (n >= P54_QUEUE_DATA)
249 
250 struct p54_tx_data {
256  u8 key[16];
261  union {
262  struct {
265  } __packed longbow;
266  struct {
268  u8 cts_rate;
270  } __packed normal;
271  } __packed;
273  u8 align[0];
274 } __packed;
275 
276 /* unit is ms */
277 #define P54_TX_FRAME_LIFETIME 2000
278 #define P54_TX_TIMEOUT 4000
279 #define P54_STATISTICS_UPDATE 5000
280 
281 #define P54_FILTER_TYPE_NONE 0
282 #define P54_FILTER_TYPE_STATION BIT(0)
283 #define P54_FILTER_TYPE_IBSS BIT(1)
284 #define P54_FILTER_TYPE_AP BIT(2)
285 #define P54_FILTER_TYPE_TRANSPARENT BIT(3)
286 #define P54_FILTER_TYPE_PROMISCUOUS BIT(4)
287 #define P54_FILTER_TYPE_HIBERNATE BIT(5)
288 #define P54_FILTER_TYPE_NOACK BIT(6)
289 #define P54_FILTER_TYPE_RX_DISABLED BIT(7)
290 
297  union {
298  struct {
306  } __packed v1;
307  struct {
308  __le32 rx_addr;
309  __le16 max_rx;
310  __le16 rxhw;
321  } __packed v2;
322  } __packed;
323 } __packed;
324 
325 #define P54_SETUP_V1_LEN 40
326 #define P54_SETUP_V2_LEN (sizeof(struct p54_setup_mac))
327 
328 #define P54_SCAN_EXIT BIT(0)
329 #define P54_SCAN_TRAP BIT(1)
330 #define P54_SCAN_ACTIVE BIT(2)
331 #define P54_SCAN_FILTER BIT(3)
332 
338 } __packed;
339 
349 } __packed;
350 
363 } __packed;
364 
365 /*
366  * Warning: Longbow's structures are bogus.
367  */
370 } __packed;
371 
375  struct {
377  } points[3] __packed;
378 } __packed;
379 
383  __le16 unkn[6]; /* maybe more power_limits or rate_mask */
384 } __packed;
385 
389 } __packed;
390 
394 } __packed;
395 
396 struct p54_led {
400 } __packed;
401 
402 struct p54_edcf {
411 } __packed;
412 
426 } __packed;
427 
433 } __packed;
434 
435 struct p54_timer {
437 } __packed;
438 
439 struct p54_keycache {
446  u8 key[24];
447 } __packed;
448 
449 struct p54_burst {
455 } __packed;
456 
460 } __packed;
461 
462 #define P54_PSM_CAM 0
463 #define P54_PSM BIT(0)
464 #define P54_PSM_DTIM BIT(1)
465 #define P54_PSM_MCBC BIT(2)
466 #define P54_PSM_CHECKSUM BIT(3)
467 #define P54_PSM_SKIP_MORE_DATA BIT(4)
468 #define P54_PSM_BEACON_TIMEOUT BIT(5)
469 #define P54_PSM_HFOSLEEP BIT(6)
470 #define P54_PSM_AUTOSWITCH_SLEEP BIT(7)
471 #define P54_PSM_LPIT BIT(8)
472 #define P54_PSM_BF_UCAST_SKIP BIT(9)
473 #define P54_PSM_BF_MCAST_SKIP BIT(10)
474 
475 struct p54_psm {
483 } __packed;
484 
485 #define MC_FILTER_ADDRESS_NUM 4
486 
491 } __packed;
492 
493 struct p54_txcancel {
495 } __packed;
496 
500 } __packed;
501 
502 #define P54_TIM_CLEAR BIT(15)
503 struct p54_tim {
507 } __packed;
508 
511 } __packed;
512 
516 } __packed;
517 
521 } __packed;
522 
523 /* LED control */
524 int p54_set_leds(struct p54_common *priv);
525 int p54_init_leds(struct p54_common *priv);
526 void p54_unregister_leds(struct p54_common *priv);
527 
528 /* xmit functions */
529 void p54_tx_80211(struct ieee80211_hw *dev,
531  struct sk_buff *skb);
533 void p54_tx(struct p54_common *priv, struct sk_buff *skb);
534 
535 /* synth/phy configuration */
536 int p54_init_xbow_synth(struct p54_common *priv);
537 int p54_scan(struct p54_common *priv, u16 mode, u16 dwell);
538 
539 /* MAC */
540 int p54_sta_unlock(struct p54_common *priv, u8 *addr);
541 int p54_update_beacon_tim(struct p54_common *priv, u16 aid, bool set);
542 int p54_setup_mac(struct p54_common *priv);
543 int p54_set_ps(struct p54_common *priv);
545 int p54_set_groupfilter(struct p54_common *priv);
546 
547 /* e/v DCF setup */
548 int p54_set_edcf(struct p54_common *priv);
549 
550 /* cryptographic engine */
551 int p54_upload_key(struct p54_common *priv, u8 algo, int slot,
552  u8 idx, u8 len, u8 *addr, u8* key);
553 
554 /* eeprom */
555 int p54_download_eeprom(struct p54_common *priv, void *buf,
556  u16 offset, u16 len);
557 struct p54_rssi_db_entry *p54_rssi_find(struct p54_common *p, const u16 freq);
558 
559 /* utility */
560 u8 *p54_find_ie(struct sk_buff *skb, u8 ie);
561 
562 #endif /* LMAC_H */