aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/wl12xx/cmd.h
diff options
context:
space:
mode:
authorKalle Valo <kalle.valo@nokia.com>2009-06-12 07:14:19 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 14:57:41 -0400
commitff25839bf0c99e828c26864a24417a36a6b6a31e (patch)
treee5891ed357f4285f788056e270df7664b4d5aa13 /drivers/net/wireless/wl12xx/cmd.h
parentc4f9f16b309b65f9f578ec4ba78b3efa106cf65d (diff)
wl12xx: cmd and acx interface rework
Rework cmd and acx interfaces, it was just too confusing earlier. Now all commands need to contain all the needed headers, either just cmd headers or both cmd and acx headers. This accomplish to remove the extra copy done for each command. The interfaces are now properly documented as well. Also try to make all commands safe for DMA transfers. I might have missed some, but most of them should be fixed now. And this is not all! As a free bonus you will also get some cosmetic cleanups and code reorganisation. Order today! Signed-off-by: Kalle Valo <kalle.valo@nokia.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/wl12xx/cmd.h')
-rw-r--r--drivers/net/wireless/wl12xx/cmd.h168
1 files changed, 155 insertions, 13 deletions
diff --git a/drivers/net/wireless/wl12xx/cmd.h b/drivers/net/wireless/wl12xx/cmd.h
index aa307dcd081f..7aef1f24352d 100644
--- a/drivers/net/wireless/wl12xx/cmd.h
+++ b/drivers/net/wireless/wl12xx/cmd.h
@@ -27,31 +27,26 @@
27 27
28#include "wl12xx.h" 28#include "wl12xx.h"
29 29
30struct acx_header;
31
30int wl12xx_cmd_send(struct wl12xx *wl, u16 type, void *buf, size_t buf_len); 32int wl12xx_cmd_send(struct wl12xx *wl, u16 type, void *buf, size_t buf_len);
31int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer); 33int wl12xx_cmd_test(struct wl12xx *wl, void *buf, size_t buf_len, u8 answer);
32int wl12xx_cmd_interrogate(struct wl12xx *wl, u16 ie_id, u16 ie_len, 34int wl12xx_cmd_interrogate(struct wl12xx *wl, u16 id, void *buf, size_t len);
33 void *answer); 35int wl12xx_cmd_configure(struct wl12xx *wl, u16 id, void *buf, size_t len);
34int wl12xx_cmd_configure(struct wl12xx *wl, void *ie, int ie_len);
35int wl12xx_cmd_vbm(struct wl12xx *wl, u8 identity, 36int wl12xx_cmd_vbm(struct wl12xx *wl, u8 identity,
36 void *bitmap, u16 bitmap_len, u8 bitmap_control); 37 void *bitmap, u16 bitmap_len, u8 bitmap_control);
37int wl12xx_cmd_data_path(struct wl12xx *wl, u8 channel, u8 enable); 38int wl12xx_cmd_data_path(struct wl12xx *wl, u8 channel, bool enable);
38int wl12xx_cmd_join(struct wl12xx *wl, u8 bss_type, u8 dtim_interval, 39int wl12xx_cmd_join(struct wl12xx *wl, u8 bss_type, u8 dtim_interval,
39 u16 beacon_interval, u8 wait); 40 u16 beacon_interval, u8 wait);
40int wl12xx_cmd_ps_mode(struct wl12xx *wl, u8 ps_mode); 41int wl12xx_cmd_ps_mode(struct wl12xx *wl, u8 ps_mode);
41int wl12xx_cmd_read_memory(struct wl12xx *wl, u32 addr, u32 len, void *answer); 42int wl12xx_cmd_read_memory(struct wl12xx *wl, u32 addr, void *answer,
43 size_t len);
42int wl12xx_cmd_template_set(struct wl12xx *wl, u16 cmd_id, 44int wl12xx_cmd_template_set(struct wl12xx *wl, u16 cmd_id,
43 void *buf, size_t buf_len); 45 void *buf, size_t buf_len);
44 46
45/* unit ms */ 47/* unit ms */
46#define WL12XX_COMMAND_TIMEOUT 2000 48#define WL12XX_COMMAND_TIMEOUT 2000
47 49
48#define WL12XX_MAX_TEMPLATE_SIZE 300
49
50struct wl12xx_cmd_packet_template {
51 __le16 size;
52 u8 template[WL12XX_MAX_TEMPLATE_SIZE];
53} __attribute__ ((packed));
54
55enum wl12xx_commands { 50enum wl12xx_commands {
56 CMD_RESET = 0, 51 CMD_RESET = 0,
57 CMD_INTERROGATE = 1, /*use this to read information elements*/ 52 CMD_INTERROGATE = 1, /*use this to read information elements*/
@@ -100,9 +95,15 @@ enum wl12xx_commands {
100 95
101#define MAX_CMD_PARAMS 572 96#define MAX_CMD_PARAMS 572
102 97
103struct wl12xx_command { 98struct wl12xx_cmd_header {
104 u16 id; 99 u16 id;
105 u16 status; 100 u16 status;
101 /* payload */
102 u8 data[0];
103} __attribute__ ((packed));
104
105struct wl12xx_command {
106 struct wl12xx_cmd_header header;
106 u8 parameters[MAX_CMD_PARAMS]; 107 u8 parameters[MAX_CMD_PARAMS];
107}; 108};
108 109
@@ -144,6 +145,8 @@ enum {
144#define MAX_READ_SIZE 256 145#define MAX_READ_SIZE 256
145 146
146struct cmd_read_write_memory { 147struct cmd_read_write_memory {
148 struct wl12xx_cmd_header header;
149
147 /* The address of the memory to read from or write to.*/ 150 /* The address of the memory to read from or write to.*/
148 u32 addr; 151 u32 addr;
149 152
@@ -211,6 +214,8 @@ struct basic_scan_channel_parameters {
211#define SCAN_MAX_NUM_OF_CHANNELS 16 214#define SCAN_MAX_NUM_OF_CHANNELS 16
212 215
213struct cmd_scan { 216struct cmd_scan {
217 struct wl12xx_cmd_header header;
218
214 struct basic_scan_parameters params; 219 struct basic_scan_parameters params;
215 struct basic_scan_channel_parameters channels[SCAN_MAX_NUM_OF_CHANNELS]; 220 struct basic_scan_channel_parameters channels[SCAN_MAX_NUM_OF_CHANNELS];
216} __attribute__ ((packed)); 221} __attribute__ ((packed));
@@ -227,6 +232,8 @@ enum {
227 232
228 233
229struct cmd_join { 234struct cmd_join {
235 struct wl12xx_cmd_header header;
236
230 u32 bssid_lsb; 237 u32 bssid_lsb;
231 u16 bssid_msb; 238 u16 bssid_msb;
232 u16 beacon_interval; /* in TBTTs */ 239 u16 beacon_interval; /* in TBTTs */
@@ -261,5 +268,140 @@ struct cmd_join {
261 u8 reserved; 268 u8 reserved;
262} __attribute__ ((packed)); 269} __attribute__ ((packed));
263 270
271struct cmd_enabledisable_path {
272 struct wl12xx_cmd_header header;
273
274 u8 channel;
275 u8 padding[3];
276} __attribute__ ((packed));
277
278#define WL12XX_MAX_TEMPLATE_SIZE 300
279
280struct wl12xx_cmd_packet_template {
281 struct wl12xx_cmd_header header;
282
283 __le16 size;
284 u8 data[0];
285} __attribute__ ((packed));
286
287#define TIM_ELE_ID 5
288#define PARTIAL_VBM_MAX 251
289
290struct wl12xx_tim {
291 u8 identity;
292 u8 length;
293 u8 dtim_count;
294 u8 dtim_period;
295 u8 bitmap_ctrl;
296 u8 pvb_field[PARTIAL_VBM_MAX]; /* Partial Virtual Bitmap */
297} __attribute__ ((packed));
298
299/* Virtual Bit Map update */
300struct wl12xx_cmd_vbm_update {
301 struct wl12xx_cmd_header header;
302 __le16 len;
303 u8 padding[2];
304 struct wl12xx_tim tim;
305} __attribute__ ((packed));
306
307enum wl12xx_cmd_ps_mode {
308 STATION_ACTIVE_MODE,
309 STATION_POWER_SAVE_MODE
310};
311
312struct wl12xx_cmd_ps_params {
313 struct wl12xx_cmd_header header;
314
315 u8 ps_mode; /* STATION_* */
316 u8 send_null_data; /* Do we have to send NULL data packet ? */
317 u8 retries; /* Number of retires for the initial NULL data packet */
318
319 /*
320 * TUs during which the target stays awake after switching
321 * to power save mode.
322 */
323 u8 hang_over_period;
324 u16 null_data_rate;
325 u8 pad[2];
326} __attribute__ ((packed));
327
328struct wl12xx_cmd_trigger_scan_to {
329 struct wl12xx_cmd_header header;
330
331 u32 timeout;
332};
333
334/* HW encryption keys */
335#define NUM_ACCESS_CATEGORIES_COPY 4
336#define MAX_KEY_SIZE 32
337
338/* When set, disable HW encryption */
339#define DF_ENCRYPTION_DISABLE 0x01
340/* When set, disable HW decryption */
341#define DF_SNIFF_MODE_ENABLE 0x80
342
343enum wl12xx_cmd_key_action {
344 KEY_ADD_OR_REPLACE = 1,
345 KEY_REMOVE = 2,
346 KEY_SET_ID = 3,
347 MAX_KEY_ACTION = 0xffff,
348};
349
350enum wl12xx_cmd_key_type {
351 KEY_WEP_DEFAULT = 0,
352 KEY_WEP_ADDR = 1,
353 KEY_AES_GROUP = 4,
354 KEY_AES_PAIRWISE = 5,
355 KEY_WEP_GROUP = 6,
356 KEY_TKIP_MIC_GROUP = 10,
357 KEY_TKIP_MIC_PAIRWISE = 11,
358};
359
360/*
361 *
362 * key_type_e key size key format
363 * ---------- --------- ----------
364 * 0x00 5, 13, 29 Key data
365 * 0x01 5, 13, 29 Key data
366 * 0x04 16 16 bytes of key data
367 * 0x05 16 16 bytes of key data
368 * 0x0a 32 16 bytes of TKIP key data
369 * 8 bytes of RX MIC key data
370 * 8 bytes of TX MIC key data
371 * 0x0b 32 16 bytes of TKIP key data
372 * 8 bytes of RX MIC key data
373 * 8 bytes of TX MIC key data
374 *
375 */
376
377struct wl12xx_cmd_set_keys {
378 struct wl12xx_cmd_header header;
379
380 /* Ignored for default WEP key */
381 u8 addr[ETH_ALEN];
382
383 /* key_action_e */
384 u16 key_action;
385
386 u16 reserved_1;
387
388 /* key size in bytes */
389 u8 key_size;
390
391 /* key_type_e */
392 u8 key_type;
393 u8 ssid_profile;
394
395 /*
396 * TKIP, AES: frame's key id field.
397 * For WEP default key: key id;
398 */
399 u8 id;
400 u8 reserved_2[6];
401 u8 key[MAX_KEY_SIZE];
402 u16 ac_seq_num16[NUM_ACCESS_CATEGORIES_COPY];
403 u32 ac_seq_num32[NUM_ACCESS_CATEGORIES_COPY];
404} __attribute__ ((packed));
405
264 406
265#endif /* __WL12XX_CMD_H__ */ 407#endif /* __WL12XX_CMD_H__ */