diff options
author | John W. Linville <linville@tuxdriver.com> | 2008-10-22 16:41:55 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-10-31 19:00:34 -0400 |
commit | 27df605ebe2c106c53957dfdaee5d948f01cfc97 (patch) | |
tree | 3f98e91643ebec86a2b07c8ed676a4aacd3c074a /drivers/net/wireless/p54/p54common.h | |
parent | 5e73444e91889ea6c7a83bc174ef8e8b6aaeea9b (diff) |
p54: integrate parts of lmac_longbow.h and other parts of stlc45xx
This patch removes most/all? of the "magic" numbers and unknown structure
variables inside the code and replaces them with meaningful prototypes.
(Plus a one line warning fix from Larry Finger <Larry.Finger@lwfinger.net>.)
Signed-off-by: Christian Lamparter <chunkeey@web.de>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/p54/p54common.h')
-rw-r--r-- | drivers/net/wireless/p54/p54common.h | 240 |
1 files changed, 221 insertions, 19 deletions
diff --git a/drivers/net/wireless/p54/p54common.h b/drivers/net/wireless/p54/p54common.h index 125f70a90dab..b1101feace69 100644 --- a/drivers/net/wireless/p54/p54common.h +++ b/drivers/net/wireless/p54/p54common.h | |||
@@ -33,6 +33,13 @@ struct bootrec_exp_if { | |||
33 | __le16 top_compat; | 33 | __le16 top_compat; |
34 | } __attribute__((packed)); | 34 | } __attribute__((packed)); |
35 | 35 | ||
36 | #define BR_DESC_PRIV_CAP_WEP BIT(0) | ||
37 | #define BR_DESC_PRIV_CAP_TKIP BIT(1) | ||
38 | #define BR_DESC_PRIV_CAP_MICHAEL BIT(2) | ||
39 | #define BR_DESC_PRIV_CAP_CCX_CP BIT(3) | ||
40 | #define BR_DESC_PRIV_CAP_CCX_MIC BIT(4) | ||
41 | #define BR_DESC_PRIV_CAP_AESCCMP BIT(5) | ||
42 | |||
36 | struct bootrec_desc { | 43 | struct bootrec_desc { |
37 | __le16 modes; | 44 | __le16 modes; |
38 | __le16 flags; | 45 | __le16 flags; |
@@ -40,7 +47,12 @@ struct bootrec_desc { | |||
40 | __le32 rx_end; | 47 | __le32 rx_end; |
41 | u8 headroom; | 48 | u8 headroom; |
42 | u8 tailroom; | 49 | u8 tailroom; |
43 | u8 unimportant[6]; | 50 | u8 tx_queues; |
51 | u8 tx_depth; | ||
52 | u8 privacy_caps; | ||
53 | u8 rx_keycache_size; | ||
54 | u8 time_size; | ||
55 | u8 padding; | ||
44 | u8 rates[16]; | 56 | u8 rates[16]; |
45 | u8 padding2[4]; | 57 | u8 padding2[4]; |
46 | __le16 rx_mtu; | 58 | __le16 rx_mtu; |
@@ -56,6 +68,34 @@ struct bootrec_desc { | |||
56 | #define BR_CODE_END_OF_BRA 0xFF0000FF | 68 | #define BR_CODE_END_OF_BRA 0xFF0000FF |
57 | #define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF | 69 | #define LEGACY_BR_CODE_END_OF_BRA 0xFFFFFFFF |
58 | 70 | ||
71 | #define P54_HDR_FLAG_CONTROL BIT(15) | ||
72 | #define P54_HDR_FLAG_CONTROL_OPSET (BIT(15) + BIT(0)) | ||
73 | |||
74 | #define P54_HDR_FLAG_DATA_ALIGN BIT(14) | ||
75 | #define P54_HDR_FLAG_DATA_OUT_PROMISC BIT(0) | ||
76 | #define P54_HDR_FLAG_DATA_OUT_TIMESTAMP BIT(1) | ||
77 | #define P54_HDR_FLAG_DATA_OUT_SEQNR BIT(2) | ||
78 | #define P54_HDR_FLAG_DATA_OUT_BIT3 BIT(3) | ||
79 | #define P54_HDR_FLAG_DATA_OUT_BURST BIT(4) | ||
80 | #define P54_HDR_FLAG_DATA_OUT_NOCANCEL BIT(5) | ||
81 | #define P54_HDR_FLAG_DATA_OUT_CLEARTIM BIT(6) | ||
82 | #define P54_HDR_FLAG_DATA_OUT_HITCHHIKE BIT(7) | ||
83 | #define P54_HDR_FLAG_DATA_OUT_COMPRESS BIT(8) | ||
84 | #define P54_HDR_FLAG_DATA_OUT_CONCAT BIT(9) | ||
85 | #define P54_HDR_FLAG_DATA_OUT_PCS_ACCEPT BIT(10) | ||
86 | #define P54_HDR_FLAG_DATA_OUT_WAITEOSP BIT(11) | ||
87 | |||
88 | #define P54_HDR_FLAG_DATA_IN_FCS_GOOD BIT(0) | ||
89 | #define P54_HDR_FLAG_DATA_IN_MATCH_MAC BIT(1) | ||
90 | #define P54_HDR_FLAG_DATA_IN_MCBC BIT(2) | ||
91 | #define P54_HDR_FLAG_DATA_IN_BEACON BIT(3) | ||
92 | #define P54_HDR_FLAG_DATA_IN_MATCH_BSS BIT(4) | ||
93 | #define P54_HDR_FLAG_DATA_IN_BCAST_BSS BIT(5) | ||
94 | #define P54_HDR_FLAG_DATA_IN_DATA BIT(6) | ||
95 | #define P54_HDR_FLAG_DATA_IN_TRUNCATED BIT(7) | ||
96 | #define P54_HDR_FLAG_DATA_IN_BIT8 BIT(8) | ||
97 | #define P54_HDR_FLAG_DATA_IN_TRANSPARENT BIT(9) | ||
98 | |||
59 | /* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */ | 99 | /* PDA defines are Copyright (C) 2005 Nokia Corporation (taken from islsm_pda.h) */ |
60 | 100 | ||
61 | struct pda_entry { | 101 | struct pda_entry { |
@@ -182,36 +222,91 @@ struct p54_eeprom_lm86 { | |||
182 | u8 data[0]; | 222 | u8 data[0]; |
183 | } __attribute__ ((packed)); | 223 | } __attribute__ ((packed)); |
184 | 224 | ||
185 | struct p54_rx_hdr { | 225 | enum p54_rx_decrypt_status { |
186 | __le16 magic; | 226 | P54_DECRYPT_NONE = 0, |
227 | P54_DECRYPT_OK, | ||
228 | P54_DECRYPT_NOKEY, | ||
229 | P54_DECRYPT_NOMICHAEL, | ||
230 | P54_DECRYPT_NOCKIPMIC, | ||
231 | P54_DECRYPT_FAIL_WEP, | ||
232 | P54_DECRYPT_FAIL_TKIP, | ||
233 | P54_DECRYPT_FAIL_MICAHEL, | ||
234 | P54_DECRYPT_FAIL_CKIPKP, | ||
235 | P54_DECRYPT_FAIL_CKIPMIC, | ||
236 | P54_DECRYPT_FAIL_AESCCMP | ||
237 | }; | ||
238 | |||
239 | struct p54_rx_data { | ||
240 | __le16 flags; | ||
187 | __le16 len; | 241 | __le16 len; |
188 | __le16 freq; | 242 | __le16 freq; |
189 | u8 antenna; | 243 | u8 antenna; |
190 | u8 rate; | 244 | u8 rate; |
191 | u8 rssi; | 245 | u8 rssi; |
192 | u8 quality; | 246 | u8 quality; |
193 | u16 unknown2; | 247 | u8 decrypt_status; |
248 | u8 rssi_raw; | ||
194 | __le32 tsf32; | 249 | __le32 tsf32; |
195 | __le32 unalloc0; | 250 | __le32 unalloc0; |
196 | u8 align[0]; | 251 | u8 align[0]; |
197 | } __attribute__ ((packed)); | 252 | } __attribute__ ((packed)); |
198 | 253 | ||
199 | struct p54_frame_sent_hdr { | 254 | enum p54_trap_type { |
255 | P54_TRAP_SCAN = 0, | ||
256 | P54_TRAP_TIMER, | ||
257 | P54_TRAP_BEACON_TX, | ||
258 | P54_TRAP_FAA_RADIO_ON, | ||
259 | P54_TRAP_FAA_RADIO_OFF, | ||
260 | P54_TRAP_RADAR, | ||
261 | P54_TRAP_NO_BEACON, | ||
262 | P54_TRAP_TBTT, | ||
263 | P54_TRAP_SCO_ENTER, | ||
264 | P54_TRAP_SCO_EXIT | ||
265 | }; | ||
266 | |||
267 | struct p54_trap { | ||
268 | __le16 event; | ||
269 | __le16 frequency; | ||
270 | } __attribute__ ((packed)); | ||
271 | |||
272 | enum p54_frame_sent_status { | ||
273 | P54_TX_OK = 0, | ||
274 | P54_TX_FAILED, | ||
275 | P54_TX_PSM, | ||
276 | P54_TX_PSM_CANCELLED | ||
277 | }; | ||
278 | |||
279 | struct p54_frame_sent { | ||
200 | u8 status; | 280 | u8 status; |
201 | u8 retries; | 281 | u8 tries; |
202 | __le16 ack_rssi; | 282 | u8 ack_rssi; |
283 | u8 quality; | ||
203 | __le16 seq; | 284 | __le16 seq; |
204 | u16 rate; | 285 | u8 antenna; |
286 | u8 padding; | ||
205 | } __attribute__ ((packed)); | 287 | } __attribute__ ((packed)); |
206 | 288 | ||
207 | struct p54_tx_control_allocdata { | 289 | enum p54_tx_data_crypt { |
290 | P54_CRYPTO_NONE = 0, | ||
291 | P54_CRYPTO_WEP, | ||
292 | P54_CRYPTO_TKIP, | ||
293 | P54_CRYPTO_TKIPMICHAEL, | ||
294 | P54_CRYPTO_CCX_WEPMIC, | ||
295 | P54_CRYPTO_CCX_KPMIC, | ||
296 | P54_CRYPTO_CCX_KP, | ||
297 | P54_CRYPTO_AESCCMP | ||
298 | }; | ||
299 | |||
300 | struct p54_tx_data { | ||
208 | u8 rateset[8]; | 301 | u8 rateset[8]; |
209 | u8 unalloc0[2]; | 302 | u8 rts_rate_idx; |
303 | u8 crypt_offset; | ||
210 | u8 key_type; | 304 | u8 key_type; |
211 | u8 key_len; | 305 | u8 key_len; |
212 | u8 key[16]; | 306 | u8 key[16]; |
213 | u8 hw_queue; | 307 | u8 hw_queue; |
214 | u8 unalloc1[9]; | 308 | u8 backlog; |
309 | __le16 durations[4]; | ||
215 | u8 tx_antenna; | 310 | u8 tx_antenna; |
216 | u8 output_power; | 311 | u8 output_power; |
217 | u8 cts_rate; | 312 | u8 cts_rate; |
@@ -219,6 +314,16 @@ struct p54_tx_control_allocdata { | |||
219 | u8 align[0]; | 314 | u8 align[0]; |
220 | } __attribute__ ((packed)); | 315 | } __attribute__ ((packed)); |
221 | 316 | ||
317 | #define P54_FILTER_TYPE_NONE 0 | ||
318 | #define P54_FILTER_TYPE_STATION BIT(0) | ||
319 | #define P54_FILTER_TYPE_IBSS BIT(1) | ||
320 | #define P54_FILTER_TYPE_AP BIT(2) | ||
321 | #define P54_FILTER_TYPE_TRANSPARENT BIT(3) | ||
322 | #define P54_FILTER_TYPE_PROMISCUOUS BIT(4) | ||
323 | #define P54_FILTER_TYPE_HIBERNATE BIT(5) | ||
324 | #define P54_FILTER_TYPE_NOACK BIT(6) | ||
325 | #define P54_FILTER_TYPE_RX_DISABLED BIT(7) | ||
326 | |||
222 | struct p54_setup_mac { | 327 | struct p54_setup_mac { |
223 | __le16 mac_mode; | 328 | __le16 mac_mode; |
224 | u8 mac_addr[ETH_ALEN]; | 329 | u8 mac_addr[ETH_ALEN]; |
@@ -253,8 +358,16 @@ struct p54_setup_mac { | |||
253 | } __attribute__ ((packed)); | 358 | } __attribute__ ((packed)); |
254 | } __attribute__ ((packed)); | 359 | } __attribute__ ((packed)); |
255 | 360 | ||
256 | struct p54_tx_control_channel { | 361 | #define P54_SETUP_V1_LEN 40 |
257 | __le16 flags; | 362 | #define P54_SETUP_V2_LEN (sizeof(struct p54_setup_mac)) |
363 | |||
364 | #define P54_SCAN_EXIT BIT(0) | ||
365 | #define P54_SCAN_TRAP BIT(1) | ||
366 | #define P54_SCAN_ACTIVE BIT(2) | ||
367 | #define P54_SCAN_FILTER BIT(3) | ||
368 | |||
369 | struct p54_scan { | ||
370 | __le16 mode; | ||
258 | __le16 dwell; | 371 | __le16 dwell; |
259 | u8 padding1[20]; | 372 | u8 padding1[20]; |
260 | struct pda_iq_autocal_entry iq_autocal; | 373 | struct pda_iq_autocal_entry iq_autocal; |
@@ -277,17 +390,17 @@ struct p54_tx_control_channel { | |||
277 | 390 | ||
278 | struct { | 391 | struct { |
279 | __le32 basic_rate_mask; | 392 | __le32 basic_rate_mask; |
280 | u8 rts_rates[8]; | 393 | u8 rts_rates[8]; |
281 | __le16 rssical_mul; | 394 | __le16 rssical_mul; |
282 | __le16 rssical_add; | 395 | __le16 rssical_add; |
283 | } v2 __attribute__ ((packed)); | 396 | } v2 __attribute__ ((packed)); |
284 | } __attribute__ ((packed)); | 397 | } __attribute__ ((packed)); |
285 | } __attribute__ ((packed)); | 398 | } __attribute__ ((packed)); |
286 | 399 | ||
287 | #define P54_TX_CONTROL_CHANNEL_V1_LEN (sizeof(struct p54_tx_control_channel)-12) | 400 | #define P54_SCAN_V1_LEN (sizeof(struct p54_scan)-12) |
288 | #define P54_TX_CONTROL_CHANNEL_V2_LEN (sizeof(struct p54_tx_control_channel)) | 401 | #define P54_SCAN_V2_LEN (sizeof(struct p54_scan)) |
289 | 402 | ||
290 | struct p54_tx_control_led { | 403 | struct p54_led { |
291 | __le16 mode; | 404 | __le16 mode; |
292 | __le16 led_temporary; | 405 | __le16 led_temporary; |
293 | __le16 led_permanent; | 406 | __le16 led_permanent; |
@@ -315,14 +428,103 @@ struct p54_statistics { | |||
315 | __le32 tsf32; | 428 | __le32 tsf32; |
316 | __le32 airtime; | 429 | __le32 airtime; |
317 | __le32 noise; | 430 | __le32 noise; |
318 | __le32 unkn[10]; /* CCE / CCA / RADAR */ | 431 | __le32 sample_noise[8]; |
432 | __le32 sample_cca; | ||
433 | __le32 sample_tx; | ||
319 | } __attribute__ ((packed)); | 434 | } __attribute__ ((packed)); |
320 | 435 | ||
321 | struct p54_tx_control_xbow_synth { | 436 | struct p54_xbow_synth { |
322 | __le16 magic1; | 437 | __le16 magic1; |
323 | __le16 magic2; | 438 | __le16 magic2; |
324 | __le16 freq; | 439 | __le16 freq; |
325 | u32 padding[5]; | 440 | u32 padding[5]; |
326 | } __attribute__ ((packed)); | 441 | } __attribute__ ((packed)); |
327 | 442 | ||
443 | struct p54_timer { | ||
444 | __le32 interval; | ||
445 | } __attribute__ ((packed)); | ||
446 | |||
447 | struct p54_keycache { | ||
448 | u8 entry; | ||
449 | u8 key_id; | ||
450 | u8 mac[ETH_ALEN]; | ||
451 | u8 padding[2]; | ||
452 | u8 key_type; | ||
453 | u8 key_len; | ||
454 | u8 key[24]; | ||
455 | } __attribute__ ((packed)); | ||
456 | |||
457 | struct p54_burst { | ||
458 | u8 flags; | ||
459 | u8 queue; | ||
460 | u8 backlog; | ||
461 | u8 pad; | ||
462 | __le16 durations[32]; | ||
463 | } __attribute__ ((packed)); | ||
464 | |||
465 | struct p54_psm_interval { | ||
466 | __le16 interval; | ||
467 | __le16 periods; | ||
468 | } __attribute__ ((packed)); | ||
469 | |||
470 | #define P54_PSM BIT(0) | ||
471 | #define P54_PSM_DTIM BIT(1) | ||
472 | #define P54_PSM_MCBC BIT(2) | ||
473 | #define P54_PSM_CHECKSUM BIT(3) | ||
474 | #define P54_PSM_SKIP_MORE_DATA BIT(4) | ||
475 | #define P54_PSM_BEACON_TIMEOUT BIT(5) | ||
476 | #define P54_PSM_HFOSLEEP BIT(6) | ||
477 | #define P54_PSM_AUTOSWITCH_SLEEP BIT(7) | ||
478 | #define P54_PSM_LPIT BIT(8) | ||
479 | #define P54_PSM_BF_UCAST_SKIP BIT(9) | ||
480 | #define P54_PSM_BF_MCAST_SKIP BIT(10) | ||
481 | |||
482 | struct p54_psm { | ||
483 | __le16 mode; | ||
484 | __le16 aid; | ||
485 | struct p54_psm_interval intervals[4]; | ||
486 | u8 beacon_rssi_skip_max; | ||
487 | u8 rssi_delta_threshold; | ||
488 | u8 nr; | ||
489 | u8 exclude[1]; | ||
490 | } __attribute__ ((packed)); | ||
491 | |||
492 | #define MC_FILTER_ADDRESS_NUM 4 | ||
493 | |||
494 | struct p54_group_address_table { | ||
495 | __le16 filter_enable; | ||
496 | __le16 num_address; | ||
497 | u8 mac_list[MC_FILTER_ADDRESS_NUM][ETH_ALEN]; | ||
498 | } __attribute__ ((packed)); | ||
499 | |||
500 | struct p54_txcancel { | ||
501 | __le32 req_id; | ||
502 | } __attribute__ ((packed)); | ||
503 | |||
504 | struct p54_sta_unlock { | ||
505 | u8 addr[ETH_ALEN]; | ||
506 | u16 padding; | ||
507 | } __attribute__ ((packed)); | ||
508 | |||
509 | #define P54_TIM_CLEAR BIT(15) | ||
510 | struct p54_tx_control_tim { | ||
511 | u8 count; | ||
512 | u8 padding[3]; | ||
513 | __le16 entry[8]; | ||
514 | } __attribute__ ((packed)); | ||
515 | |||
516 | struct p54_cce_quiet { | ||
517 | __le32 period; | ||
518 | } __attribute__ ((packed)); | ||
519 | |||
520 | struct p54_bt_balancer { | ||
521 | __le16 prio_thresh; | ||
522 | __le16 acl_thresh; | ||
523 | } __attribute__ ((packed)); | ||
524 | |||
525 | struct p54_arp_table { | ||
526 | __le16 filter_enable; | ||
527 | u8 ipv4_addr[4]; | ||
528 | } __attribute__ ((packed)); | ||
529 | |||
328 | #endif /* P54COMMON_H */ | 530 | #endif /* P54COMMON_H */ |