mac80211: dont use interface indices in drivers
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-4965.h
index 5944b4b9828bfd30dddca990ffd608ea79f06066..aad7f70bab76ba4a3b44f0cd2a10b60c29e67804 100644 (file)
  * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  *
  *****************************************************************************/
+/*
+ * Please use this file (iwl-4965.h) for driver implementation definitions.
+ * Please use iwl-4965-commands.h for uCode API definitions.
+ * Please use iwl-4965-hw.h for hardware-related definitions.
+ */
+
 #ifndef __iwl_4965_h__
 #define __iwl_4965_h__
 
@@ -30,8 +36,6 @@
 #include <linux/kernel.h>
 #include <net/ieee80211_radiotap.h>
 
-struct iwl4965_priv;
-
 /* Hardware specific file defines the PCI IDs table for that hardware module */
 extern struct pci_device_id iwl4965_hw_card_ids[];
 
@@ -56,6 +60,7 @@ extern struct pci_device_id iwl4965_hw_card_ids[];
 /* Module parameters accessible from iwl-*.c */
 extern int iwl4965_param_hwcrypto;
 extern int iwl4965_param_queues_num;
+extern int iwl4965_param_amsdu_size_8K;
 
 enum iwl4965_antenna {
        IWL_ANTENNA_DIVERSITY,
@@ -86,29 +91,6 @@ struct iwl4965_rx_mem_buffer {
        struct list_head list;
 };
 
-struct iwl4965_rt_rx_hdr {
-       struct ieee80211_radiotap_header rt_hdr;
-       __le64 rt_tsf;          /* TSF */
-       u8 rt_flags;            /* radiotap packet flags */
-       u8 rt_rate;             /* rate in 500kb/s */
-       __le16 rt_channelMHz;   /* channel in MHz */
-       __le16 rt_chbitmask;    /* channel bitfield */
-       s8 rt_dbmsignal;        /* signal in dBm, kluged to signed */
-       s8 rt_dbmnoise;
-       u8 rt_antenna;          /* antenna number */
-       u8 payload[0];          /* payload... */
-} __attribute__ ((packed));
-
-struct iwl4965_rt_tx_hdr {
-       struct ieee80211_radiotap_header rt_hdr;
-       u8 rt_rate;             /* rate in 500kb/s */
-       __le16 rt_channel;      /* channel in mHz */
-       __le16 rt_chbitmask;    /* channel bitfield */
-       s8 rt_dbmsignal;        /* signal in dBm, kluged to signed */
-       u8 rt_antenna;          /* antenna number */
-       u8 payload[0];          /* payload... */
-} __attribute__ ((packed));
-
 /*
  * Generic queue structure
  *
@@ -129,6 +111,7 @@ struct iwl4965_queue {
 
 #define MAX_NUM_OF_TBS          (20)
 
+/* One for each TFD */
 struct iwl4965_tx_info {
        struct ieee80211_tx_status status;
        struct sk_buff *skb[MAX_NUM_OF_TBS];
@@ -136,10 +119,16 @@ struct iwl4965_tx_info {
 
 /**
  * struct iwl4965_tx_queue - Tx Queue for DMA
- * @need_update: need to update read/write index
- * @shed_retry: queue is HT AGG enabled
+ * @q: generic Rx/Tx queue descriptor
+ * @bd: base of circular buffer of TFDs
+ * @cmd: array of command/Tx buffers
+ * @dma_addr_cmd: physical address of cmd/tx buffer array
+ * @txb: array of per-TFD driver data
+ * @need_update: indicates need to update read/write index
+ * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled
  *
- * Queue consists of circular buffer of BD's and required locking structures.
+ * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
+ * descriptors) and required locking structures.
  */
 struct iwl4965_tx_queue {
        struct iwl4965_queue q;
@@ -185,14 +174,15 @@ struct iwl4965_scan_power_info {
        s8 requested_power;     /* scan pwr (dBm) requested for chnl/rate */
 };
 
-/* Channel unlock period is 15 seconds. If no beacon or probe response
- * has been received within 15 seconds on a locked channel then the channel
- * remains locked. */
-#define TX_UNLOCK_PERIOD 15
+/* For fat_extension_channel */
+enum {
+       HT_IE_EXT_CHANNEL_NONE = 0,
+       HT_IE_EXT_CHANNEL_ABOVE,
+       HT_IE_EXT_CHANNEL_INVALID,
+       HT_IE_EXT_CHANNEL_BELOW,
+       HT_IE_EXT_CHANNEL_MAX
+};
 
-/* CSA lock period is 15 seconds.  If a CSA has been received on a channel in
- * the last 15 seconds, the channel is locked */
-#define CSA_LOCK_PERIOD 15
 /*
  * One for each channel, holds all channel setup data
  * Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant
@@ -203,14 +193,14 @@ struct iwl4965_scan_power_info {
 struct iwl4965_channel_info {
        struct iwl4965_channel_tgd_info tgd;
        struct iwl4965_channel_tgh_info tgh;
-       struct iwl4965_eeprom_channel eeprom;   /* EEPROM regulatory limit */
-       struct iwl4965_eeprom_channel fat_eeprom;       /* EEPROM regulatory limit for
-                                                * FAT channel */
+       struct iwl4965_eeprom_channel eeprom;     /* EEPROM regulatory limit */
+       struct iwl4965_eeprom_channel fat_eeprom; /* EEPROM regulatory limit for
+                                                  * FAT channel */
 
        u8 channel;       /* channel number */
        u8 flags;         /* flags copied from EEPROM */
        s8 max_power_avg; /* (dBm) regul. eeprom, normal Tx, any rate */
-       s8 curr_txpow;    /* (dBm) regulatory/spectrum/user (not h/w) */
+       s8 curr_txpow;    /* (dBm) regulatory/spectrum/user (not h/w) limit */
        s8 min_power;     /* always 0 */
        s8 scan_power;    /* (dBm) regul. eeprom, direct scans, any rate */
 
@@ -229,7 +219,7 @@ struct iwl4965_channel_info {
        s8 fat_min_power;       /* always 0 */
        s8 fat_scan_power;      /* (dBm) eeprom, direct scans, any rate */
        u8 fat_flags;           /* flags copied from EEPROM */
-       u8 fat_extension_channel;
+       u8 fat_extension_channel; /* HT_IE_EXT_CHANNEL_* */
 
        /* Radio/DSP gain settings for each scan rate, for directed scans. */
        struct iwl4965_scan_power_info scan_pwr_info[IWL_NUM_SCAN_RATES];
@@ -332,9 +322,16 @@ struct iwl4965_cmd_meta {
 
 } __attribute__ ((packed));
 
+/**
+ * struct iwl4965_cmd
+ *
+ * For allocation of the command and tx queues, this establishes the overall
+ * size of the largest command we send to uCode, except for a scan command
+ * (which is relatively huge; space is allocated separately).
+ */
 struct iwl4965_cmd {
-       struct iwl4965_cmd_meta meta;
-       struct iwl4965_cmd_header hdr;
+       struct iwl4965_cmd_meta meta;   /* driver data */
+       struct iwl4965_cmd_header hdr;  /* uCode API */
        union {
                struct iwl4965_addsta_cmd addsta;
                struct iwl4965_led_cmd led;
@@ -428,6 +425,7 @@ struct iwl4965_rx_queue {
 #define STATUS_SCAN_HW         14
 #define STATUS_POWER_PMI       15
 #define STATUS_FW_ERROR                16
+#define STATUS_CONF_PENDING    17
 
 #define MAX_TID_COUNT        9
 
@@ -436,6 +434,20 @@ struct iwl4965_rx_queue {
 
 #ifdef CONFIG_IWL4965_HT
 #ifdef CONFIG_IWL4965_HT_AGG
+/**
+ * struct iwl4965_ht_agg -- aggregation status while waiting for block-ack
+ * @txq_id: Tx queue used for Tx attempt
+ * @frame_count: # frames attempted by Tx command
+ * @wait_for_ba: Expect block-ack before next Tx reply
+ * @start_idx: Index of 1st Transmit Frame Descriptor (TFD) in Tx window
+ * @bitmap0: Low order bitmap, one bit for each frame pending ACK in Tx window
+ * @bitmap1: High order, one bit for each frame pending ACK in Tx window
+ * @rate_n_flags: Rate at which Tx was attempted
+ *
+ * If REPLY_TX indicates that aggregation was attempted, driver must wait
+ * for block ack (REPLY_COMPRESSED_BA).  This struct stores tx reply info
+ * until block ack arrives.
+ */
 struct iwl4965_ht_agg {
        u16 txq_id;
        u16 frame_count;
@@ -473,26 +485,26 @@ union iwl4965_ht_rate_supp {
 
 #ifdef CONFIG_IWL4965_HT
 #define CFG_HT_RX_AMPDU_FACTOR_DEF  (0x3)
-#define HT_IE_MAX_AMSDU_SIZE_4K     (0)
 #define CFG_HT_MPDU_DENSITY_2USEC   (0x5)
 #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC
 
-struct sta_ht_info {
+struct iwl_ht_info {
+       /* self configuration data */
        u8 is_ht;
-       u16 rx_mimo_ps_mode;
+       u8 supported_chan_width;
        u16 tx_mimo_ps_mode;
-       u16 control_channel;
+       u8 is_green_field;
+       u8 sgf;                 /* HT_SHORT_GI_* short guard interval */
        u8 max_amsdu_size;
        u8 ampdu_factor;
        u8 mpdu_density;
-       u8 operating_mode;
-       u8 supported_chan_width;
+       u8 supp_mcs_set[16];
+       /* BSS related data */
+       u8 control_channel;
        u8 extension_chan_offset;
-       u8 is_green_field;
-       u8 sgf;
-       u8 supp_rates[16];
        u8 tx_chan_width;
-       u8 chan_width_cap;
+       u8 ht_protection;
+       u8 non_GF_STA_present;
 };
 #endif                         /*CONFIG_IWL4965_HT */
 
@@ -566,12 +578,26 @@ struct iwl4965_ibss_seq {
        struct list_head list;
 };
 
+/**
+ * struct iwl4965_driver_hw_info
+ * @max_txq_num: Max # Tx queues supported
+ * @ac_queue_count: # Tx queues for EDCA Access Categories (AC)
+ * @tx_cmd_len: Size of Tx command (but not including frame itself)
+ * @max_rxq_size: Max # Rx frames in Rx queue (must be power-of-2)
+ * @rx_buffer_size:
+ * @max_rxq_log: Log-base-2 of max_rxq_size
+ * @max_stations:
+ * @bcast_sta_id:
+ * @shared_virt: Pointer to driver/uCode shared Tx Byte Counts and Rx status
+ * @shared_phys: Physical Pointer to Tx Byte Counts and Rx status
+ */
 struct iwl4965_driver_hw_info {
        u16 max_txq_num;
        u16 ac_queue_count;
        u16 tx_cmd_len;
        u16 max_rxq_size;
-       u32 rx_buffer_size;
+       u32 rx_buf_size;
+       u32 max_pkt_size;
        u16 max_rxq_log;
        u8  max_stations;
        u8  bcast_sta_id;
@@ -579,15 +605,6 @@ struct iwl4965_driver_hw_info {
        dma_addr_t shared_phys;
 };
 
-
-#define STA_FLG_RTS_MIMO_PROT_MSK      __constant_cpu_to_le32(1 << 17)
-#define STA_FLG_AGG_MPDU_8US_MSK       __constant_cpu_to_le32(1 << 18)
-#define STA_FLG_MAX_AGG_SIZE_POS       (19)
-#define STA_FLG_MAX_AGG_SIZE_MSK       __constant_cpu_to_le32(3 << 19)
-#define STA_FLG_FAT_EN_MSK             __constant_cpu_to_le32(1 << 21)
-#define STA_FLG_MIMO_DIS_MSK           __constant_cpu_to_le32(1 << 22)
-#define STA_FLG_AGG_MPDU_DENSITY_POS   (23)
-#define STA_FLG_AGG_MPDU_DENSITY_MSK   __constant_cpu_to_le32(7 << 23)
 #define HT_SHORT_GI_20MHZ_ONLY          (1 << 0)
 #define HT_SHORT_GI_40MHZ_ONLY          (1 << 1)
 
@@ -611,8 +628,8 @@ struct iwl4965_driver_hw_info {
 struct iwl4965_addsta_cmd;
 extern int iwl4965_send_add_station(struct iwl4965_priv *priv,
                                struct iwl4965_addsta_cmd *sta, u8 flags);
-extern u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *bssid,
-                         int is_ap, u8 flags);
+extern u8 iwl4965_add_station_flags(struct iwl4965_priv *priv, const u8 *addr,
+                         int is_ap, u8 flags, void *ht_data);
 extern int iwl4965_is_network_packet(struct iwl4965_priv *priv,
                                 struct ieee80211_hdr *header);
 extern int iwl4965_power_init_handle(struct iwl4965_priv *priv);
@@ -728,7 +745,6 @@ extern int iwl4965_hw_channel_switch(struct iwl4965_priv *priv, u16 channel);
 extern int iwl4965_tx_queue_reclaim(struct iwl4965_priv *priv, int txq_id, int index);
 
 struct iwl4965_priv;
-struct sta_ht_info;
 
 /*
  * Forward declare iwl-4965.c functions for iwl-base.c
@@ -741,9 +757,6 @@ extern int iwl4965_tx_queue_update_wr_ptr(struct iwl4965_priv *priv,
                                          u16 byte_cnt);
 extern void iwl4965_add_station(struct iwl4965_priv *priv, const u8 *addr,
                                int is_ap);
-extern void iwl4965_set_rxon_ht(struct iwl4965_priv *priv,
-                               struct sta_ht_info *ht_info);
-
 extern void iwl4965_set_rxon_chain(struct iwl4965_priv *priv);
 extern int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd,
                          u8 sta_id, dma_addr_t txcmd_phys,
@@ -751,8 +764,6 @@ extern int iwl4965_tx_cmd(struct iwl4965_priv *priv, struct iwl4965_cmd *out_cmd
                          struct ieee80211_tx_control *ctrl, void *sta_in);
 extern int iwl4965_alive_notify(struct iwl4965_priv *priv);
 extern void iwl4965_update_rate_scaling(struct iwl4965_priv *priv, u8 mode);
-extern void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index);
-
 extern void iwl4965_chain_noise_reset(struct iwl4965_priv *priv);
 extern void iwl4965_init_sensitivity(struct iwl4965_priv *priv, u8 flags,
                                     u8 force);
@@ -763,6 +774,12 @@ extern int iwl4965_set_fat_chan_info(struct iwl4965_priv *priv, int phymode,
 extern void iwl4965_rf_kill_ct_config(struct iwl4965_priv *priv);
 
 #ifdef CONFIG_IWL4965_HT
+extern void iwl4965_init_ht_hw_capab(struct ieee80211_ht_info *ht_info,
+                                       int mode);
+extern void iwl4965_set_rxon_ht(struct iwl4965_priv *priv,
+                               struct iwl_ht_info *ht_info);
+extern void iwl4965_set_ht_add_station(struct iwl4965_priv *priv, u8 index,
+                               struct ieee80211_ht_info *sta_ht_inf);
 #ifdef CONFIG_IWL4965_HT_AGG
 extern int iwl4965_mac_ht_tx_agg_start(struct ieee80211_hw *hw, u8 *da,
                                   u16 tid, u16 *start_seq_num);
@@ -819,19 +836,7 @@ struct iwl4965_kw {
 #define NRG_NUM_PREV_STAT_L     20
 #define NUM_RX_CHAINS           (3)
 
-#define TX_POWER_IWL_ILLEGAL_VDET    -100000
 #define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000
-#define TX_POWER_IWL_CLOSED_LOOP_MIN_POWER 18
-#define TX_POWER_IWL_CLOSED_LOOP_MAX_POWER 34
-#define TX_POWER_IWL_VDET_SLOPE_BELOW_NOMINAL 17
-#define TX_POWER_IWL_VDET_SLOPE_ABOVE_NOMINAL 20
-#define TX_POWER_IWL_NOMINAL_POWER            26
-#define TX_POWER_IWL_CLOSED_LOOP_ITERATION_LIMIT 1
-#define TX_POWER_IWL_VOLTAGE_CODES_PER_03V       7
-#define TX_POWER_IWL_DEGREES_PER_VDET_CODE       11
-#define IWL_TX_POWER_MAX_NUM_PA_MEASUREMENTS 1
-#define IWL_TX_POWER_CCK_COMPENSATION_B_STEP (9)
-#define IWL_TX_POWER_CCK_COMPENSATION_C_STEP (5)
 
 struct iwl4965_traffic_load {
        unsigned long time_stamp;
@@ -842,6 +847,11 @@ struct iwl4965_traffic_load {
 };
 
 #ifdef CONFIG_IWL4965_HT_AGG
+/**
+ * struct iwl4965_agg_control
+ * @requested_ba: bit map of tids requesting aggregation/block-ack
+ * @granted_ba: bit map of tids granted aggregation/block-ack
+ */
 struct iwl4965_agg_control {
        unsigned long next_retry;
        u32 wait_for_agg_status;
@@ -878,22 +888,6 @@ struct iwl4965_lq_mngr {
 #define CAL_NUM_OF_BEACONS             20
 #define MAXIMUM_ALLOWED_PATHLOSS       15
 
-/* Param table within SENSITIVITY_CMD */
-#define HD_MIN_ENERGY_CCK_DET_INDEX                 (0)
-#define HD_MIN_ENERGY_OFDM_DET_INDEX                (1)
-#define HD_AUTO_CORR32_X1_TH_ADD_MIN_INDEX          (2)
-#define HD_AUTO_CORR32_X1_TH_ADD_MIN_MRC_INDEX      (3)
-#define HD_AUTO_CORR40_X4_TH_ADD_MIN_MRC_INDEX      (4)
-#define HD_AUTO_CORR32_X4_TH_ADD_MIN_INDEX          (5)
-#define HD_AUTO_CORR32_X4_TH_ADD_MIN_MRC_INDEX      (6)
-#define HD_BARKER_CORR_TH_ADD_MIN_INDEX             (7)
-#define HD_BARKER_CORR_TH_ADD_MIN_MRC_INDEX         (8)
-#define HD_AUTO_CORR40_X4_TH_ADD_MIN_INDEX          (9)
-#define HD_OFDM_ENERGY_TH_IN_INDEX                  (10)
-
-#define SENSITIVITY_CMD_CONTROL_DEFAULT_TABLE  __constant_cpu_to_le16(0)
-#define SENSITIVITY_CMD_CONTROL_WORK_TABLE     __constant_cpu_to_le16(1)
-
 #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
 
 #define MAX_FA_OFDM  50
@@ -921,8 +915,6 @@ struct iwl4965_lq_mngr {
 #define AUTO_CORR_STEP_CCK     3
 #define AUTO_CORR_MAX_TH_CCK   160
 
-#define NRG_ALG                0
-#define AUTO_CORR_ALG          1
 #define NRG_DIFF               2
 #define NRG_STEP_CCK           2
 #define NRG_MARGIN             8
@@ -1013,29 +1005,8 @@ struct iwl4965_chain_noise_data {
        u8 radio_write;
 };
 
-/* IWL4965 */
-#define RATE_MCS_CODE_MSK 0x7
-#define RATE_MCS_MIMO_POS 3
-#define RATE_MCS_MIMO_MSK 0x8
-#define RATE_MCS_HT_DUP_POS 5
-#define RATE_MCS_HT_DUP_MSK 0x20
-#define RATE_MCS_FLAGS_POS 8
-#define RATE_MCS_HT_POS 8
-#define RATE_MCS_HT_MSK 0x100
-#define RATE_MCS_CCK_POS 9
-#define RATE_MCS_CCK_MSK 0x200
-#define RATE_MCS_GF_POS 10
-#define RATE_MCS_GF_MSK 0x400
-
-#define RATE_MCS_FAT_POS 11
-#define RATE_MCS_FAT_MSK 0x800
-#define RATE_MCS_DUP_POS 12
-#define RATE_MCS_DUP_MSK 0x1000
-#define RATE_MCS_SGI_POS 13
-#define RATE_MCS_SGI_MSK 0x2000
-
-#define        EEPROM_SEM_TIMEOUT 10
-#define EEPROM_SEM_RETRY_LIMIT 1000
+#define        EEPROM_SEM_TIMEOUT 10           /* milliseconds */
+#define EEPROM_SEM_RETRY_LIMIT 1000    /* number of attempts (not time) */
 
 
 #ifdef CONFIG_IWL4965_SPECTRUM_MEASUREMENT
@@ -1060,6 +1031,7 @@ struct iwl4965_priv {
 
        u8 phymode;
        int alloc_rxb_skb;
+       bool add_radiotap;
 
        void (*rx_handlers[REPLY_MAX])(struct iwl4965_priv *priv,
                                       struct iwl4965_rx_mem_buffer *rxb);
@@ -1089,6 +1061,7 @@ struct iwl4965_priv {
 
        /* Scan related variables */
        unsigned long last_scan_jiffies;
+       unsigned long next_scan_jiffies;
        unsigned long scan_start;
        unsigned long scan_pass_start;
        unsigned long scan_start_tsf;
@@ -1149,11 +1122,6 @@ struct iwl4965_priv {
        u8 call_post_assoc_from_beacon;
        u8 assoc_station_added;
        u8 use_ant_b_for_management_frame;      /* Tx antenna selection */
-       /* HT variables */
-       u8 is_dup;
-       u8 is_ht_enabled;
-       u8 channel_width;       /* 0=20MHZ, 1=40MHZ */
-       u8 current_channel_width;
        u8 valid_antenna;       /* Bit mask of antennas actually connected */
 #ifdef CONFIG_IWL4965_SENSITIVITY
        struct iwl4965_sensitivity_data sensitivity_data;
@@ -1163,9 +1131,8 @@ struct iwl4965_priv {
 #endif /*CONFIG_IWL4965_SENSITIVITY*/
 
 #ifdef CONFIG_IWL4965_HT
-       struct sta_ht_info current_assoc_ht;
+       struct iwl_ht_info current_ht_config;
 #endif
-       u8 active_rate_ht[2];
        u8 last_phy_res[100];
 
        /* Rate scaling data */
@@ -1229,6 +1196,8 @@ struct iwl4965_priv {
        u16 last_seq_num;
        u16 last_frag_num;
        unsigned long last_packet_time;
+
+       /* Hash table for finding stations in IBSS network */
        struct list_head ibss_mac_hash[IWL_IBSS_MAC_HASH_SIZE];
 
        /* eeprom */
@@ -1243,7 +1212,7 @@ struct iwl4965_priv {
        u32 timestamp1;
        u16 beacon_int;
        struct iwl4965_driver_hw_info hw_setting;
-       int interface_id;
+       struct ieee80211_vif *vif;
 
        /* Current association information needed to configure the
         * hardware */
This page took 0.045066 seconds and 5 git commands to generate.