iwlagn: fix minimum number of queues setting
[safe/jmp/linux-2.6] / drivers / net / wireless / iwlwifi / iwl-dev.h
index a092401..b989d5c 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- * Copyright(c) 2003 - 2008 Intel Corporation. All rights reserved.
+ * Copyright(c) 2003 - 2009 Intel Corporation. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms of version 2 of the GNU General Public License as
@@ -41,7 +41,6 @@
 #include "iwl-prph.h"
 #include "iwl-fh.h"
 #include "iwl-debug.h"
-#include "iwl-rfkill.h"
 #include "iwl-4965-hw.h"
 #include "iwl-3945-hw.h"
 #include "iwl-3945-led.h"
@@ -57,6 +56,28 @@ extern struct iwl_cfg iwl5350_agn_cfg;
 extern struct iwl_cfg iwl5100_bg_cfg;
 extern struct iwl_cfg iwl5100_abg_cfg;
 extern struct iwl_cfg iwl5150_agn_cfg;
+extern struct iwl_cfg iwl6000_2ag_cfg;
+extern struct iwl_cfg iwl6000_2agn_cfg;
+extern struct iwl_cfg iwl6000_3agn_cfg;
+extern struct iwl_cfg iwl6050_2agn_cfg;
+extern struct iwl_cfg iwl6050_3agn_cfg;
+extern struct iwl_cfg iwl1000_bgn_cfg;
+
+/* shared structures from iwl-5000.c */
+extern struct iwl_mod_params iwl50_mod_params;
+extern struct iwl_ops iwl5000_ops;
+extern struct iwl_lib_ops iwl5000_lib;
+extern struct iwl_hcmd_ops iwl5000_hcmd;
+extern struct iwl_hcmd_utils_ops iwl5000_hcmd_utils;
+
+/* shared functions from iwl-5000.c */
+extern u16 iwl5000_get_hcmd_size(u8 cmd_id, u16 len);
+extern u16 iwl5000_build_addsta_hcmd(const struct iwl_addsta_cmd *cmd,
+                                    u8 *data);
+extern void iwl5000_rts_tx_cmd_flag(struct ieee80211_tx_info *info,
+                                   __le32 *tx_flags);
+extern int iwl5000_calc_rssi(struct iwl_priv *priv,
+                            struct iwl_rx_phy_res *rx_resp);
 
 /* CT-KILL constants */
 #define CT_KILL_THRESHOLD      110 /* in Celsius */
@@ -139,8 +160,7 @@ struct iwl_tx_info {
 
 struct iwl_tx_queue {
        struct iwl_queue q;
-       struct iwl_tfd *tfds;
-       struct iwl3945_tfd *tfds39;
+       void *tfds;
        struct iwl_cmd *cmd[TFD_TX_CMD_SLOTS];
        struct iwl_tx_info *txb;
        u8 need_update;
@@ -238,8 +258,10 @@ struct iwl_channel_info {
 #define IWL_TX_FIFO_HCCA_2     6
 #define IWL_TX_FIFO_NONE       7
 
-/* Minimum number of queues. MAX_NUM is defined in hw specific files */
-#define IWL_MIN_NUM_QUEUES     4
+/* Minimum number of queues. MAX_NUM is defined in hw specific files.
+ * Set the minimum to accommodate the 4 standard TX queues, 1 command
+ * queue, 2 (unused) HCCA queues, and 4 HT queues (one for each AC) */
+#define IWL_MIN_NUM_QUEUES     10
 
 /* Power management (not Tx power) structures */
 
@@ -268,11 +290,11 @@ struct iwl_frame {
 #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
 
 enum {
-       /* CMD_SIZE_NORMAL = 0, */
+       CMD_SYNC = 0,
+       CMD_SIZE_NORMAL = 0,
+       CMD_NO_SKB = 0,
        CMD_SIZE_HUGE = (1 << 0),
-       /* CMD_SYNC = 0, */
        CMD_ASYNC = (1 << 1),
-       /* CMD_NO_SKB = 0, */
        CMD_WANT_SKB = (1 << 2),
 };
 
@@ -339,12 +361,16 @@ struct iwl_host_cmd {
 
 /**
  * struct iwl_rx_queue - Rx queue
+ * @bd: driver's pointer to buffer of receive buffer descriptors (rbd)
+ * @dma_addr: bus address of buffer of receive buffer descriptors (rbd)
  * @read: Shared index to newest available Rx buffer
  * @write: Shared index to oldest written Rx packet
  * @free_count: Number of pre-allocated buffers in rx_free
  * @rx_free: list of free SKBs for use
  * @rx_used: List of Rx buffers with no SKB
  * @need_update: flag to indicate we need to update read/write index
+ * @rb_stts: driver's pointer to receive buffer status
+ * @rb_stts_dma: bus address of receive buffer status
  *
  * NOTE:  rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
  */
@@ -356,6 +382,7 @@ struct iwl_rx_queue {
        u32 read;
        u32 write;
        u32 free_count;
+       u32 write_actual;
        struct list_head rx_free;
        struct list_head rx_used;
        int need_update;
@@ -473,22 +500,13 @@ struct iwl_qos_info {
 #define STA_PS_STATUS_WAKE             0
 #define STA_PS_STATUS_SLEEP            1
 
-struct iwl3945_tid_data {
-       u16 seq_number;
-};
-
-struct iwl3945_hw_key {
-       enum ieee80211_key_alg alg;
-       int keylen;
-       u8 key[32];
-};
 
 struct iwl3945_station_entry {
        struct iwl3945_addsta_cmd sta;
-       struct iwl3945_tid_data tid[MAX_TID_COUNT];
+       struct iwl_tid_data tid[MAX_TID_COUNT];
        u8 used;
        u8 ps_status;
-       struct iwl3945_hw_key keyinfo;
+       struct iwl_hw_key keyinfo;
 };
 
 struct iwl_station_entry {
@@ -558,11 +576,13 @@ struct iwl_sensitivity_ranges {
  * @max_txq_num: Max # Tx queues supported
  * @dma_chnl_num: Number of Tx DMA/FIFO channels
  * @scd_bc_tbls_size: size of scheduler byte count tables
+ * @tfd_size: TFD size
  * @tx/rx_chains_num: Number of TX/RX chains
  * @valid_tx/rx_ant: usable antennas
  * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
  * @max_rxq_log: Log-base-2 of max_rxq_size
  * @rx_buf_size: Rx buffer size
+ * @rx_wrt_ptr_reg: FH{39}_RSCSR_CHNL0_WPTR
  * @max_stations:
  * @bcast_sta_id:
  * @fat_channel: is 40MHz width possible in band 2.4
@@ -577,6 +597,7 @@ struct iwl_hw_params {
        u8 max_txq_num;
        u8 dma_chnl_num;
        u16 scd_bc_tbls_size;
+       u32 tfd_size;
        u8  tx_chains_num;
        u8  rx_chains_num;
        u8  valid_tx_ant;
@@ -584,11 +605,12 @@ struct iwl_hw_params {
        u16 max_rxq_size;
        u16 max_rxq_log;
        u32 rx_buf_size;
+       u32 rx_wrt_ptr_reg;
        u32 max_pkt_size;
        u8  max_stations;
        u8  bcast_sta_id;
        u8 fat_channel;
-       u8 sw_crypto;
+       u8  max_beacon_itrvl;   /* in 1024 ms */
        u32 max_inst_size;
        u32 max_data_size;
        u32 max_bsm_size;
@@ -793,6 +815,26 @@ enum {
        MEASUREMENT_ACTIVE = (1 << 1),
 };
 
+enum iwl_nvm_type {
+       NVM_DEVICE_TYPE_EEPROM = 0,
+       NVM_DEVICE_TYPE_OTP,
+};
+
+/* interrupt statistics */
+struct isr_statistics {
+       u32 hw;
+       u32 sw;
+       u32 sw_err;
+       u32 sch;
+       u32 alive;
+       u32 rfkill;
+       u32 ctkill;
+       u32 wakeup;
+       u32 rx;
+       u32 rx_handlers[REPLY_MAX];
+       u32 tx;
+       u32 unhandled;
+};
 
 #define IWL_MAX_NUM_QUEUES     20 /* FIXME: do dynamic allocation */
 
@@ -816,7 +858,7 @@ struct iwl_priv {
 
        struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
 
-#if defined(CONFIG_IWLAGN_SPECTRUM_MEASUREMENT) || defined(CONFIG_IWL3945_SPECTRUM_MEASUREMENT)
+#if defined(CONFIG_IWLWIFI_SPECTRUM_MEASUREMENT) || defined(CONFIG_IWL3945_SPECTRUM_MEASUREMENT)
        /* spectrum measurement report caching */
        struct iwl_spectrum_notification measure_report;
        u8 measurement_status;
@@ -846,17 +888,16 @@ struct iwl_priv {
        unsigned long scan_start;
        unsigned long scan_pass_start;
        unsigned long scan_start_tsf;
-       struct iwl_scan_cmd *scan;
+       void *scan;
        int scan_bands;
-       int one_direct_scan;
-       u8 direct_ssid_len;
-       u8 direct_ssid[IW_ESSID_MAX_SIZE];
+       struct cfg80211_scan_request *scan_request;
        u8 scan_tx_ant[IEEE80211_NUM_BANDS];
        u8 mgmt_tx_ant;
 
        /* spinlock */
        spinlock_t lock;        /* protect general shared data */
        spinlock_t hcmd_lock;   /* protect hcmd */
+       spinlock_t reg_lock;    /* protect hw register access */
        struct mutex mutex;
 
        /* basic pci-network driver stuff */
@@ -890,30 +931,19 @@ struct iwl_priv {
        const struct iwl_rxon_cmd active_rxon;
        struct iwl_rxon_cmd staging_rxon;
 
-       int error_recovering;
        struct iwl_rxon_cmd recovery_rxon;
 
        /* 1st responses from initialize and runtime uCode images.
         * 4965's initialize alive response contains some calibration data. */
        struct iwl_init_alive_resp card_alive_init;
        struct iwl_alive_resp card_alive;
-#if defined(CONFIG_IWLWIFI_RFKILL) || defined(CONFIG_IWL3945_RFKILL)
-       struct rfkill *rfkill;
-#endif
 
-#if defined(CONFIG_IWLWIFI_LEDS) || defined(CONFIG_IWL3945_LEDS)
+#ifdef CONFIG_IWLWIFI_LEDS
        unsigned long last_blink_time;
        u8 last_blink_rate;
        u8 allow_blinking;
        u64 led_tpt;
-#endif
-
-#ifdef CONFIG_IWLWIFI_LEDS
        struct iwl_led led[IWL_LED_TRG_MAX];
-#endif
-
-#ifdef CONFIG_IWL3945_LEDS
-       struct iwl3945_led led39[IWL_LED_TRG_MAX];
        unsigned int rxtxpackets;
 #endif
        u16 active_rate;
@@ -956,6 +986,9 @@ struct iwl_priv {
                u64 bytes;
        } tx_stats[3], rx_stats[3];
 
+       /* counts interrupts */
+       struct isr_statistics isr_stats;
+
        struct iwl_power_mgr power_data;
 
        struct iwl_notif_statistics statistics;
@@ -965,7 +998,6 @@ struct iwl_priv {
        u16 rates_mask;
 
        u32 power_mode;
-       u32 antenna;
        u8 bssid[ETH_ALEN];
        u16 rts_threshold;
        u8 mac_addr[ETH_ALEN];
@@ -979,6 +1011,12 @@ struct iwl_priv {
        u8 key_mapping_key;
        unsigned long ucode_key_table;
 
+       /* queue refcounts */
+#define IWL_MAX_HW_QUEUES      32
+       unsigned long queue_stopped[BITS_TO_LONGS(IWL_MAX_HW_QUEUES)];
+       /* for each AC */
+       atomic_t queue_stop_count[4];
+
        /* Indication if ieee80211_ops->open has been called */
        u8 is_open;
 
@@ -990,6 +1028,7 @@ struct iwl_priv {
 
        /* eeprom */
        u8 *eeprom;
+       int    nvm_device_type;
        struct iwl_eeprom_calib_info *calib_info;
 
        enum nl80211_iftype iw_mode;
@@ -1007,7 +1046,16 @@ struct iwl_priv {
        /*End*/
        struct iwl_hw_params hw_params;
 
+       /* INT ICT Table */
+       u32 *ict_tbl;
+       dma_addr_t ict_tbl_dma;
+       dma_addr_t aligned_ict_tbl_dma;
+       int ict_index;
+       void *ict_tbl_vir;
+       u32 inta;
+       bool use_ict;
 
+       u32 inta_mask;
        /* Current association information needed to configure the
         * hardware */
        u16 assoc_id;
@@ -1022,7 +1070,6 @@ struct iwl_priv {
        struct work_struct calibrated_work;
        struct work_struct scan_completed;
        struct work_struct rx_replenish;
-       struct work_struct rf_kill;
        struct work_struct abort_scan;
        struct work_struct update_link_led;
        struct work_struct auth_work;
@@ -1032,20 +1079,20 @@ struct iwl_priv {
 
        struct tasklet_struct irq_tasklet;
 
-       struct delayed_work set_power_save;
        struct delayed_work init_alive_start;
        struct delayed_work alive_start;
        struct delayed_work scan_check;
 
        /*For 3945 only*/
        struct delayed_work thermal_periodic;
+       struct delayed_work rfkill_poll;
 
        /* TX Power */
        s8 tx_power_user_lmt;
        s8 tx_power_channel_lmt;
 
 
-#if defined(CONFIG_IWLWIFI_DEBUG) || defined(CONFIG_IWL3945_DEBUG)
+#ifdef CONFIG_IWLWIFI_DEBUG
        /* debugging info */
        u32 debug_level;
        u32 framecnt_to_us;
@@ -1062,33 +1109,13 @@ struct iwl_priv {
        u32 disable_tx_power_cal;
        struct work_struct run_time_calib_work;
        struct timer_list statistics_periodic;
-
+       bool hw_ready;
        /*For 3945*/
 #define IWL_DEFAULT_TX_POWER 0x0F
-       s8 user_txpower_limit;
-       s8 max_channel_txpower_limit;
-
-       struct iwl3945_scan_cmd *scan39;
-
-       /* We declare this const so it can only be
-        * changed via explicit cast within the
-        * routines that actually update the physical
-        * hardware */
-       const struct iwl3945_rxon_cmd active39_rxon;
-       struct iwl3945_rxon_cmd staging39_rxon;
-       struct iwl3945_rxon_cmd recovery39_rxon;
 
-       struct iwl3945_power_mgr power_data_39;
        struct iwl3945_notif_statistics statistics_39;
 
-       struct iwl3945_station_entry stations_39[IWL_STATION_COUNT];
-
-       /* eeprom */
-       struct iwl3945_eeprom eeprom39;
-
        u32 sta_supp_rates;
-       u8 call_post_assoc_from_beacon;
-
 }; /*iwl_priv */
 
 static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id)