aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-4965.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-4965.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-4965.h158
1 files changed, 51 insertions, 107 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-4965.h b/drivers/net/wireless/iwlwifi/iwl-4965.h
index 9cb82be0ff80..f4e395fcb807 100644
--- a/drivers/net/wireless/iwlwifi/iwl-4965.h
+++ b/drivers/net/wireless/iwlwifi/iwl-4965.h
@@ -1,6 +1,6 @@
1/****************************************************************************** 1/******************************************************************************
2 * 2 *
3 * Copyright(c) 2003 - 2007 Intel Corporation. All rights reserved. 3 * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
4 * 4 *
5 * This program is free software; you can redistribute it and/or modify it 5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of version 2 of the GNU General Public License as 6 * under the terms of version 2 of the GNU General Public License as
@@ -40,10 +40,19 @@
40extern struct pci_device_id iwl4965_hw_card_ids[]; 40extern struct pci_device_id iwl4965_hw_card_ids[];
41 41
42#define DRV_NAME "iwl4965" 42#define DRV_NAME "iwl4965"
43#include "iwl-eeprom.h"
43#include "iwl-4965-hw.h" 44#include "iwl-4965-hw.h"
45#include "iwl-csr.h"
44#include "iwl-prph.h" 46#include "iwl-prph.h"
45#include "iwl-4965-debug.h" 47#include "iwl-4965-debug.h"
46 48
49/* Change firmware file name, using "-" and incrementing number,
50 * *only* when uCode interface or architecture changes so that it
51 * is not compatible with earlier drivers.
52 * This number will also appear in << 8 position of 1st dword of uCode file */
53#define IWL4965_UCODE_API "-1"
54
55
47/* Default noise level to report when noise measurement is not available. 56/* Default noise level to report when noise measurement is not available.
48 * This may be because we're: 57 * This may be because we're:
49 * 1) Not associated (4965, no beacon statistics being sent to driver) 58 * 1) Not associated (4965, no beacon statistics being sent to driver)
@@ -206,7 +215,7 @@ struct iwl4965_channel_info {
206 215
207 u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */ 216 u8 group_index; /* 0-4, maps channel to group1/2/3/4/5 */
208 u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */ 217 u8 band_index; /* 0-4, maps channel to band1/2/3/4/5 */
209 u8 phymode; /* MODE_IEEE80211{A,B,G} */ 218 enum ieee80211_band band;
210 219
211 /* Radio/DSP gain settings for each "normal" data Tx rate. 220 /* Radio/DSP gain settings for each "normal" data Tx rate.
212 * These include, in addition to RF and DSP gain, a few fields for 221 * These include, in addition to RF and DSP gain, a few fields for
@@ -433,7 +442,6 @@ struct iwl4965_rx_queue {
433#define IWL_INVALID_VALUE -1 442#define IWL_INVALID_VALUE -1
434 443
435#ifdef CONFIG_IWL4965_HT 444#ifdef CONFIG_IWL4965_HT
436#ifdef CONFIG_IWL4965_HT_AGG
437/** 445/**
438 * struct iwl4965_ht_agg -- aggregation status while waiting for block-ack 446 * struct iwl4965_ht_agg -- aggregation status while waiting for block-ack
439 * @txq_id: Tx queue used for Tx attempt 447 * @txq_id: Tx queue used for Tx attempt
@@ -453,19 +461,22 @@ struct iwl4965_ht_agg {
453 u16 frame_count; 461 u16 frame_count;
454 u16 wait_for_ba; 462 u16 wait_for_ba;
455 u16 start_idx; 463 u16 start_idx;
456 u32 bitmap0; 464 u64 bitmap;
457 u32 bitmap1;
458 u32 rate_n_flags; 465 u32 rate_n_flags;
466#define IWL_AGG_OFF 0
467#define IWL_AGG_ON 1
468#define IWL_EMPTYING_HW_QUEUE_ADDBA 2
469#define IWL_EMPTYING_HW_QUEUE_DELBA 3
470 u8 state;
459}; 471};
460#endif /* CONFIG_IWL4965_HT_AGG */ 472
461#endif /* CONFIG_IWL4965_HT */ 473#endif /* CONFIG_IWL4965_HT */
462 474
463struct iwl4965_tid_data { 475struct iwl4965_tid_data {
464 u16 seq_number; 476 u16 seq_number;
477 u16 tfds_in_queue;
465#ifdef CONFIG_IWL4965_HT 478#ifdef CONFIG_IWL4965_HT
466#ifdef CONFIG_IWL4965_HT_AGG
467 struct iwl4965_ht_agg agg; 479 struct iwl4965_ht_agg agg;
468#endif /* CONFIG_IWL4965_HT_AGG */
469#endif /* CONFIG_IWL4965_HT */ 480#endif /* CONFIG_IWL4965_HT */
470}; 481};
471 482
@@ -508,8 +519,6 @@ struct iwl_ht_info {
508}; 519};
509#endif /*CONFIG_IWL4965_HT */ 520#endif /*CONFIG_IWL4965_HT */
510 521
511#ifdef CONFIG_IWL4965_QOS
512
513union iwl4965_qos_capabity { 522union iwl4965_qos_capabity {
514 struct { 523 struct {
515 u8 edca_count:4; /* bit 0-3 */ 524 u8 edca_count:4; /* bit 0-3 */
@@ -537,7 +546,6 @@ struct iwl4965_qos_info {
537 union iwl4965_qos_capabity qos_cap; 546 union iwl4965_qos_capabity qos_cap;
538 struct iwl4965_qosparam_cmd def_qos_parm; 547 struct iwl4965_qosparam_cmd def_qos_parm;
539}; 548};
540#endif /*CONFIG_IWL4965_QOS */
541 549
542#define STA_PS_STATUS_WAKE 0 550#define STA_PS_STATUS_WAKE 0
543#define STA_PS_STATUS_SLEEP 1 551#define STA_PS_STATUS_SLEEP 1
@@ -581,8 +589,8 @@ struct iwl4965_ibss_seq {
581/** 589/**
582 * struct iwl4965_driver_hw_info 590 * struct iwl4965_driver_hw_info
583 * @max_txq_num: Max # Tx queues supported 591 * @max_txq_num: Max # Tx queues supported
584 * @ac_queue_count: # Tx queues for EDCA Access Categories (AC)
585 * @tx_cmd_len: Size of Tx command (but not including frame itself) 592 * @tx_cmd_len: Size of Tx command (but not including frame itself)
593 * @tx_ant_num: Number of TX antennas
586 * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2) 594 * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
587 * @rx_buffer_size: 595 * @rx_buffer_size:
588 * @max_rxq_log: Log-base-2 of max_rxq_size 596 * @max_rxq_log: Log-base-2 of max_rxq_size
@@ -593,8 +601,8 @@ struct iwl4965_ibss_seq {
593 */ 601 */
594struct iwl4965_driver_hw_info { 602struct iwl4965_driver_hw_info {
595 u16 max_txq_num; 603 u16 max_txq_num;
596 u16 ac_queue_count;
597 u16 tx_cmd_len; 604 u16 tx_cmd_len;
605 u16 tx_ant_num;
598 u16 max_rxq_size; 606 u16 max_rxq_size;
599 u32 rx_buf_size; 607 u32 rx_buf_size;
600 u32 max_pkt_size; 608 u32 max_pkt_size;
@@ -633,17 +641,6 @@ extern u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr,
633extern int iwl4965_is_network_packet(struct iwl4965_priv *priv, 641extern int iwl4965_is_network_packet(struct iwl4965_priv *priv,
634 struct ieee80211_hdr *header); 642 struct ieee80211_hdr *header);
635extern int iwl4965_power_init_handle(struct iwl4965_priv *priv); 643extern int iwl4965_power_init_handle(struct iwl4965_priv *priv);
636extern int iwl4965_eeprom_init(struct iwl4965_priv *priv);
637#ifdef CONFIG_IWL4965_DEBUG
638extern void iwl4965_report_frame(struct iwl4965_priv *priv,
639 struct iwl4965_rx_packet *pkt,
640 struct ieee80211_hdr *header, int group100);
641#else
642static inline void iwl4965_report_frame(struct iwl4965_priv *priv,
643 struct iwl4965_rx_packet *pkt,
644 struct ieee80211_hdr *header,
645 int group100) {}
646#endif
647extern void iwl4965_handle_data_packet_monitor(struct iwl4965_priv *priv, 644extern void iwl4965_handle_data_packet_monitor(struct iwl4965_priv *priv,
648 struct iwl4965_rx_mem_buffer *rxb, 645 struct iwl4965_rx_mem_buffer *rxb,
649 void *data, short len, 646 void *data, short len,
@@ -743,14 +740,12 @@ extern u8 iwl4965_hw_find_station(struct iwl4965_priv *priv, const u8 *bssid);
743 740
744extern int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel); 741extern int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel);
745extern int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index); 742extern int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index);
746 743extern int iwl4965_queue_space(const struct iwl4965_queue *q);
747struct iwl4965_priv; 744struct iwl4965_priv;
748 745
749/* 746/*
750 * Forward declare iwl-4965.c functions for iwl-base.c 747 * Forward declare iwl-4965.c functions for iwl-base.c
751 */ 748 */
752extern int iwl4965_eeprom_acquire_semaphore(struct iwl4965_priv *priv);
753
754extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv, 749extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv,
755 struct iwl4965_tx_queue *txq, 750 struct iwl4965_tx_queue *txq,
756 u16 byte_cnt); 751 u16 byte_cnt);
@@ -762,31 +757,32 @@ extern void iwl4965_update_rate_scaling(struct iwl4965_priv *priv, u8 mode);
762extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv); 757extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv);
763extern void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags, 758extern void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags,
764 u8 force); 759 u8 force);
765extern int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode, 760extern int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv,
761 enum ieee80211_band band,
766 u16 channel, 762 u16 channel,
767 const struct iwl4965_eeprom_channel *eeprom_ch, 763 const struct iwl4965_eeprom_channel *eeprom_ch,
768 u8 fat_extension_channel); 764 u8 fat_extension_channel);
769extern void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv); 765extern void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv);
766extern void iwl4965_hwrate_to_tx_control(struct iwl4965_priv *priv,
767 u32 rate_n_flags,
768 struct ieee80211_tx_control *control);
770 769
771#ifdef CONFIG_IWL4965_HT 770#ifdef CONFIG_IWL4965_HT
772extern void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info, 771void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info,
773 int mode); 772 enum ieee80211_band band);
774extern void iwl4965_set_rxon_ht(struct iwl4965_priv *priv, 773void iwl4965_set_rxon_ht(struct iwl4965_priv *priv,
775 struct iwl_ht_info *ht_info); 774 struct iwl_ht_info *ht_info);
776extern void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index, 775void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index,
777 struct ieee80211_ht_info *sta_ht_inf); 776 struct ieee80211_ht_info *sta_ht_inf);
778extern int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw, 777int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
779 enum ieee80211_ampdu_mlme_action action, 778 enum ieee80211_ampdu_mlme_action action,
780 const u8 *addr, u16 tid, u16 ssn); 779 const u8 *addr, u16 tid, u16 *ssn);
781#ifdef CONFIG_IWL4965_HT_AGG 780int iwl4965_check_empty_hw_queue(struct iwl4965_priv *priv, int sta_id,
782extern int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da, 781 u8 tid, int txq_id);
783 u16 tid, u16 *start_seq_num); 782#else
784extern int iwl4965_mac_ht_tx_agg_stop(struct ieee80211_hw *hw, u8 *da, 783static inline void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info,
785 u16 tid, int generator); 784 enum ieee80211_band band) {}
786extern void iwl4965_turn_off_agg(struct iwl4965_priv *priv, u8 tid); 785
787extern void iwl4965_tl_get_stats(struct iwl4965_priv *priv,
788 struct ieee80211_hdr *hdr);
789#endif /* CONFIG_IWL4965_HT_AGG */
790#endif /*CONFIG_IWL4965_HT */ 786#endif /*CONFIG_IWL4965_HT */
791/* Structures, enum, and defines specific to the 4965 */ 787/* Structures, enum, and defines specific to the 4965 */
792 788
@@ -798,18 +794,6 @@ struct iwl4965_kw {
798 size_t size; 794 size_t size;
799}; 795};
800 796
801#define TID_QUEUE_CELL_SPACING 50 /*mS */
802#define TID_QUEUE_MAX_SIZE 20
803#define TID_ROUND_VALUE 5 /* mS */
804#define TID_MAX_LOAD_COUNT 8
805
806#define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING)
807#define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y))
808
809#define TID_ALL_ENABLED 0x7f
810#define TID_ALL_SPECIFIED 0xff
811#define TID_AGG_TPT_THREHOLD 0x0
812
813#define IWL_CHANNEL_WIDTH_20MHZ 0 797#define IWL_CHANNEL_WIDTH_20MHZ 0
814#define IWL_CHANNEL_WIDTH_40MHZ 1 798#define IWL_CHANNEL_WIDTH_40MHZ 1
815 799
@@ -823,48 +807,17 @@ struct iwl4965_kw {
823#define IWL_OPERATION_MODE_MIXED 2 807#define IWL_OPERATION_MODE_MIXED 2
824#define IWL_OPERATION_MODE_20MHZ 3 808#define IWL_OPERATION_MODE_20MHZ 3
825 809
826#define IWL_EXT_CHANNEL_OFFSET_AUTO 0 810#define IWL_EXT_CHANNEL_OFFSET_NONE 0
827#define IWL_EXT_CHANNEL_OFFSET_ABOVE 1 811#define IWL_EXT_CHANNEL_OFFSET_ABOVE 1
828#define IWL_EXT_CHANNEL_OFFSET_ 2 812#define IWL_EXT_CHANNEL_OFFSET_RESERVE1 2
829#define IWL_EXT_CHANNEL_OFFSET_BELOW 3 813#define IWL_EXT_CHANNEL_OFFSET_BELOW 3
830#define IWL_EXT_CHANNEL_OFFSET_MAX 4
831 814
832#define NRG_NUM_PREV_STAT_L 20 815#define NRG_NUM_PREV_STAT_L 20
833#define NUM_RX_CHAINS (3) 816#define NUM_RX_CHAINS (3)
834 817
835#define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000 818#define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000
836 819
837struct iwl4965_traffic_load {
838 unsigned long time_stamp;
839 u32 packet_count[TID_QUEUE_MAX_SIZE];
840 u8 queue_count;
841 u8 head;
842 u32 total;
843};
844
845#ifdef CONFIG_IWL4965_HT_AGG
846/**
847 * struct iwl4965_agg_control
848 * @requested_ba: bit map of tids requesting aggregation/block-ack
849 * @granted_ba: bit map of tids granted aggregation/block-ack
850 */
851struct iwl4965_agg_control {
852 unsigned long next_retry;
853 u32 wait_for_agg_status;
854 u32 tid_retry;
855 u32 requested_ba;
856 u32 granted_ba;
857 u8 auto_agg;
858 u32 tid_traffic_load_threshold;
859 u32 ba_timeout;
860 struct iwl4965_traffic_load traffic_load[TID_MAX_LOAD_COUNT];
861};
862#endif /*CONFIG_IWL4965_HT_AGG */
863
864struct iwl4965_lq_mngr { 820struct iwl4965_lq_mngr {
865#ifdef CONFIG_IWL4965_HT_AGG
866 struct iwl4965_agg_control agg_ctrl;
867#endif
868 spinlock_t lock; 821 spinlock_t lock;
869 s32 max_window_size; 822 s32 max_window_size;
870 s32 *expected_tpt; 823 s32 *expected_tpt;
@@ -877,7 +830,6 @@ struct iwl4965_lq_mngr {
877 u8 lq_ready; 830 u8 lq_ready;
878}; 831};
879 832
880
881/* Sensitivity and chain noise calibration */ 833/* Sensitivity and chain noise calibration */
882#define INTERFERENCE_DATA_AVAILABLE __constant_cpu_to_le32(1) 834#define INTERFERENCE_DATA_AVAILABLE __constant_cpu_to_le32(1)
883#define INITIALIZATION_VALUE 0xFFFF 835#define INITIALIZATION_VALUE 0xFFFF
@@ -1020,19 +972,20 @@ struct iwl4965_priv {
1020 struct ieee80211_hw *hw; 972 struct ieee80211_hw *hw;
1021 struct ieee80211_channel *ieee_channels; 973 struct ieee80211_channel *ieee_channels;
1022 struct ieee80211_rate *ieee_rates; 974 struct ieee80211_rate *ieee_rates;
975 struct iwl_cfg *cfg;
1023 976
1024 /* temporary frame storage list */ 977 /* temporary frame storage list */
1025 struct list_head free_frames; 978 struct list_head free_frames;
1026 int frames_count; 979 int frames_count;
1027 980
1028 u8 phymode; 981 enum ieee80211_band band;
1029 int alloc_rxb_skb; 982 int alloc_rxb_skb;
1030 bool add_radiotap; 983 bool add_radiotap;
1031 984
1032 void (*rx_handlers[REPLY_MAX])(struct iwl4965_priv *priv, 985 void (*rx_handlers[REPLY_MAX])(struct iwl4965_priv *priv,
1033 struct iwl4965_rx_mem_buffer *rxb); 986 struct iwl4965_rx_mem_buffer *rxb);
1034 987
1035 const struct ieee80211_hw_mode *modes; 988 struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
1036 989
1037#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT 990#ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
1038 /* spectrum measurement report caching */ 991 /* spectrum measurement report caching */
@@ -1150,7 +1103,6 @@ struct iwl4965_priv {
1150 u32 scd_base_addr; /* scheduler sram base address */ 1103 u32 scd_base_addr; /* scheduler sram base address */
1151 1104
1152 unsigned long status; 1105 unsigned long status;
1153 u32 config;
1154 1106
1155 int last_rx_rssi; /* From Rx packet statisitics */ 1107 int last_rx_rssi; /* From Rx packet statisitics */
1156 int last_rx_noise; /* From beacon statistics */ 1108 int last_rx_noise; /* From beacon statistics */
@@ -1180,7 +1132,6 @@ struct iwl4965_priv {
1180 int is_open; 1132 int is_open;
1181 1133
1182 u8 mac80211_registered; 1134 u8 mac80211_registered;
1183 int is_abg;
1184 1135
1185 u32 notif_missed_beacons; 1136 u32 notif_missed_beacons;
1186 1137
@@ -1216,9 +1167,7 @@ struct iwl4965_priv {
1216 u16 assoc_capability; 1167 u16 assoc_capability;
1217 u8 ps_mode; 1168 u8 ps_mode;
1218 1169
1219#ifdef CONFIG_IWL4965_QOS
1220 struct iwl4965_qos_info qos_data; 1170 struct iwl4965_qos_info qos_data;
1221#endif /*CONFIG_IWL4965_QOS */
1222 1171
1223 struct workqueue_struct *workqueue; 1172 struct workqueue_struct *workqueue;
1224 1173
@@ -1265,11 +1214,7 @@ struct iwl4965_priv {
1265#endif 1214#endif
1266 struct work_struct statistics_work; 1215 struct work_struct statistics_work;
1267 struct timer_list statistics_periodic; 1216 struct timer_list statistics_periodic;
1268 1217}; /*iwl4965_priv */
1269#ifdef CONFIG_IWL4965_HT_AGG
1270 struct work_struct agg_work;
1271#endif
1272}; /*iwl4965_priv */
1273 1218
1274static inline int iwl4965_is_associated(struct iwl4965_priv *priv) 1219static inline int iwl4965_is_associated(struct iwl4965_priv *priv)
1275{ 1220{
@@ -1295,13 +1240,12 @@ static inline int is_channel_radar(const struct iwl4965_channel_info *ch_info)
1295 1240
1296static inline u8 is_channel_a_band(const struct iwl4965_channel_info *ch_info) 1241static inline u8 is_channel_a_band(const struct iwl4965_channel_info *ch_info)
1297{ 1242{
1298 return ch_info->phymode == MODE_IEEE80211A; 1243 return ch_info->band == IEEE80211_BAND_5GHZ;
1299} 1244}
1300 1245
1301static inline u8 is_channel_bg_band(const struct iwl4965_channel_info *ch_info) 1246static inline u8 is_channel_bg_band(const struct iwl4965_channel_info *ch_info)
1302{ 1247{
1303 return ((ch_info->phymode == MODE_IEEE80211B) || 1248 return ch_info->band == IEEE80211_BAND_2GHZ;
1304 (ch_info->phymode == MODE_IEEE80211G));
1305} 1249}
1306 1250
1307static inline int is_channel_passive(const struct iwl4965_channel_info *ch) 1251static inline int is_channel_passive(const struct iwl4965_channel_info *ch)
@@ -1315,7 +1259,7 @@ static inline int is_channel_ibss(const struct iwl4965_channel_info *ch)
1315} 1259}
1316 1260
1317extern const struct iwl4965_channel_info *iwl4965_get_channel_info( 1261extern const struct iwl4965_channel_info *iwl4965_get_channel_info(
1318 const struct iwl4965_priv *priv, int phymode, u16 channel); 1262 const struct iwl4965_priv *priv, enum ieee80211_band band, u16 channel);
1319 1263
1320/* Requires full declaration of iwl4965_priv before including */ 1264/* Requires full declaration of iwl4965_priv before including */
1321#include "iwl-4965-io.h" 1265#include "iwl-4965-io.h"