iwlwifi-5000: implement initial calibration for 5000
[safe/jmp/linux-2.6] / drivers / net / wireless / iwlwifi / iwl-dev.h
index 78aba21..291c1ec 100644 (file)
@@ -91,7 +91,7 @@ extern struct iwl_cfg iwl5350_agn_cfg;
 #define        DEFAULT_SHORT_RETRY_LIMIT 7U
 #define        DEFAULT_LONG_RETRY_LIMIT  4U
 
-struct iwl4965_rx_mem_buffer {
+struct iwl_rx_mem_buffer {
        dma_addr_t dma_addr;
        struct sk_buff *skb;
        struct list_head list;
@@ -102,7 +102,7 @@ struct iwl4965_rx_mem_buffer {
  *
  * Contains common data for Rx and Tx queues
  */
-struct iwl4965_queue {
+struct iwl_queue {
        int n_bd;              /* number of BDs in this queue */
        int write_ptr;       /* 1-st empty entry (index) host_w*/
        int read_ptr;         /* last used entry (index) host_r*/
@@ -118,13 +118,12 @@ struct iwl4965_queue {
 #define MAX_NUM_OF_TBS          (20)
 
 /* One for each TFD */
-struct iwl4965_tx_info {
-       struct ieee80211_tx_status status;
+struct iwl_tx_info {
        struct sk_buff *skb[MAX_NUM_OF_TBS];
 };
 
 /**
- * struct iwl4965_tx_queue - Tx Queue for DMA
+ * struct iwl_tx_queue - Tx Queue for DMA
  * @q: generic Rx/Tx queue descriptor
  * @bd: base of circular buffer of TFDs
  * @cmd: array of command/Tx buffers
@@ -136,12 +135,12 @@ struct iwl4965_tx_info {
  * 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;
-       struct iwl4965_tfd_frame *bd;
+struct iwl_tx_queue {
+       struct iwl_queue q;
+       struct iwl_tfd_frame *bd;
        struct iwl_cmd *cmd;
        dma_addr_t dma_addr_cmd;
-       struct iwl4965_tx_info *txb;
+       struct iwl_tx_info *txb;
        int need_update;
        int sched_retry;
        int active;
@@ -262,7 +261,7 @@ enum iwl_pwr_src {
 #define IEEE80211_HLEN                  (IEEE80211_4ADDR_LEN)
 #define IEEE80211_FRAME_LEN             (IEEE80211_DATA_LEN + IEEE80211_HLEN)
 
-struct iwl4965_frame {
+struct iwl_frame {
        union {
                struct ieee80211_hdr frame;
                struct iwl4965_tx_beacon_cmd beacon;
@@ -308,6 +307,8 @@ struct iwl_cmd_meta {
 
 } __attribute__ ((packed));
 
+#define IWL_CMD_MAX_PAYLOAD 640
+
 /**
  * struct iwl_cmd
  *
@@ -319,7 +320,7 @@ struct iwl_cmd {
        struct iwl_cmd_meta meta;       /* driver data */
        struct iwl_cmd_header hdr;      /* uCode API */
        union {
-               struct iwl4965_addsta_cmd addsta;
+               struct iwl_addsta_cmd addsta;
                struct iwl4965_led_cmd led;
                u32 flags;
                u8 val8;
@@ -329,11 +330,12 @@ struct iwl_cmd {
                struct iwl4965_rxon_time_cmd rxon_time;
                struct iwl4965_powertable_cmd powertable;
                struct iwl4965_qosparam_cmd qosparam;
-               struct iwl4965_tx_cmd tx;
+               struct iwl_tx_cmd tx;
                struct iwl4965_tx_beacon_cmd tx_beacon;
                struct iwl4965_rxon_assoc_cmd rxon_assoc;
+               struct iwl_rem_sta_cmd rm_sta;
                u8 *indirect;
-               u8 payload[360];
+               u8 payload[IWL_CMD_MAX_PAYLOAD];
        } __attribute__ ((packed)) cmd;
 } __attribute__ ((packed));
 
@@ -358,7 +360,7 @@ struct iwl_host_cmd {
 #define SUP_RATE_11G_MAX_NUM_CHANNELS  12
 
 /**
- * struct iwl4965_rx_queue - Rx queue
+ * struct iwl_rx_queue - Rx queue
  * @processed: Internal index to last handled Rx packet
  * @read: Shared index to newest available Rx buffer
  * @write: Shared index to oldest written Rx packet
@@ -367,13 +369,13 @@ struct iwl_host_cmd {
  * @rx_used: List of Rx buffers with no SKB
  * @need_update: flag to indicate we need to update read/write index
  *
- * NOTE:  rx_free and rx_used are used as a FIFO for iwl4965_rx_mem_buffers
+ * NOTE:  rx_free and rx_used are used as a FIFO for iwl_rx_mem_buffers
  */
-struct iwl4965_rx_queue {
+struct iwl_rx_queue {
        __le32 *bd;
        dma_addr_t dma_addr;
-       struct iwl4965_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
-       struct iwl4965_rx_mem_buffer *queue[RX_QUEUE_SIZE];
+       struct iwl_rx_mem_buffer pool[RX_QUEUE_SIZE + RX_FREE_BUFFERS];
+       struct iwl_rx_mem_buffer *queue[RX_QUEUE_SIZE];
        u32 processed;
        u32 read;
        u32 write;
@@ -401,7 +403,7 @@ struct iwl4965_rx_queue {
 
 #ifdef CONFIG_IWL4965_HT
 /**
- * struct iwl4965_ht_agg -- aggregation status while waiting for block-ack
+ * struct iwl_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
@@ -414,7 +416,7 @@ struct iwl4965_rx_queue {
  * for block ack (REPLY_COMPRESSED_BA).  This struct stores tx reply info
  * until block ack arrives.
  */
-struct iwl4965_ht_agg {
+struct iwl_ht_agg {
        u16 txq_id;
        u16 frame_count;
        u16 wait_for_ba;
@@ -430,19 +432,18 @@ struct iwl4965_ht_agg {
 
 #endif /* CONFIG_IWL4965_HT */
 
-struct iwl4965_tid_data {
+struct iwl_tid_data {
        u16 seq_number;
        u16 tfds_in_queue;
 #ifdef CONFIG_IWL4965_HT
-       struct iwl4965_ht_agg agg;
+       struct iwl_ht_agg agg;
 #endif /* CONFIG_IWL4965_HT */
 };
 
-struct iwl4965_hw_key {
+struct iwl_hw_key {
        enum ieee80211_key_alg alg;
        int keylen;
        u8 keyidx;
-       struct ieee80211_key_conf *conf;
        u8 key[32];
 };
 
@@ -454,7 +455,6 @@ union iwl4965_ht_rate_supp {
        };
 };
 
-#ifdef CONFIG_IWL4965_HT
 #define CFG_HT_RX_AMPDU_FACTOR_DEF  (0x3)
 #define CFG_HT_MPDU_DENSITY_2USEC   (0x5)
 #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_2USEC
@@ -477,7 +477,6 @@ struct iwl_ht_info {
        u8 ht_protection;
        u8 non_GF_STA_present;
 };
-#endif                         /*CONFIG_IWL4965_HT */
 
 union iwl4965_qos_capabity {
        struct {
@@ -510,12 +509,12 @@ struct iwl4965_qos_info {
 #define STA_PS_STATUS_WAKE             0
 #define STA_PS_STATUS_SLEEP            1
 
-struct iwl4965_station_entry {
-       struct iwl4965_addsta_cmd sta;
-       struct iwl4965_tid_data tid[MAX_TID_COUNT];
+struct iwl_station_entry {
+       struct iwl_addsta_cmd sta;
+       struct iwl_tid_data tid[MAX_TID_COUNT];
        u8 used;
        u8 ps_status;
-       struct iwl4965_hw_key keyinfo;
+       struct iwl_hw_key keyinfo;
 };
 
 /* one for each uCode image (inst/data, boot/init/runtime) */
@@ -575,7 +574,6 @@ struct iwl_sensitivity_ranges {
 /**
  * struct iwl_hw_params
  * @max_txq_num: Max # Tx queues supported
- * @tx_cmd_len: Size of Tx command (but not including frame itself)
  * @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)
@@ -592,7 +590,6 @@ struct iwl_sensitivity_ranges {
  */
 struct iwl_hw_params {
        u16 max_txq_num;
-       u16 tx_cmd_len;
        u8  tx_chains_num;
        u8  rx_chains_num;
        u8  valid_tx_ant;
@@ -614,8 +611,8 @@ struct iwl_hw_params {
 #endif
 };
 
-#define HT_SHORT_GI_20MHZ_ONLY (1 << 0)
-#define HT_SHORT_GI_40MHZ_ONLY (1 << 1)
+#define HT_SHORT_GI_20MHZ      (1 << 0)
+#define HT_SHORT_GI_40MHZ      (1 << 1)
 
 
 #define IWL_RX_HDR(x) ((struct iwl4965_rx_frame_hdr *)(\
@@ -634,43 +631,33 @@ struct iwl_hw_params {
  * for use by iwl-*.c
  *
  *****************************************************************************/
-struct iwl4965_addsta_cmd;
-extern int iwl4965_send_add_station(struct iwl_priv *priv,
-                               struct iwl4965_addsta_cmd *sta, u8 flags);
-extern u8 iwl4965_add_station_flags(struct iwl_priv *priv, const u8 *addr,
-                         int is_ap, u8 flags, void *ht_data);
+struct iwl_addsta_cmd;
+extern int iwl_send_add_sta(struct iwl_priv *priv,
+                           struct iwl_addsta_cmd *sta, u8 flags);
+u8 iwl_add_station_flags(struct iwl_priv *priv, const u8 *addr, int is_ap,
+                        u8 flags, struct ieee80211_ht_info *ht_info);
 extern int iwl4965_is_network_packet(struct iwl_priv *priv,
                                 struct ieee80211_hdr *header);
 extern int iwl4965_power_init_handle(struct iwl_priv *priv);
 extern void iwl4965_handle_data_packet_monitor(struct iwl_priv *priv,
-                                          struct iwl4965_rx_mem_buffer *rxb,
+                                          struct iwl_rx_mem_buffer *rxb,
                                           void *data, short len,
                                           struct ieee80211_rx_status *stats,
                                           u16 phy_flags);
 extern int iwl4965_is_duplicate_packet(struct iwl_priv *priv,
                                       struct ieee80211_hdr *header);
-extern int iwl4965_rx_queue_alloc(struct iwl_priv *priv);
-extern void iwl4965_rx_queue_reset(struct iwl_priv *priv,
-                              struct iwl4965_rx_queue *rxq);
 extern int iwl4965_calc_db_from_ratio(int sig_ratio);
 extern int iwl4965_calc_sig_qual(int rssi_dbm, int noise_dbm);
-extern int iwl4965_tx_queue_init(struct iwl_priv *priv,
-                            struct iwl4965_tx_queue *txq, int count, u32 id);
-extern void iwl4965_rx_replenish(void *data);
-extern void iwl4965_tx_queue_free(struct iwl_priv *priv, struct iwl4965_tx_queue *txq);
 extern unsigned int iwl4965_fill_beacon_frame(struct iwl_priv *priv,
                                        struct ieee80211_hdr *hdr,
                                        const u8 *dest, int left);
-extern int iwl4965_rx_queue_update_write_ptr(struct iwl_priv *priv,
-                                        struct iwl4965_rx_queue *q);
-extern __le16 *ieee80211_get_qos_ctrl(struct ieee80211_hdr *hdr);
 extern void iwl4965_update_chain_flags(struct iwl_priv *priv);
 int iwl4965_set_pwr_src(struct iwl_priv *priv, enum iwl_pwr_src src);
 
 int iwl4965_init_geos(struct iwl_priv *priv);
 void iwl4965_free_geos(struct iwl_priv *priv);
 
-extern const u8 iwl4965_broadcast_addr[ETH_ALEN];
+extern const u8 iwl_bcast_addr[ETH_ALEN];
 int iwl4965_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd);
 
 /*
@@ -698,31 +685,21 @@ extern u8 iwl4965_sync_station(struct iwl_priv *priv, int sta_id,
  ****************************************************************************/
 extern void iwl4965_hw_setup_deferred_work(struct iwl_priv *priv);
 extern void iwl4965_hw_cancel_deferred_work(struct iwl_priv *priv);
-extern int iwl4965_hw_rxq_stop(struct iwl_priv *priv);
 extern int iwl4965_hw_set_hw_params(struct iwl_priv *priv);
-extern int iwl4965_hw_nic_init(struct iwl_priv *priv);
-extern int iwl4965_hw_nic_stop_master(struct iwl_priv *priv);
-extern void iwl4965_hw_txq_ctx_free(struct iwl_priv *priv);
-extern void iwl4965_hw_txq_ctx_stop(struct iwl_priv *priv);
-extern int iwl4965_hw_nic_reset(struct iwl_priv *priv);
-extern int iwl4965_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *tfd,
-                                       dma_addr_t addr, u16 len);
-extern int iwl4965_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl4965_tx_queue *txq);
+extern int iwl_rxq_stop(struct iwl_priv *priv);
+extern void iwl_txq_ctx_stop(struct iwl_priv *priv);
 extern int iwl4965_hw_get_temperature(struct iwl_priv *priv);
-extern int iwl4965_hw_tx_queue_init(struct iwl_priv *priv,
-                               struct iwl4965_tx_queue *txq);
 extern unsigned int iwl4965_hw_get_beacon_cmd(struct iwl_priv *priv,
-                                struct iwl4965_frame *frame, u8 rate);
-extern int iwl4965_hw_get_rx_read(struct iwl_priv *priv);
+                                struct iwl_frame *frame, u8 rate);
 extern void iwl4965_hw_build_tx_cmd_rate(struct iwl_priv *priv,
                                     struct iwl_cmd *cmd,
-                                    struct ieee80211_tx_control *ctrl,
+                                    struct ieee80211_tx_info *info,
                                     struct ieee80211_hdr *hdr,
                                     int sta_id, int tx_id);
 extern int iwl4965_hw_reg_send_txpower(struct iwl_priv *priv);
 extern int iwl4965_hw_reg_set_txpower(struct iwl_priv *priv, s8 power);
 extern void iwl4965_hw_rx_statistics(struct iwl_priv *priv,
-                                struct iwl4965_rx_mem_buffer *rxb);
+                                struct iwl_rx_mem_buffer *rxb);
 extern void iwl4965_disable_events(struct iwl_priv *priv);
 extern int iwl4965_get_temperature(const struct iwl_priv *priv);
 
@@ -738,7 +715,26 @@ extern u8 iwl_find_station(struct iwl_priv *priv, const u8 *bssid);
 
 extern int iwl4965_hw_channel_switch(struct iwl_priv *priv, u16 channel);
 extern int iwl4965_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index);
-extern int iwl4965_queue_space(const struct iwl4965_queue *q);
+extern int iwl_queue_space(const struct iwl_queue *q);
+static inline int iwl_queue_used(const struct iwl_queue *q, int i)
+{
+       return q->write_ptr > q->read_ptr ?
+               (i >= q->read_ptr && i < q->write_ptr) :
+               !(i < q->read_ptr && i >= q->write_ptr);
+}
+
+
+static inline u8 get_cmd_index(struct iwl_queue *q, u32 index, int is_huge)
+{
+       /* This is for scan command, the big buffer at end of command array */
+       if (is_huge)
+               return q->n_window;     /* must be power of 2 */
+
+       /* Otherwise, use normal size buffers */
+       return index & (q->n_window - 1);
+}
+
+
 struct iwl_priv;
 
 extern void iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio);
@@ -746,16 +742,14 @@ extern void iwl4965_radio_kill_sw(struct iwl_priv *priv, int disable_radio);
  * Forward declare iwl-4965.c functions for iwl-base.c
  */
 extern int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv,
-                                         struct iwl4965_tx_queue *txq,
+                                         struct iwl_tx_queue *txq,
                                          u16 byte_cnt);
-extern void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr,
-                               int is_ap);
 extern int iwl4965_alive_notify(struct iwl_priv *priv);
 extern void iwl4965_update_rate_scaling(struct iwl_priv *priv, u8 mode);
 extern void iwl4965_rf_kill_ct_config(struct iwl_priv *priv);
 extern void iwl4965_hwrate_to_tx_control(struct iwl_priv *priv,
                                         u32 rate_n_flags,
-                                        struct ieee80211_tx_control *control);
+                                        struct ieee80211_tx_info *info);
 
 #ifdef CONFIG_IWL4965_HT
 extern void iwl4965_init_ht_hw_capab(const struct iwl_priv *priv,
@@ -763,8 +757,6 @@ extern void iwl4965_init_ht_hw_capab(const struct iwl_priv *priv,
                                enum ieee80211_band band);
 void iwl4965_set_rxon_ht(struct iwl_priv *priv,
                         struct iwl_ht_info *ht_info);
-void iwl4965_set_ht_add_station(struct iwl_priv *priv, u8 index,
-                               struct ieee80211_ht_info *sta_ht_inf);
 int iwl4965_mac_ampdu_action(struct ieee80211_hw *hw,
                                    enum ieee80211_ampdu_mlme_action action,
                                    const u8 *addr, u16 tid, u16 *ssn);
@@ -778,9 +770,9 @@ static inline void iwl4965_init_ht_hw_capab(const struct iwl_priv *priv,
 #endif /*CONFIG_IWL4965_HT */
 /* Structures, enum, and defines specific to the 4965 */
 
-#define IWL4965_KW_SIZE 0x1000 /*4k */
+#define IWL_KW_SIZE 0x1000     /*4k */
 
-struct iwl4965_kw {
+struct iwl_kw {
        dma_addr_t dma_addr;
        void *v_addr;
        size_t size;
@@ -884,6 +876,21 @@ struct statistics_general_data {
        u32 beacon_energy_c;
 };
 
+struct iwl_calib_results {
+       void *tx_iq_res;
+       void *tx_iq_perd_res;
+       void *lo_res;
+       u32 tx_iq_res_len;
+       u32 tx_iq_perd_res_len;
+       u32 lo_res_len;
+};
+
+enum ucode_type {
+       UCODE_NONE = 0,
+       UCODE_INIT,
+       UCODE_RT
+};
+
 #ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
 /* Sensitivity calib data */
 struct iwl_sensitivity_data {
@@ -960,7 +967,7 @@ struct iwl_priv {
        bool add_radiotap;
 
        void (*rx_handlers[REPLY_MAX])(struct iwl_priv *priv,
-                                      struct iwl4965_rx_mem_buffer *rxb);
+                                      struct iwl_rx_mem_buffer *rxb);
 
        struct ieee80211_supported_band bands[IEEE80211_NUM_BANDS];
 
@@ -985,6 +992,9 @@ struct iwl_priv {
        s32 temperature;        /* degrees Kelvin */
        s32 last_temperature;
 
+       /* init calibration results */
+       struct iwl_calib_results calib_results;
+
        /* Scan related variables */
        unsigned long last_scan_jiffies;
        unsigned long next_scan_jiffies;
@@ -1018,6 +1028,8 @@ struct iwl_priv {
        struct fw_desc ucode_init;      /* initialization inst */
        struct fw_desc ucode_init_data; /* initialization data */
        struct fw_desc ucode_boot;      /* bootstrap inst */
+       enum ucode_type ucode_type;
+       u8 ucode_write_complete;        /* the image write is complete */
 
 
        struct iwl4965_rxon_time_cmd rxon_timing;
@@ -1026,16 +1038,16 @@ struct iwl_priv {
         * changed via explicit cast within the
         * routines that actually update the physical
         * hardware */
-       const struct iwl4965_rxon_cmd active_rxon;
-       struct iwl4965_rxon_cmd staging_rxon;
+       const struct iwl_rxon_cmd active_rxon;
+       struct iwl_rxon_cmd staging_rxon;
 
        int error_recovering;
-       struct iwl4965_rxon_cmd recovery_rxon;
+       struct iwl_rxon_cmd recovery_rxon;
 
        /* 1st responses from initialize and runtime uCode images.
         * 4965's initialize alive response contains some calibration data. */
-       struct iwl4965_init_alive_resp card_alive_init;
-       struct iwl4965_alive_resp card_alive;
+       struct iwl_init_alive_resp card_alive_init;
+       struct iwl_alive_resp card_alive;
 #ifdef CONFIG_IWLWIFI_RFKILL
        struct iwl_rfkill_mngr rfkill_mngr;
 #endif
@@ -1077,10 +1089,10 @@ struct iwl_priv {
        int activity_timer_active;
 
        /* Rx and Tx DMA processing queues */
-       struct iwl4965_rx_queue rxq;
-       struct iwl4965_tx_queue txq[IWL_MAX_NUM_QUEUES];
+       struct iwl_rx_queue rxq;
+       struct iwl_tx_queue txq[IWL_MAX_NUM_QUEUES];
        unsigned long txq_ctx_active_msk;
-       struct iwl4965_kw kw;   /* keep warm address */
+       struct iwl_kw kw;       /* keep warm address */
        u32 scd_base_addr;      /* scheduler sram base address */
 
        unsigned long status;
@@ -1113,7 +1125,7 @@ struct iwl_priv {
        /*station table variables */
        spinlock_t sta_lock;
        int num_stations;
-       struct iwl4965_station_entry stations[IWL_STATION_COUNT];
+       struct iwl_station_entry stations[IWL_STATION_COUNT];
        struct iwl_wep_key wep_keys[WEP_KEYS_MAX];
        u8 default_wep_key;
        u8 key_mapping_key;
@@ -1124,8 +1136,6 @@ struct iwl_priv {
 
        u8 mac80211_registered;
 
-       u32 notif_missed_beacons;
-
        /* Rx'd packet timing information */
        u32 last_beacon_time;
        u64 last_tsf;
@@ -1154,6 +1164,7 @@ struct iwl_priv {
        struct iwl_hw_params hw_params;
        /* driver/uCode shared Tx Byte Counts and Rx status */
        void *shared_virt;
+       int rb_closed_offset;
        /* Physical Pointer to Tx Byte Counts and Rx status */
        dma_addr_t shared_phys;
 
@@ -1179,6 +1190,7 @@ struct iwl_priv {
        struct work_struct report_work;
        struct work_struct request_scan;
        struct work_struct beacon_update;
+       struct work_struct set_monitor;
 
        struct tasklet_struct irq_tasklet;
 
@@ -1200,6 +1212,7 @@ struct iwl_priv {
 
 #ifdef CONFIG_IWLWIFI_DEBUG
        /* debugging info */
+       u32 debug_level;
        u32 framecnt_to_us;
        atomic_t restrict_refcnt;
 #ifdef CONFIG_IWLWIFI_DEBUGFS
@@ -1209,12 +1222,26 @@ struct iwl_priv {
 #endif /* CONFIG_IWLWIFI_DEBUG */
 
        struct work_struct txpower_work;
+#ifdef CONFIG_IWLWIFI_RUN_TIME_CALIB
+       u32 disable_sens_cal;
+       u32 disable_chain_noise_cal;
+#endif /* CONFIG_IWLWIFI_RUN_TIME_CALIB */
 #ifdef CONFIG_IWL4965_RUN_TIME_CALIB
        struct work_struct sensitivity_work;
-#endif
+#endif /* CONFIG_IWL4965_RUN_TIME_CALIB */
        struct timer_list statistics_periodic;
 }; /*iwl_priv */
 
+static inline void iwl_txq_ctx_activate(struct iwl_priv *priv, int txq_id)
+{
+       set_bit(txq_id, &priv->txq_ctx_active_msk);
+}
+
+static inline void iwl_txq_ctx_deactivate(struct iwl_priv *priv, int txq_id)
+{
+       clear_bit(txq_id, &priv->txq_ctx_active_msk);
+}
+
 static inline int iwl_is_associated(struct iwl_priv *priv)
 {
        return (priv->active_rxon.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
@@ -1252,6 +1279,23 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch)
        return ((ch->flags & EEPROM_CHANNEL_IBSS)) ? 1 : 0;
 }
 
+#ifdef CONFIG_IWLWIFI_DEBUG
+static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level,
+                                     void *p, u32 len)
+{
+       if (!(priv->debug_level & level))
+               return;
+
+       print_hex_dump(KERN_DEBUG, "iwl data: ", DUMP_PREFIX_OFFSET, 16, 1,
+                       p, len, 1);
+}
+#else
+static inline void iwl_print_hex_dump(struct iwl_priv *priv, int level,
+                                     void *p, u32 len)
+{
+}
+#endif
+
 extern const struct iwl_channel_info *iwl_get_channel_info(
        const struct iwl_priv *priv, enum ieee80211_band band, u16 channel);