aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-3945.h
diff options
context:
space:
mode:
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>2008-12-18 21:37:28 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-01-29 15:59:13 -0500
commit4a8a43222db6f04c88def2160a95f978f704b515 (patch)
treec5b5666c735e4f78045688ece7f5879f9529b032 /drivers/net/wireless/iwlwifi/iwl-3945.h
parentf2c7e52100545e54af064fe0345d141fdcf2d243 (diff)
iwl3945: replaces iwl3945_priv with iwl_priv
The patch replaces iwl3945_priv to iwl_priv. It adds 3945 specific data members to iwl_priv. Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Signed-off-by: Zhu Yi <yi.zhu@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h333
1 files changed, 57 insertions, 276 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index 788cd9cc4b13..098ac768ee26 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -148,13 +148,13 @@ struct iwl3945_frame {
148#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4) 148#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
149 149
150struct iwl3945_cmd; 150struct iwl3945_cmd;
151struct iwl3945_priv; 151struct iwl_priv;
152 152
153struct iwl3945_cmd_meta { 153struct iwl3945_cmd_meta {
154 struct iwl3945_cmd_meta *source; 154 struct iwl3945_cmd_meta *source;
155 union { 155 union {
156 struct sk_buff *skb; 156 struct sk_buff *skb;
157 int (*callback)(struct iwl3945_priv *priv, 157 int (*callback)(struct iwl_priv *priv,
158 struct iwl3945_cmd *cmd, struct sk_buff *skb); 158 struct iwl3945_cmd *cmd, struct sk_buff *skb);
159 } __attribute__ ((packed)) u; 159 } __attribute__ ((packed)) u;
160 160
@@ -270,31 +270,31 @@ struct iwl3945_ibss_seq {
270 * 270 *
271 *****************************************************************************/ 271 *****************************************************************************/
272struct iwl3945_addsta_cmd; 272struct iwl3945_addsta_cmd;
273extern int iwl3945_send_add_station(struct iwl3945_priv *priv, 273extern int iwl3945_send_add_station(struct iwl_priv *priv,
274 struct iwl3945_addsta_cmd *sta, u8 flags); 274 struct iwl3945_addsta_cmd *sta, u8 flags);
275extern u8 iwl3945_add_station(struct iwl3945_priv *priv, const u8 *bssid, 275extern u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *bssid,
276 int is_ap, u8 flags); 276 int is_ap, u8 flags);
277extern int iwl3945_power_init_handle(struct iwl3945_priv *priv); 277extern int iwl3945_power_init_handle(struct iwl_priv *priv);
278extern int iwl3945_eeprom_init(struct iwl3945_priv *priv); 278extern int iwl3945_eeprom_init(struct iwl_priv *priv);
279extern int iwl3945_rx_queue_alloc(struct iwl3945_priv *priv); 279extern int iwl3945_rx_queue_alloc(struct iwl_priv *priv);
280extern void iwl3945_rx_queue_reset(struct iwl3945_priv *priv, 280extern void iwl3945_rx_queue_reset(struct iwl_priv *priv,
281 struct iwl_rx_queue *rxq); 281 struct iwl_rx_queue *rxq);
282extern int iwl3945_calc_db_from_ratio(int sig_ratio); 282extern int iwl3945_calc_db_from_ratio(int sig_ratio);
283extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm); 283extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm);
284extern int iwl3945_tx_queue_init(struct iwl3945_priv *priv, 284extern int iwl3945_tx_queue_init(struct iwl_priv *priv,
285 struct iwl3945_tx_queue *txq, int count, u32 id); 285 struct iwl3945_tx_queue *txq, int count, u32 id);
286extern void iwl3945_rx_replenish(void *data); 286extern void iwl3945_rx_replenish(void *data);
287extern void iwl3945_tx_queue_free(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq); 287extern void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl3945_tx_queue *txq);
288extern int iwl3945_send_cmd_pdu(struct iwl3945_priv *priv, u8 id, u16 len, 288extern int iwl3945_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len,
289 const void *data); 289 const void *data);
290extern int __must_check iwl3945_send_cmd(struct iwl3945_priv *priv, 290extern int __must_check iwl3945_send_cmd(struct iwl_priv *priv,
291 struct iwl3945_host_cmd *cmd); 291 struct iwl3945_host_cmd *cmd);
292extern unsigned int iwl3945_fill_beacon_frame(struct iwl3945_priv *priv, 292extern unsigned int iwl3945_fill_beacon_frame(struct iwl_priv *priv,
293 struct ieee80211_hdr *hdr,int left); 293 struct ieee80211_hdr *hdr,int left);
294extern int iwl3945_rx_queue_update_write_ptr(struct iwl3945_priv *priv, 294extern int iwl3945_rx_queue_update_write_ptr(struct iwl_priv *priv,
295 struct iwl_rx_queue *q); 295 struct iwl_rx_queue *q);
296extern int iwl3945_send_statistics_request(struct iwl3945_priv *priv); 296extern int iwl3945_send_statistics_request(struct iwl_priv *priv);
297extern void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff *skb, 297extern void iwl3945_set_decrypted_flag(struct iwl_priv *priv, struct sk_buff *skb,
298 u32 decrypt_res, 298 u32 decrypt_res,
299 struct ieee80211_rx_status *stats); 299 struct ieee80211_rx_status *stats);
300 300
@@ -302,7 +302,7 @@ extern void iwl3945_set_decrypted_flag(struct iwl3945_priv *priv, struct sk_buff
302 * Currently used by iwl-3945-rs... look at restructuring so that it doesn't 302 * Currently used by iwl-3945-rs... look at restructuring so that it doesn't
303 * call this... todo... fix that. 303 * call this... todo... fix that.
304*/ 304*/
305extern u8 iwl3945_sync_station(struct iwl3945_priv *priv, int sta_id, 305extern u8 iwl3945_sync_station(struct iwl_priv *priv, int sta_id,
306 u16 tx_rate, u8 flags); 306 u16 tx_rate, u8 flags);
307 307
308/****************************************************************************** 308/******************************************************************************
@@ -321,36 +321,36 @@ extern u8 iwl3945_sync_station(struct iwl3945_priv *priv, int sta_id,
321 * iwl3945_mac_ <-- mac80211 callback 321 * iwl3945_mac_ <-- mac80211 callback
322 * 322 *
323 ****************************************************************************/ 323 ****************************************************************************/
324extern void iwl3945_hw_rx_handler_setup(struct iwl3945_priv *priv); 324extern void iwl3945_hw_rx_handler_setup(struct iwl_priv *priv);
325extern void iwl3945_hw_setup_deferred_work(struct iwl3945_priv *priv); 325extern void iwl3945_hw_setup_deferred_work(struct iwl_priv *priv);
326extern void iwl3945_hw_cancel_deferred_work(struct iwl3945_priv *priv); 326extern void iwl3945_hw_cancel_deferred_work(struct iwl_priv *priv);
327extern int iwl3945_hw_rxq_stop(struct iwl3945_priv *priv); 327extern int iwl3945_hw_rxq_stop(struct iwl_priv *priv);
328extern int iwl3945_hw_set_hw_params(struct iwl3945_priv *priv); 328extern int iwl3945_hw_set_hw_params(struct iwl_priv *priv);
329extern int iwl3945_hw_nic_init(struct iwl3945_priv *priv); 329extern int iwl3945_hw_nic_init(struct iwl_priv *priv);
330extern int iwl3945_hw_nic_stop_master(struct iwl3945_priv *priv); 330extern int iwl3945_hw_nic_stop_master(struct iwl_priv *priv);
331extern void iwl3945_hw_txq_ctx_free(struct iwl3945_priv *priv); 331extern void iwl3945_hw_txq_ctx_free(struct iwl_priv *priv);
332extern void iwl3945_hw_txq_ctx_stop(struct iwl3945_priv *priv); 332extern void iwl3945_hw_txq_ctx_stop(struct iwl_priv *priv);
333extern int iwl3945_hw_nic_reset(struct iwl3945_priv *priv); 333extern int iwl3945_hw_nic_reset(struct iwl_priv *priv);
334extern int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl3945_priv *priv, void *tfd, 334extern int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd,
335 dma_addr_t addr, u16 len); 335 dma_addr_t addr, u16 len);
336extern int iwl3945_hw_txq_free_tfd(struct iwl3945_priv *priv, struct iwl3945_tx_queue *txq); 336extern int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq);
337extern int iwl3945_hw_get_temperature(struct iwl3945_priv *priv); 337extern int iwl3945_hw_get_temperature(struct iwl_priv *priv);
338extern int iwl3945_hw_tx_queue_init(struct iwl3945_priv *priv, 338extern int iwl3945_hw_tx_queue_init(struct iwl_priv *priv,
339 struct iwl3945_tx_queue *txq); 339 struct iwl3945_tx_queue *txq);
340extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl3945_priv *priv, 340extern unsigned int iwl3945_hw_get_beacon_cmd(struct iwl_priv *priv,
341 struct iwl3945_frame *frame, u8 rate); 341 struct iwl3945_frame *frame, u8 rate);
342extern int iwl3945_hw_get_rx_read(struct iwl3945_priv *priv); 342extern int iwl3945_hw_get_rx_read(struct iwl_priv *priv);
343extern void iwl3945_hw_build_tx_cmd_rate(struct iwl3945_priv *priv, 343extern void iwl3945_hw_build_tx_cmd_rate(struct iwl_priv *priv,
344 struct iwl3945_cmd *cmd, 344 struct iwl3945_cmd *cmd,
345 struct ieee80211_tx_info *info, 345 struct ieee80211_tx_info *info,
346 struct ieee80211_hdr *hdr, 346 struct ieee80211_hdr *hdr,
347 int sta_id, int tx_id); 347 int sta_id, int tx_id);
348extern int iwl3945_hw_reg_send_txpower(struct iwl3945_priv *priv); 348extern int iwl3945_hw_reg_send_txpower(struct iwl_priv *priv);
349extern int iwl3945_hw_reg_set_txpower(struct iwl3945_priv *priv, s8 power); 349extern int iwl3945_hw_reg_set_txpower(struct iwl_priv *priv, s8 power);
350extern void iwl3945_hw_rx_statistics(struct iwl3945_priv *priv, 350extern void iwl3945_hw_rx_statistics(struct iwl_priv *priv,
351 struct iwl_rx_mem_buffer *rxb); 351 struct iwl_rx_mem_buffer *rxb);
352extern void iwl3945_disable_events(struct iwl3945_priv *priv); 352extern void iwl3945_disable_events(struct iwl_priv *priv);
353extern int iwl4965_get_temperature(const struct iwl3945_priv *priv); 353extern int iwl4965_get_temperature(const struct iwl_priv *priv);
354 354
355/** 355/**
356 * iwl3945_hw_find_station - Find station id for a given BSSID 356 * iwl3945_hw_find_station - Find station id for a given BSSID
@@ -360,262 +360,43 @@ extern int iwl4965_get_temperature(const struct iwl3945_priv *priv);
360 * not yet been merged into a single common layer for managing the 360 * not yet been merged into a single common layer for managing the
361 * station tables. 361 * station tables.
362 */ 362 */
363extern u8 iwl3945_hw_find_station(struct iwl3945_priv *priv, const u8 *bssid); 363extern u8 iwl3945_hw_find_station(struct iwl_priv *priv, const u8 *bssid);
364 364
365extern int iwl3945_hw_channel_switch(struct iwl3945_priv *priv, u16 channel); 365extern int iwl3945_hw_channel_switch(struct iwl_priv *priv, u16 channel);
366 366
367/* 367/*
368 * Forward declare iwl-3945.c functions for iwl-base.c 368 * Forward declare iwl-3945.c functions for iwl-base.c
369 */ 369 */
370extern __le32 iwl3945_get_antenna_flags(const struct iwl3945_priv *priv); 370extern __le32 iwl3945_get_antenna_flags(const struct iwl_priv *priv);
371extern int iwl3945_init_hw_rate_table(struct iwl3945_priv *priv); 371extern int iwl3945_init_hw_rate_table(struct iwl_priv *priv);
372extern void iwl3945_reg_txpower_periodic(struct iwl3945_priv *priv); 372extern void iwl3945_reg_txpower_periodic(struct iwl_priv *priv);
373extern int iwl3945_txpower_set_from_eeprom(struct iwl3945_priv *priv); 373extern int iwl3945_txpower_set_from_eeprom(struct iwl_priv *priv);
374extern u8 iwl3945_sync_sta(struct iwl3945_priv *priv, int sta_id, 374extern u8 iwl3945_sync_sta(struct iwl_priv *priv, int sta_id,
375 u16 tx_rate, u8 flags); 375 u16 tx_rate, u8 flags);
376 376
377#ifdef CONFIG_IWL3945_RFKILL 377#ifdef CONFIG_IWL3945_RFKILL
378struct iwl3945_priv; 378struct iwl_priv;
379 379
380void iwl3945_rfkill_set_hw_state(struct iwl3945_priv *priv); 380void iwl3945_rfkill_set_hw_state(struct iwl_priv *priv);
381void iwl3945_rfkill_unregister(struct iwl3945_priv *priv); 381void iwl3945_rfkill_unregister(struct iwl_priv *priv);
382int iwl3945_rfkill_init(struct iwl3945_priv *priv); 382int iwl3945_rfkill_init(struct iwl_priv *priv);
383#else 383#else
384static inline void iwl3945_rfkill_set_hw_state(struct iwl3945_priv *priv) {} 384static inline void iwl3945_rfkill_set_hw_state(struct iwl_priv *priv) {}
385static inline void iwl3945_rfkill_unregister(struct iwl3945_priv *priv) {} 385static inline void iwl3945_rfkill_unregister(struct iwl_priv *priv) {}
386static inline int iwl3945_rfkill_init(struct iwl3945_priv *priv) { return 0; } 386static inline int iwl3945_rfkill_init(struct iwl_priv *priv) { return 0; }
387#endif 387#endif
388 388
389 389static inline int iwl3945_is_associated(struct iwl_priv *priv)
390struct iwl3945_priv {
391
392 /* ieee device used by generic ieee processing code */
393 struct ieee80211_hw *hw;
394 struct ieee80211_channel *ieee_channels;
395 struct ieee80211_rate *ieee_rates;
396 struct iwl_cfg *cfg; /* device configuration */
397
398 /* temporary frame storage list */
399 struct list_head free_frames;
400 int frames_count;
401
402 enum ieee80211_band band;
403 int alloc_rxb_skb;
404
405 void (*rx_handlers[REPLY_MAX])(struct iwl3945_priv *priv,
406 struct iwl_rx_mem_buffer *rxb);
407
408 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
409
410#ifdef CONFIG_IWL3945_SPECTRUM_MEASUREMENT
411 /* spectrum measurement report caching */
412 struct iwl_spectrum_notification measure_report;
413 u8 measurement_status;
414#endif
415 /* ucode beacon time */
416 u32 ucode_beacon_time;
417
418 /* we allocate array of iwl3945_channel_info for NIC's valid channels.
419 * Access via channel # using indirect index array */
420 struct iwl_channel_info *channel_info; /* channel info array */
421 u8 channel_count; /* # of channels */
422
423 /* each calibration channel group in the EEPROM has a derived
424 * clip setting for each rate. */
425 const struct iwl3945_clip_group clip39_groups[5];
426
427 /* thermal calibration */
428 s32 temperature; /* degrees Kelvin */
429 s32 last_temperature;
430
431 /* Scan related variables */
432 unsigned long last_scan_jiffies;
433 unsigned long next_scan_jiffies;
434 unsigned long scan_start;
435 unsigned long scan_pass_start;
436 unsigned long scan_start_tsf;
437 int scan_bands;
438 int one_direct_scan;
439 u8 direct_ssid_len;
440 u8 direct_ssid[IW_ESSID_MAX_SIZE];
441 struct iwl3945_scan_cmd *scan39;
442
443 /* spinlock */
444 spinlock_t lock; /* protect general shared data */
445 spinlock_t hcmd_lock; /* protect hcmd */
446 struct mutex mutex;
447
448 /* basic pci-network driver stuff */
449 struct pci_dev *pci_dev;
450
451 /* pci hardware address support */
452 void __iomem *hw_base;
453
454 /* uCode images, save to reload in case of failure */
455 u32 ucode_ver; /* ucode version, copy of
456 iwl_ucode.ver */
457 struct fw_desc ucode_code; /* runtime inst */
458 struct fw_desc ucode_data; /* runtime data original */
459 struct fw_desc ucode_data_backup; /* runtime data save/restore */
460 struct fw_desc ucode_init; /* initialization inst */
461 struct fw_desc ucode_init_data; /* initialization data */
462 struct fw_desc ucode_boot; /* bootstrap inst */
463
464
465 struct iwl_rxon_time_cmd rxon_timing;
466
467 /* We declare this const so it can only be
468 * changed via explicit cast within the
469 * routines that actually update the physical
470 * hardware */
471 const struct iwl3945_rxon_cmd active39_rxon;
472 struct iwl3945_rxon_cmd staging39_rxon;
473
474 int error_recovering;
475 struct iwl3945_rxon_cmd recovery39_rxon;
476
477 /* 1st responses from initialize and runtime uCode images.
478 * 4965's initialize alive response contains some calibration data. */
479 /* FIXME: 4965 uses bigger structure for init */
480 struct iwl_alive_resp card_alive_init;
481 struct iwl_alive_resp card_alive;
482
483#ifdef CONFIG_IWL3945_RFKILL
484 struct rfkill *rfkill;
485#endif
486
487#ifdef CONFIG_IWL3945_LEDS
488 struct iwl3945_led led39[IWL_LED_TRG_MAX];
489 unsigned long last_blink_time;
490 u8 last_blink_rate;
491 u8 allow_blinking;
492 unsigned int rxtxpackets;
493 u64 led_tpt;
494#endif
495
496
497 u16 active_rate;
498 u16 active_rate_basic;
499
500 u32 sta_supp_rates;
501
502 u8 call_post_assoc_from_beacon;
503 /* Rate scaling data */
504 s8 data_retry_limit;
505 u8 retry_rate;
506
507 wait_queue_head_t wait_command_queue;
508
509 int activity_timer_active;
510
511 /* Rx and Tx DMA processing queues */
512 struct iwl_rx_queue rxq;
513 struct iwl3945_tx_queue txq39[IWL39_MAX_NUM_QUEUES];
514
515 unsigned long status;
516
517 int last_rx_rssi; /* From Rx packet statisitics */
518 int last_rx_noise; /* From beacon statistics */
519
520 struct iwl3945_power_mgr power_data_39;
521
522 struct iwl3945_notif_statistics statistics_39;
523 unsigned long last_statistics_time;
524
525 /* context information */
526 u16 rates_mask;
527
528 u32 power_mode;
529 u32 antenna;
530 u8 bssid[ETH_ALEN];
531 u16 rts_threshold;
532 u8 mac_addr[ETH_ALEN];
533
534 /*station table variables */
535 spinlock_t sta_lock;
536 int num_stations;
537 struct iwl3945_station_entry stations_39[IWL_STATION_COUNT];
538
539 /* Indication if ieee80211_ops->open has been called */
540 u8 is_open;
541
542 u8 mac80211_registered;
543
544 /* Rx'd packet timing information */
545 u32 last_beacon_time;
546 u64 last_tsf;
547
548 /* eeprom */
549 struct iwl3945_eeprom eeprom39;
550
551 enum nl80211_iftype iw_mode;
552
553 struct sk_buff *ibss_beacon;
554
555 /* Last Rx'd beacon timestamp */
556 u64 timestamp;
557 u16 beacon_int;
558 void *shared_virt;
559 dma_addr_t shared_phys;
560 struct iwl_hw_params hw_params;
561 struct ieee80211_vif *vif;
562
563 /* Current association information needed to configure the
564 * hardware */
565 u16 assoc_id;
566 u16 assoc_capability;
567 u8 ps_mode;
568
569 struct iwl_qos_info qos_data;
570
571 struct workqueue_struct *workqueue;
572
573 struct work_struct up;
574 struct work_struct restart;
575 struct work_struct calibrated_work;
576 struct work_struct scan_completed;
577 struct work_struct rx_replenish;
578 struct work_struct rf_kill;
579 struct work_struct abort_scan;
580 struct work_struct update_link_led;
581 struct work_struct auth_work;
582 struct work_struct report_work;
583 struct work_struct request_scan;
584 struct work_struct beacon_update;
585
586 struct tasklet_struct irq_tasklet;
587
588 struct delayed_work init_alive_start;
589 struct delayed_work alive_start;
590 struct delayed_work activity_timer;
591 struct delayed_work thermal_periodic;
592 struct delayed_work gather_stats;
593 struct delayed_work scan_check;
594
595#define IWL_DEFAULT_TX_POWER 0x0F
596 s8 user_txpower_limit;
597 s8 max_channel_txpower_limit;
598
599
600#ifdef CONFIG_IWL3945_DEBUG
601 /* debugging info */
602 u32 debug_level;
603 u32 framecnt_to_us;
604 atomic_t restrict_refcnt;
605#endif
606}; /*iwl3945_priv */
607
608static inline int iwl3945_is_associated(struct iwl3945_priv *priv)
609{ 390{
610 return (priv->active39_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0; 391 return (priv->active39_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
611} 392}
612 393
613extern const struct iwl_channel_info *iwl3945_get_channel_info( 394extern const struct iwl_channel_info *iwl3945_get_channel_info(
614 const struct iwl3945_priv *priv, enum ieee80211_band band, u16 channel); 395 const struct iwl_priv *priv, enum ieee80211_band band, u16 channel);
615 396
616extern int iwl3945_rs_next_rate(struct iwl3945_priv *priv, int rate); 397extern int iwl3945_rs_next_rate(struct iwl_priv *priv, int rate);
617 398
618/* Requires full declaration of iwl3945_priv before including */ 399/* Requires full declaration of iwl_priv before including */
619#include "iwl-3945-io.h" 400#include "iwl-3945-io.h"
620 401
621#endif 402#endif