aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>2011-09-06 12:31:19 -0400
committerJohn W. Linville <linville@tuxdriver.com>2011-09-14 13:56:37 -0400
commit522376d206da66cecc90929134ad70c0446e874b (patch)
treedd475fa28731670f5810ca723c085fb2ba495344 /drivers
parent3e10caeb55b2693b38f1f80c67c79d918fc42e42 (diff)
iwlagn: clean up of transport layer
Move a few declarations needed by the transport layer to iwl-shared.h Move iwl_cmd_meta, iwl_tx_queue and friends to the internal transport header file. Move iwl_device_cmd iwl_host_cmd and friends to iwl-trans.h since these structs are used in the API to the transport layer. Move get_cmd_string to the upper layer with a declaration in iwl-shared.h. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-rxon.c2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn-tt.h1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.h2
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-core.h22
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h162
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-helpers.h23
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-rx.c81
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-shared.h43
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-sv-open.c1
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h92
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c6
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c92
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.c11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans.h66
15 files changed, 299 insertions, 309 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
index 1af276739d87..ea4895a66eb1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-rxon.c
@@ -456,7 +456,7 @@ int iwlagn_commit_rxon(struct iwl_priv *priv, struct iwl_rxon_context *ctx)
456 else 456 else
457 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK; 457 ctx->staging.flags &= ~RXON_FLG_SHORT_SLOT_MSK;
458 458
459 iwl_print_rx_config_cmd(priv, ctx); 459 iwl_print_rx_config_cmd(priv, ctx->ctxid);
460 ret = iwl_check_rxon_cmd(priv, ctx); 460 ret = iwl_check_rxon_cmd(priv, ctx);
461 if (ret) { 461 if (ret) {
462 IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n"); 462 IWL_ERR(priv, "Invalid RXON configuration. Not committing.\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn-tt.h b/drivers/net/wireless/iwlwifi/iwl-agn-tt.h
index d118ed29bf3f..7282a23e8f1c 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn-tt.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn-tt.h
@@ -117,7 +117,6 @@ struct iwl_tt_mgmt {
117u8 iwl_tt_current_power_mode(struct iwl_priv *priv); 117u8 iwl_tt_current_power_mode(struct iwl_priv *priv);
118bool iwl_tt_is_low_power_state(struct iwl_priv *priv); 118bool iwl_tt_is_low_power_state(struct iwl_priv *priv);
119bool iwl_ht_enabled(struct iwl_priv *priv); 119bool iwl_ht_enabled(struct iwl_priv *priv);
120bool iwl_check_for_ct_kill(struct iwl_priv *priv);
121enum iwl_antenna_ok iwl_tx_ant_restriction(struct iwl_priv *priv); 120enum iwl_antenna_ok iwl_tx_ant_restriction(struct iwl_priv *priv);
122enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv); 121enum iwl_antenna_ok iwl_rx_ant_restriction(struct iwl_priv *priv);
123void iwl_tt_enter_ct_kill(struct iwl_priv *priv); 122void iwl_tt_enter_ct_kill(struct iwl_priv *priv);
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.h b/drivers/net/wireless/iwlwifi/iwl-agn.h
index a7b4948e43da..4bc1f4669e5a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.h
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.h
@@ -98,7 +98,6 @@ int iwlagn_load_ucode_wait_alive(struct iwl_priv *priv,
98 enum iwlagn_ucode_type ucode_type); 98 enum iwlagn_ucode_type ucode_type);
99 99
100/* lib */ 100/* lib */
101int iwlagn_hw_valid_rtc_data_addr(u32 addr);
102int iwlagn_send_tx_power(struct iwl_priv *priv); 101int iwlagn_send_tx_power(struct iwl_priv *priv);
103void iwlagn_temperature(struct iwl_priv *priv); 102void iwlagn_temperature(struct iwl_priv *priv);
104u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv); 103u16 iwlagn_eeprom_calib_version(struct iwl_priv *priv);
@@ -109,7 +108,6 @@ int iwlagn_send_beacon_cmd(struct iwl_priv *priv);
109/* rx */ 108/* rx */
110int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band); 109int iwlagn_hwrate_to_mac80211_idx(u32 rate_n_flags, enum ieee80211_band band);
111void iwl_setup_rx_handlers(struct iwl_priv *priv); 110void iwl_setup_rx_handlers(struct iwl_priv *priv);
112void iwl_rx_dispatch(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb);
113 111
114 112
115/* tx */ 113/* tx */
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.c b/drivers/net/wireless/iwlwifi/iwl-core.c
index d9897da7281f..a600b82e7fcf 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.c
+++ b/drivers/net/wireless/iwlwifi/iwl-core.c
@@ -817,9 +817,9 @@ void iwl_chswitch_done(struct iwl_priv *priv, bool is_success)
817} 817}
818 818
819#ifdef CONFIG_IWLWIFI_DEBUG 819#ifdef CONFIG_IWLWIFI_DEBUG
820void iwl_print_rx_config_cmd(struct iwl_priv *priv, 820void iwl_print_rx_config_cmd(struct iwl_priv *priv, u8 ctxid)
821 struct iwl_rxon_context *ctx)
822{ 821{
822 struct iwl_rxon_context *ctx = &priv->contexts[ctxid];
823 struct iwl_rxon_cmd *rxon = &ctx->staging; 823 struct iwl_rxon_cmd *rxon = &ctx->staging;
824 824
825 IWL_DEBUG_RADIO(priv, "RX CONFIG:\n"); 825 IWL_DEBUG_RADIO(priv, "RX CONFIG:\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-core.h b/drivers/net/wireless/iwlwifi/iwl-core.h
index 2ea8a2e0dfbc..56b554c43fde 100644
--- a/drivers/net/wireless/iwlwifi/iwl-core.h
+++ b/drivers/net/wireless/iwlwifi/iwl-core.h
@@ -73,8 +73,6 @@ struct iwl_cmd;
73 73
74#define TIME_UNIT 1024 74#define TIME_UNIT 1024
75 75
76#define IWL_CMD(x) case x: return #x
77
78struct iwl_lib_ops { 76struct iwl_lib_ops {
79 /* set hw dependent parameters */ 77 /* set hw dependent parameters */
80 int (*set_hw_params)(struct iwl_priv *priv); 78 int (*set_hw_params)(struct iwl_priv *priv);
@@ -271,7 +269,6 @@ int iwl_mac_change_interface(struct ieee80211_hw *hw,
271#ifdef CONFIG_IWLWIFI_DEBUGFS 269#ifdef CONFIG_IWLWIFI_DEBUGFS
272int iwl_alloc_traffic_mem(struct iwl_priv *priv); 270int iwl_alloc_traffic_mem(struct iwl_priv *priv);
273void iwl_free_traffic_mem(struct iwl_priv *priv); 271void iwl_free_traffic_mem(struct iwl_priv *priv);
274void iwl_reset_traffic_log(struct iwl_priv *priv);
275void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv, 272void iwl_dbg_log_tx_data_frame(struct iwl_priv *priv,
276 u16 length, struct ieee80211_hdr *header); 273 u16 length, struct ieee80211_hdr *header);
277void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv, 274void iwl_dbg_log_rx_data_frame(struct iwl_priv *priv,
@@ -360,7 +357,6 @@ int __must_check iwl_scan_initiate(struct iwl_priv *priv,
360 * S e n d i n g H o s t C o m m a n d s * 357 * S e n d i n g H o s t C o m m a n d s *
361 *****************************************************/ 358 *****************************************************/
362 359
363const char *get_cmd_string(u8 cmd);
364void iwl_bg_watchdog(unsigned long data); 360void iwl_bg_watchdog(unsigned long data);
365u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval); 361u32 iwl_usecs_to_beacons(struct iwl_priv *priv, u32 usec, u32 beacon_interval);
366__le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base, 362__le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
@@ -368,19 +364,6 @@ __le32 iwl_add_beacon_time(struct iwl_priv *priv, u32 base,
368 364
369 365
370/***************************************************** 366/*****************************************************
371* Error Handling Debugging
372******************************************************/
373#ifdef CONFIG_IWLWIFI_DEBUG
374void iwl_print_rx_config_cmd(struct iwl_priv *priv,
375 struct iwl_rxon_context *ctx);
376#else
377static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv,
378 struct iwl_rxon_context *ctx)
379{
380}
381#endif
382
383/*****************************************************
384* GEOS 367* GEOS
385******************************************************/ 368******************************************************/
386int iwl_init_geos(struct iwl_priv *priv); 369int iwl_init_geos(struct iwl_priv *priv);
@@ -389,8 +372,6 @@ void iwl_free_geos(struct iwl_priv *priv);
389extern void iwl_send_bt_config(struct iwl_priv *priv); 372extern void iwl_send_bt_config(struct iwl_priv *priv);
390extern int iwl_send_statistics_request(struct iwl_priv *priv, 373extern int iwl_send_statistics_request(struct iwl_priv *priv,
391 u8 flags, bool clear); 374 u8 flags, bool clear);
392void iwl_apm_stop(struct iwl_priv *priv);
393int iwl_apm_init(struct iwl_priv *priv);
394 375
395int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx); 376int iwl_send_rxon_timing(struct iwl_priv *priv, struct iwl_rxon_context *ctx);
396 377
@@ -408,7 +389,4 @@ static inline bool iwl_advanced_bt_coexist(struct iwl_priv *priv)
408 389
409extern bool bt_siso_mode; 390extern bool bt_siso_mode;
410 391
411
412void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand);
413
414#endif /* __iwl_core_h__ */ 392#endif /* __iwl_core_h__ */
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 8ae79e9cf5f1..bbda6725a751 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -32,7 +32,6 @@
32#define __iwl_dev_h__ 32#define __iwl_dev_h__
33 33
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/pci.h> /* for struct pci_device_id */
36#include <linux/kernel.h> 35#include <linux/kernel.h>
37#include <linux/wait.h> 36#include <linux/wait.h>
38#include <linux/leds.h> 37#include <linux/leds.h>
@@ -89,100 +88,6 @@ struct iwl_tx_queue;
89#define DEFAULT_SHORT_RETRY_LIMIT 7U 88#define DEFAULT_SHORT_RETRY_LIMIT 7U
90#define DEFAULT_LONG_RETRY_LIMIT 4U 89#define DEFAULT_LONG_RETRY_LIMIT 4U
91 90
92/* defined below */
93struct iwl_device_cmd;
94
95struct iwl_cmd_meta {
96 /* only for SYNC commands, iff the reply skb is wanted */
97 struct iwl_host_cmd *source;
98 /*
99 * only for ASYNC commands
100 * (which is somewhat stupid -- look at iwl-sta.c for instance
101 * which duplicates a bunch of code because the callback isn't
102 * invoked for SYNC commands, if it were and its result passed
103 * through it would be simpler...)
104 */
105 void (*callback)(struct iwl_shared *shrd,
106 struct iwl_device_cmd *cmd,
107 struct iwl_rx_packet *pkt);
108
109 u32 flags;
110
111 DEFINE_DMA_UNMAP_ADDR(mapping);
112 DEFINE_DMA_UNMAP_LEN(len);
113};
114
115/*
116 * Generic queue structure
117 *
118 * Contains common data for Rx and Tx queues.
119 *
120 * Note the difference between n_bd and n_window: the hardware
121 * always assumes 256 descriptors, so n_bd is always 256 (unless
122 * there might be HW changes in the future). For the normal TX
123 * queues, n_window, which is the size of the software queue data
124 * is also 256; however, for the command queue, n_window is only
125 * 32 since we don't need so many commands pending. Since the HW
126 * still uses 256 BDs for DMA though, n_bd stays 256. As a result,
127 * the software buffers (in the variables @meta, @txb in struct
128 * iwl_tx_queue) only have 32 entries, while the HW buffers (@tfds
129 * in the same struct) have 256.
130 * This means that we end up with the following:
131 * HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 |
132 * SW entries: | 0 | ... | 31 |
133 * where N is a number between 0 and 7. This means that the SW
134 * data is a window overlayed over the HW queue.
135 */
136struct iwl_queue {
137 int n_bd; /* number of BDs in this queue */
138 int write_ptr; /* 1-st empty entry (index) host_w*/
139 int read_ptr; /* last used entry (index) host_r*/
140 /* use for monitoring and recovering the stuck queue */
141 dma_addr_t dma_addr; /* physical addr for BD's */
142 int n_window; /* safe queue window */
143 u32 id;
144 int low_mark; /* low watermark, resume queue if free
145 * space more than this */
146 int high_mark; /* high watermark, stop queue if free
147 * space less than this */
148};
149
150/**
151 * struct iwl_tx_queue - Tx Queue for DMA
152 * @q: generic Rx/Tx queue descriptor
153 * @bd: base of circular buffer of TFDs
154 * @cmd: array of command/TX buffer pointers
155 * @meta: array of meta data for each command/tx buffer
156 * @dma_addr_cmd: physical address of cmd/tx buffer array
157 * @txb: array of per-TFD driver data
158 * @time_stamp: time (in jiffies) of last read_ptr change
159 * @need_update: indicates need to update read/write index
160 * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled
161 * @sta_id: valid if sched_retry is set
162 * @tid: valid if sched_retry is set
163 *
164 * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
165 * descriptors) and required locking structures.
166 */
167#define TFD_TX_CMD_SLOTS 256
168#define TFD_CMD_SLOTS 32
169
170struct iwl_tx_queue {
171 struct iwl_queue q;
172 struct iwl_tfd *tfds;
173 struct iwl_device_cmd **cmd;
174 struct iwl_cmd_meta *meta;
175 struct sk_buff **skbs;
176 unsigned long time_stamp;
177 u8 need_update;
178 u8 sched_retry;
179 u8 active;
180 u8 swq_id;
181
182 u16 sta_id;
183 u16 tid;
184};
185
186#define IWL_NUM_SCAN_RATES (2) 91#define IWL_NUM_SCAN_RATES (2)
187 92
188/* 93/*
@@ -249,70 +154,6 @@ struct iwl_channel_info {
249#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN) 154#define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
250#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN) 155#define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
251 156
252
253#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
254#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
255#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
256
257enum {
258 CMD_SYNC = 0,
259 CMD_ASYNC = BIT(0),
260 CMD_WANT_SKB = BIT(1),
261 CMD_ON_DEMAND = BIT(2),
262};
263
264#define DEF_CMD_PAYLOAD_SIZE 320
265
266/**
267 * struct iwl_device_cmd
268 *
269 * For allocation of the command and tx queues, this establishes the overall
270 * size of the largest command we send to uCode, except for commands that
271 * aren't fully copied and use other TFD space.
272 */
273struct iwl_device_cmd {
274 struct iwl_cmd_header hdr; /* uCode API */
275 union {
276 u32 flags;
277 u8 val8;
278 u16 val16;
279 u32 val32;
280 struct iwl_tx_cmd tx;
281 struct iwl6000_channel_switch_cmd chswitch;
282 u8 payload[DEF_CMD_PAYLOAD_SIZE];
283 } __packed cmd;
284} __packed;
285
286#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd))
287
288#define IWL_MAX_CMD_TFDS 2
289
290enum iwl_hcmd_dataflag {
291 IWL_HCMD_DFL_NOCOPY = BIT(0),
292};
293
294/**
295 * struct iwl_host_cmd - Host command to the uCode
296 * @data: array of chunks that composes the data of the host command
297 * @reply_page: pointer to the page that holds the response to the host command
298 * @callback:
299 * @flags: can be CMD_* note CMD_WANT_SKB is incompatible withe CMD_ASYNC
300 * @len: array of the lenths of the chunks in data
301 * @dataflags:
302 * @id: id of the host command
303 */
304struct iwl_host_cmd {
305 const void *data[IWL_MAX_CMD_TFDS];
306 unsigned long reply_page;
307 void (*callback)(struct iwl_shared *shrd,
308 struct iwl_device_cmd *cmd,
309 struct iwl_rx_packet *pkt);
310 u32 flags;
311 u16 len[IWL_MAX_CMD_TFDS];
312 u8 dataflags[IWL_MAX_CMD_TFDS];
313 u8 id;
314};
315
316#define SUP_RATE_11A_MAX_NUM_CHANNELS 8 157#define SUP_RATE_11A_MAX_NUM_CHANNELS 8
317#define SUP_RATE_11B_MAX_NUM_CHANNELS 4 158#define SUP_RATE_11B_MAX_NUM_CHANNELS 4
318#define SUP_RATE_11G_MAX_NUM_CHANNELS 12 159#define SUP_RATE_11G_MAX_NUM_CHANNELS 12
@@ -580,9 +421,6 @@ extern const u8 iwl_bcast_addr[ETH_ALEN];
580#define IWL_OPERATION_MODE_MIXED 2 421#define IWL_OPERATION_MODE_MIXED 2
581#define IWL_OPERATION_MODE_20MHZ 3 422#define IWL_OPERATION_MODE_20MHZ 3
582 423
583#define IWL_TX_CRC_SIZE 4
584#define IWL_TX_DELIMITER_SIZE 4
585
586#define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000 424#define TX_POWER_IWL_ILLEGAL_VOLTAGE -10000
587 425
588/* Sensitivity and chain noise calibration */ 426/* Sensitivity and chain noise calibration */
diff --git a/drivers/net/wireless/iwlwifi/iwl-helpers.h b/drivers/net/wireless/iwlwifi/iwl-helpers.h
index d3feac9e45b4..968fc66e3506 100644
--- a/drivers/net/wireless/iwlwifi/iwl-helpers.h
+++ b/drivers/net/wireless/iwlwifi/iwl-helpers.h
@@ -35,35 +35,12 @@
35 35
36#include "iwl-io.h" 36#include "iwl-io.h"
37 37
38#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
39
40
41static inline struct ieee80211_conf *ieee80211_get_hw_conf( 38static inline struct ieee80211_conf *ieee80211_get_hw_conf(
42 struct ieee80211_hw *hw) 39 struct ieee80211_hw *hw)
43{ 40{
44 return &hw->conf; 41 return &hw->conf;
45} 42}
46 43
47/**
48 * iwl_queue_inc_wrap - increment queue index, wrap back to beginning
49 * @index -- current index
50 * @n_bd -- total number of entries in queue (must be power of 2)
51 */
52static inline int iwl_queue_inc_wrap(int index, int n_bd)
53{
54 return ++index & (n_bd - 1);
55}
56
57/**
58 * iwl_queue_dec_wrap - decrement queue index, wrap back to end
59 * @index -- current index
60 * @n_bd -- total number of entries in queue (must be power of 2)
61 */
62static inline int iwl_queue_dec_wrap(int index, int n_bd)
63{
64 return --index & (n_bd - 1);
65}
66
67static inline void iwl_enable_rfkill_int(struct iwl_priv *priv) 44static inline void iwl_enable_rfkill_int(struct iwl_priv *priv)
68{ 45{
69 IWL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n"); 46 IWL_DEBUG_ISR(priv, "Enabling rfkill interrupt\n");
diff --git a/drivers/net/wireless/iwlwifi/iwl-rx.c b/drivers/net/wireless/iwlwifi/iwl-rx.c
index ee8fabd0b4f3..c7e6a746c3ea 100644
--- a/drivers/net/wireless/iwlwifi/iwl-rx.c
+++ b/drivers/net/wireless/iwlwifi/iwl-rx.c
@@ -42,6 +42,87 @@
42#include "iwl-agn.h" 42#include "iwl-agn.h"
43#include "iwl-shared.h" 43#include "iwl-shared.h"
44 44
45const char *get_cmd_string(u8 cmd)
46{
47 switch (cmd) {
48 IWL_CMD(REPLY_ALIVE);
49 IWL_CMD(REPLY_ERROR);
50 IWL_CMD(REPLY_RXON);
51 IWL_CMD(REPLY_RXON_ASSOC);
52 IWL_CMD(REPLY_QOS_PARAM);
53 IWL_CMD(REPLY_RXON_TIMING);
54 IWL_CMD(REPLY_ADD_STA);
55 IWL_CMD(REPLY_REMOVE_STA);
56 IWL_CMD(REPLY_REMOVE_ALL_STA);
57 IWL_CMD(REPLY_TXFIFO_FLUSH);
58 IWL_CMD(REPLY_WEPKEY);
59 IWL_CMD(REPLY_TX);
60 IWL_CMD(REPLY_LEDS_CMD);
61 IWL_CMD(REPLY_TX_LINK_QUALITY_CMD);
62 IWL_CMD(COEX_PRIORITY_TABLE_CMD);
63 IWL_CMD(COEX_MEDIUM_NOTIFICATION);
64 IWL_CMD(COEX_EVENT_CMD);
65 IWL_CMD(REPLY_QUIET_CMD);
66 IWL_CMD(REPLY_CHANNEL_SWITCH);
67 IWL_CMD(CHANNEL_SWITCH_NOTIFICATION);
68 IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD);
69 IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION);
70 IWL_CMD(POWER_TABLE_CMD);
71 IWL_CMD(PM_SLEEP_NOTIFICATION);
72 IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC);
73 IWL_CMD(REPLY_SCAN_CMD);
74 IWL_CMD(REPLY_SCAN_ABORT_CMD);
75 IWL_CMD(SCAN_START_NOTIFICATION);
76 IWL_CMD(SCAN_RESULTS_NOTIFICATION);
77 IWL_CMD(SCAN_COMPLETE_NOTIFICATION);
78 IWL_CMD(BEACON_NOTIFICATION);
79 IWL_CMD(REPLY_TX_BEACON);
80 IWL_CMD(WHO_IS_AWAKE_NOTIFICATION);
81 IWL_CMD(QUIET_NOTIFICATION);
82 IWL_CMD(REPLY_TX_PWR_TABLE_CMD);
83 IWL_CMD(MEASURE_ABORT_NOTIFICATION);
84 IWL_CMD(REPLY_BT_CONFIG);
85 IWL_CMD(REPLY_STATISTICS_CMD);
86 IWL_CMD(STATISTICS_NOTIFICATION);
87 IWL_CMD(REPLY_CARD_STATE_CMD);
88 IWL_CMD(CARD_STATE_NOTIFICATION);
89 IWL_CMD(MISSED_BEACONS_NOTIFICATION);
90 IWL_CMD(REPLY_CT_KILL_CONFIG_CMD);
91 IWL_CMD(SENSITIVITY_CMD);
92 IWL_CMD(REPLY_PHY_CALIBRATION_CMD);
93 IWL_CMD(REPLY_RX_PHY_CMD);
94 IWL_CMD(REPLY_RX_MPDU_CMD);
95 IWL_CMD(REPLY_RX);
96 IWL_CMD(REPLY_COMPRESSED_BA);
97 IWL_CMD(CALIBRATION_CFG_CMD);
98 IWL_CMD(CALIBRATION_RES_NOTIFICATION);
99 IWL_CMD(CALIBRATION_COMPLETE_NOTIFICATION);
100 IWL_CMD(REPLY_TX_POWER_DBM_CMD);
101 IWL_CMD(TEMPERATURE_NOTIFICATION);
102 IWL_CMD(TX_ANT_CONFIGURATION_CMD);
103 IWL_CMD(REPLY_BT_COEX_PROFILE_NOTIF);
104 IWL_CMD(REPLY_BT_COEX_PRIO_TABLE);
105 IWL_CMD(REPLY_BT_COEX_PROT_ENV);
106 IWL_CMD(REPLY_WIPAN_PARAMS);
107 IWL_CMD(REPLY_WIPAN_RXON);
108 IWL_CMD(REPLY_WIPAN_RXON_TIMING);
109 IWL_CMD(REPLY_WIPAN_RXON_ASSOC);
110 IWL_CMD(REPLY_WIPAN_QOS_PARAM);
111 IWL_CMD(REPLY_WIPAN_WEPKEY);
112 IWL_CMD(REPLY_WIPAN_P2P_CHANNEL_SWITCH);
113 IWL_CMD(REPLY_WIPAN_NOA_NOTIFICATION);
114 IWL_CMD(REPLY_WIPAN_DEACTIVATION_COMPLETE);
115 IWL_CMD(REPLY_WOWLAN_PATTERNS);
116 IWL_CMD(REPLY_WOWLAN_WAKEUP_FILTER);
117 IWL_CMD(REPLY_WOWLAN_TSC_RSC_PARAMS);
118 IWL_CMD(REPLY_WOWLAN_TKIP_PARAMS);
119 IWL_CMD(REPLY_WOWLAN_KEK_KCK_MATERIAL);
120 IWL_CMD(REPLY_WOWLAN_GET_STATUS);
121 default:
122 return "UNKNOWN";
123
124 }
125}
45 126
46/****************************************************************************** 127/******************************************************************************
47 * 128 *
diff --git a/drivers/net/wireless/iwlwifi/iwl-shared.h b/drivers/net/wireless/iwlwifi/iwl-shared.h
index 9790d7eba39b..73ea5e7a1f99 100644
--- a/drivers/net/wireless/iwlwifi/iwl-shared.h
+++ b/drivers/net/wireless/iwlwifi/iwl-shared.h
@@ -67,6 +67,7 @@
67#include <linux/spinlock.h> 67#include <linux/spinlock.h>
68#include <linux/mutex.h> 68#include <linux/mutex.h>
69#include <linux/gfp.h> 69#include <linux/gfp.h>
70#include <linux/mm.h> /* for page_address */
70#include <net/mac80211.h> 71#include <net/mac80211.h>
71 72
72#include "iwl-commands.h" 73#include "iwl-commands.h"
@@ -287,6 +288,26 @@ static inline void iwl_free_pages(struct iwl_shared *shrd, unsigned long page)
287 free_pages(page, shrd->hw_params.rx_page_order); 288 free_pages(page, shrd->hw_params.rx_page_order);
288} 289}
289 290
291/**
292 * iwl_queue_inc_wrap - increment queue index, wrap back to beginning
293 * @index -- current index
294 * @n_bd -- total number of entries in queue (must be power of 2)
295 */
296static inline int iwl_queue_inc_wrap(int index, int n_bd)
297{
298 return ++index & (n_bd - 1);
299}
300
301/**
302 * iwl_queue_dec_wrap - decrement queue index, wrap back to end
303 * @index -- current index
304 * @n_bd -- total number of entries in queue (must be power of 2)
305 */
306static inline int iwl_queue_dec_wrap(int index, int n_bd)
307{
308 return --index & (n_bd - 1);
309}
310
290struct iwl_rx_mem_buffer { 311struct iwl_rx_mem_buffer {
291 dma_addr_t page_dma; 312 dma_addr_t page_dma;
292 struct page *page; 313 struct page *page;
@@ -357,6 +378,8 @@ int iwl_probe(struct iwl_bus *bus, const struct iwl_trans_ops *trans_ops,
357 struct iwl_cfg *cfg); 378 struct iwl_cfg *cfg);
358void __devexit iwl_remove(struct iwl_priv * priv); 379void __devexit iwl_remove(struct iwl_priv * priv);
359 380
381void iwl_rx_dispatch(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb);
382int iwlagn_hw_valid_rtc_data_addr(u32 addr);
360void iwl_start_tx_ba_trans_ready(struct iwl_priv *priv, 383void iwl_start_tx_ba_trans_ready(struct iwl_priv *priv,
361 enum iwl_rxon_context_id ctx, 384 enum iwl_rxon_context_id ctx,
362 u8 sta_id, u8 tid); 385 u8 sta_id, u8 tid);
@@ -364,6 +387,26 @@ void iwl_stop_tx_ba_trans_ready(struct iwl_priv *priv,
364 enum iwl_rxon_context_id ctx, 387 enum iwl_rxon_context_id ctx,
365 u8 sta_id, u8 tid); 388 u8 sta_id, u8 tid);
366void iwl_set_hw_rfkill_state(struct iwl_priv *priv, bool state); 389void iwl_set_hw_rfkill_state(struct iwl_priv *priv, bool state);
390void iwl_apm_stop(struct iwl_priv *priv);
391int iwl_apm_init(struct iwl_priv *priv);
392void iwlagn_fw_error(struct iwl_priv *priv, bool ondemand);
393const char *get_cmd_string(u8 cmd);
394bool iwl_check_for_ct_kill(struct iwl_priv *priv);
395
396#ifdef CONFIG_IWLWIFI_DEBUGFS
397void iwl_reset_traffic_log(struct iwl_priv *priv);
398#endif /* CONFIG_IWLWIFI_DEBUGFS */
399
400#ifdef CONFIG_IWLWIFI_DEBUG
401void iwl_print_rx_config_cmd(struct iwl_priv *priv, u8 ctxid);
402#else
403static inline void iwl_print_rx_config_cmd(struct iwl_priv *priv, u8 ctxid);
404{
405}
406#endif
407
408#define IWL_CMD(x) case x: return #x
409#define IWL_MASK(lo, hi) ((1 << (hi)) | ((1 << (hi)) - (1 << (lo))))
367 410
368/***************************************************** 411/*****************************************************
369* DRIVER STATUS FUNCTIONS 412* DRIVER STATUS FUNCTIONS
diff --git a/drivers/net/wireless/iwlwifi/iwl-sv-open.c b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
index 848fc18befc2..3335d31daf89 100644
--- a/drivers/net/wireless/iwlwifi/iwl-sv-open.c
+++ b/drivers/net/wireless/iwlwifi/iwl-sv-open.c
@@ -63,6 +63,7 @@
63#include <linux/init.h> 63#include <linux/init.h>
64#include <linux/kernel.h> 64#include <linux/kernel.h>
65#include <linux/module.h> 65#include <linux/module.h>
66#include <linux/dma-mapping.h>
66#include <net/net_namespace.h> 67#include <net/net_namespace.h>
67#include <linux/netdevice.h> 68#include <linux/netdevice.h>
68#include <net/cfg80211.h> 69#include <net/cfg80211.h>
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
index f76526e080a3..c5720cd4f346 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
@@ -32,6 +32,7 @@
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <linux/interrupt.h> 33#include <linux/interrupt.h>
34#include <linux/skbuff.h> 34#include <linux/skbuff.h>
35#include <linux/pci.h>
35 36
36#include "iwl-fh.h" 37#include "iwl-fh.h"
37#include "iwl-csr.h" 38#include "iwl-csr.h"
@@ -114,6 +115,97 @@ struct iwl_dma_ptr {
114 */ 115 */
115#define IWL_IPAN_MCAST_QUEUE 8 116#define IWL_IPAN_MCAST_QUEUE 8
116 117
118struct iwl_cmd_meta {
119 /* only for SYNC commands, iff the reply skb is wanted */
120 struct iwl_host_cmd *source;
121 /*
122 * only for ASYNC commands
123 * (which is somewhat stupid -- look at iwl-sta.c for instance
124 * which duplicates a bunch of code because the callback isn't
125 * invoked for SYNC commands, if it were and its result passed
126 * through it would be simpler...)
127 */
128 void (*callback)(struct iwl_shared *shrd,
129 struct iwl_device_cmd *cmd,
130 struct iwl_rx_packet *pkt);
131
132 u32 flags;
133
134 DEFINE_DMA_UNMAP_ADDR(mapping);
135 DEFINE_DMA_UNMAP_LEN(len);
136};
137
138/*
139 * Generic queue structure
140 *
141 * Contains common data for Rx and Tx queues.
142 *
143 * Note the difference between n_bd and n_window: the hardware
144 * always assumes 256 descriptors, so n_bd is always 256 (unless
145 * there might be HW changes in the future). For the normal TX
146 * queues, n_window, which is the size of the software queue data
147 * is also 256; however, for the command queue, n_window is only
148 * 32 since we don't need so many commands pending. Since the HW
149 * still uses 256 BDs for DMA though, n_bd stays 256. As a result,
150 * the software buffers (in the variables @meta, @txb in struct
151 * iwl_tx_queue) only have 32 entries, while the HW buffers (@tfds
152 * in the same struct) have 256.
153 * This means that we end up with the following:
154 * HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 |
155 * SW entries: | 0 | ... | 31 |
156 * where N is a number between 0 and 7. This means that the SW
157 * data is a window overlayed over the HW queue.
158 */
159struct iwl_queue {
160 int n_bd; /* number of BDs in this queue */
161 int write_ptr; /* 1-st empty entry (index) host_w*/
162 int read_ptr; /* last used entry (index) host_r*/
163 /* use for monitoring and recovering the stuck queue */
164 dma_addr_t dma_addr; /* physical addr for BD's */
165 int n_window; /* safe queue window */
166 u32 id;
167 int low_mark; /* low watermark, resume queue if free
168 * space more than this */
169 int high_mark; /* high watermark, stop queue if free
170 * space less than this */
171};
172
173/**
174 * struct iwl_tx_queue - Tx Queue for DMA
175 * @q: generic Rx/Tx queue descriptor
176 * @bd: base of circular buffer of TFDs
177 * @cmd: array of command/TX buffer pointers
178 * @meta: array of meta data for each command/tx buffer
179 * @dma_addr_cmd: physical address of cmd/tx buffer array
180 * @txb: array of per-TFD driver data
181 * @time_stamp: time (in jiffies) of last read_ptr change
182 * @need_update: indicates need to update read/write index
183 * @sched_retry: indicates queue is high-throughput aggregation (HT AGG) enabled
184 * @sta_id: valid if sched_retry is set
185 * @tid: valid if sched_retry is set
186 *
187 * A Tx queue consists of circular buffer of BDs (a.k.a. TFDs, transmit frame
188 * descriptors) and required locking structures.
189 */
190#define TFD_TX_CMD_SLOTS 256
191#define TFD_CMD_SLOTS 32
192
193struct iwl_tx_queue {
194 struct iwl_queue q;
195 struct iwl_tfd *tfds;
196 struct iwl_device_cmd **cmd;
197 struct iwl_cmd_meta *meta;
198 struct sk_buff **skbs;
199 unsigned long time_stamp;
200 u8 need_update;
201 u8 sched_retry;
202 u8 active;
203 u8 swq_id;
204
205 u16 sta_id;
206 u16 tid;
207};
208
117/** 209/**
118 * struct iwl_trans_pcie - PCIe transport specific data 210 * struct iwl_trans_pcie - PCIe transport specific data
119 * @rxq: all the RX queue data 211 * @rxq: all the RX queue data
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
index e22cc6d8c07f..f7b575022813 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-rx-pcie.c
@@ -30,8 +30,7 @@
30#include <linux/wait.h> 30#include <linux/wait.h>
31#include <linux/gfp.h> 31#include <linux/gfp.h>
32 32
33#include "iwl-dev.h" 33/*TODO: Remove include to iwl-core.h*/
34#include "iwl-agn.h"
35#include "iwl-core.h" 34#include "iwl-core.h"
36#include "iwl-io.h" 35#include "iwl-io.h"
37#include "iwl-helpers.h" 36#include "iwl-helpers.h"
@@ -660,8 +659,7 @@ static void iwl_irq_handle_error(struct iwl_trans *trans)
660 iwl_dump_nic_event_log(trans, false, NULL, false); 659 iwl_dump_nic_event_log(trans, false, NULL, false);
661#ifdef CONFIG_IWLWIFI_DEBUG 660#ifdef CONFIG_IWLWIFI_DEBUG
662 if (iwl_get_debug_level(trans->shrd) & IWL_DL_FW_ERRORS) 661 if (iwl_get_debug_level(trans->shrd) & IWL_DL_FW_ERRORS)
663 iwl_print_rx_config_cmd(priv, 662 iwl_print_rx_config_cmd(priv(trans), IWL_RXON_CTX_BSS);
664 &priv->contexts[IWL_RXON_CTX_BSS]);
665#endif 663#endif
666 664
667 iwlagn_fw_error(priv, false); 665 iwlagn_fw_error(priv, false);
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
index 32314a60e2ac..ca686dbf5893 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans-tx-pcie.c
@@ -30,13 +30,19 @@
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/sched.h> 31#include <linux/sched.h>
32 32
33#include "iwl-agn.h" 33/* TODO: remove include to iwl-dev.h */
34#include "iwl-dev.h" 34#include "iwl-dev.h"
35#include "iwl-core.h" 35#include "iwl-debug.h"
36#include "iwl-csr.h"
37#include "iwl-prph.h"
36#include "iwl-io.h" 38#include "iwl-io.h"
39#include "iwl-agn-hw.h"
37#include "iwl-helpers.h" 40#include "iwl-helpers.h"
38#include "iwl-trans-int-pcie.h" 41#include "iwl-trans-int-pcie.h"
39 42
43#define IWL_TX_CRC_SIZE 4
44#define IWL_TX_DELIMITER_SIZE 4
45
40/** 46/**
41 * iwl_trans_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array 47 * iwl_trans_txq_update_byte_cnt_tbl - Set up entry in Tx byte-count array
42 */ 48 */
@@ -945,88 +951,6 @@ void iwl_tx_cmd_complete(struct iwl_trans *trans, struct iwl_rx_mem_buffer *rxb)
945 spin_unlock_irqrestore(&trans->hcmd_lock, flags); 951 spin_unlock_irqrestore(&trans->hcmd_lock, flags);
946} 952}
947 953
948const char *get_cmd_string(u8 cmd)
949{
950 switch (cmd) {
951 IWL_CMD(REPLY_ALIVE);
952 IWL_CMD(REPLY_ERROR);
953 IWL_CMD(REPLY_RXON);
954 IWL_CMD(REPLY_RXON_ASSOC);
955 IWL_CMD(REPLY_QOS_PARAM);
956 IWL_CMD(REPLY_RXON_TIMING);
957 IWL_CMD(REPLY_ADD_STA);
958 IWL_CMD(REPLY_REMOVE_STA);
959 IWL_CMD(REPLY_REMOVE_ALL_STA);
960 IWL_CMD(REPLY_TXFIFO_FLUSH);
961 IWL_CMD(REPLY_WEPKEY);
962 IWL_CMD(REPLY_TX);
963 IWL_CMD(REPLY_LEDS_CMD);
964 IWL_CMD(REPLY_TX_LINK_QUALITY_CMD);
965 IWL_CMD(COEX_PRIORITY_TABLE_CMD);
966 IWL_CMD(COEX_MEDIUM_NOTIFICATION);
967 IWL_CMD(COEX_EVENT_CMD);
968 IWL_CMD(REPLY_QUIET_CMD);
969 IWL_CMD(REPLY_CHANNEL_SWITCH);
970 IWL_CMD(CHANNEL_SWITCH_NOTIFICATION);
971 IWL_CMD(REPLY_SPECTRUM_MEASUREMENT_CMD);
972 IWL_CMD(SPECTRUM_MEASURE_NOTIFICATION);
973 IWL_CMD(POWER_TABLE_CMD);
974 IWL_CMD(PM_SLEEP_NOTIFICATION);
975 IWL_CMD(PM_DEBUG_STATISTIC_NOTIFIC);
976 IWL_CMD(REPLY_SCAN_CMD);
977 IWL_CMD(REPLY_SCAN_ABORT_CMD);
978 IWL_CMD(SCAN_START_NOTIFICATION);
979 IWL_CMD(SCAN_RESULTS_NOTIFICATION);
980 IWL_CMD(SCAN_COMPLETE_NOTIFICATION);
981 IWL_CMD(BEACON_NOTIFICATION);
982 IWL_CMD(REPLY_TX_BEACON);
983 IWL_CMD(WHO_IS_AWAKE_NOTIFICATION);
984 IWL_CMD(QUIET_NOTIFICATION);
985 IWL_CMD(REPLY_TX_PWR_TABLE_CMD);
986 IWL_CMD(MEASURE_ABORT_NOTIFICATION);
987 IWL_CMD(REPLY_BT_CONFIG);
988 IWL_CMD(REPLY_STATISTICS_CMD);
989 IWL_CMD(STATISTICS_NOTIFICATION);
990 IWL_CMD(REPLY_CARD_STATE_CMD);
991 IWL_CMD(CARD_STATE_NOTIFICATION);
992 IWL_CMD(MISSED_BEACONS_NOTIFICATION);
993 IWL_CMD(REPLY_CT_KILL_CONFIG_CMD);
994 IWL_CMD(SENSITIVITY_CMD);
995 IWL_CMD(REPLY_PHY_CALIBRATION_CMD);
996 IWL_CMD(REPLY_RX_PHY_CMD);
997 IWL_CMD(REPLY_RX_MPDU_CMD);
998 IWL_CMD(REPLY_RX);
999 IWL_CMD(REPLY_COMPRESSED_BA);
1000 IWL_CMD(CALIBRATION_CFG_CMD);
1001 IWL_CMD(CALIBRATION_RES_NOTIFICATION);
1002 IWL_CMD(CALIBRATION_COMPLETE_NOTIFICATION);
1003 IWL_CMD(REPLY_TX_POWER_DBM_CMD);
1004 IWL_CMD(TEMPERATURE_NOTIFICATION);
1005 IWL_CMD(TX_ANT_CONFIGURATION_CMD);
1006 IWL_CMD(REPLY_BT_COEX_PROFILE_NOTIF);
1007 IWL_CMD(REPLY_BT_COEX_PRIO_TABLE);
1008 IWL_CMD(REPLY_BT_COEX_PROT_ENV);
1009 IWL_CMD(REPLY_WIPAN_PARAMS);
1010 IWL_CMD(REPLY_WIPAN_RXON);
1011 IWL_CMD(REPLY_WIPAN_RXON_TIMING);
1012 IWL_CMD(REPLY_WIPAN_RXON_ASSOC);
1013 IWL_CMD(REPLY_WIPAN_QOS_PARAM);
1014 IWL_CMD(REPLY_WIPAN_WEPKEY);
1015 IWL_CMD(REPLY_WIPAN_P2P_CHANNEL_SWITCH);
1016 IWL_CMD(REPLY_WIPAN_NOA_NOTIFICATION);
1017 IWL_CMD(REPLY_WIPAN_DEACTIVATION_COMPLETE);
1018 IWL_CMD(REPLY_WOWLAN_PATTERNS);
1019 IWL_CMD(REPLY_WOWLAN_WAKEUP_FILTER);
1020 IWL_CMD(REPLY_WOWLAN_TSC_RSC_PARAMS);
1021 IWL_CMD(REPLY_WOWLAN_TKIP_PARAMS);
1022 IWL_CMD(REPLY_WOWLAN_KEK_KCK_MATERIAL);
1023 IWL_CMD(REPLY_WOWLAN_GET_STATUS);
1024 default:
1025 return "UNKNOWN";
1026
1027 }
1028}
1029
1030#define HOST_COMPLETE_TIMEOUT (2 * HZ) 954#define HOST_COMPLETE_TIMEOUT (2 * HZ)
1031 955
1032static void iwl_generic_cmd_callback(struct iwl_shared *shrd, 956static void iwl_generic_cmd_callback(struct iwl_shared *shrd,
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.c b/drivers/net/wireless/iwlwifi/iwl-trans.c
index 44e2f911f89b..3948d317bc19 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.c
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.c
@@ -65,14 +65,15 @@
65#include <linux/bitops.h> 65#include <linux/bitops.h>
66#include <linux/gfp.h> 66#include <linux/gfp.h>
67 67
68#include "iwl-dev.h"
69#include "iwl-trans.h" 68#include "iwl-trans.h"
70#include "iwl-core.h"
71#include "iwl-helpers.h"
72#include "iwl-trans-int-pcie.h" 69#include "iwl-trans-int-pcie.h"
73/*TODO remove uneeded includes when the transport layer tx_free will be here */ 70#include "iwl-csr.h"
74#include "iwl-agn.h" 71#include "iwl-prph.h"
75#include "iwl-shared.h" 72#include "iwl-shared.h"
73#include "iwl-eeprom.h"
74
75/* TODO: the transport layer should not include this */
76#include "iwl-core.h"
76 77
77static int iwl_trans_rx_alloc(struct iwl_trans *trans) 78static int iwl_trans_rx_alloc(struct iwl_trans *trans)
78{ 79{
diff --git a/drivers/net/wireless/iwlwifi/iwl-trans.h b/drivers/net/wireless/iwlwifi/iwl-trans.h
index 7a2daa886dfd..71a6fb05356a 100644
--- a/drivers/net/wireless/iwlwifi/iwl-trans.h
+++ b/drivers/net/wireless/iwlwifi/iwl-trans.h
@@ -73,10 +73,70 @@
73 * layer */ 73 * layer */
74 74
75struct iwl_priv; 75struct iwl_priv;
76struct iwl_rxon_context;
77struct iwl_host_cmd;
78struct iwl_shared; 76struct iwl_shared;
79struct iwl_device_cmd; 77
78#define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
79#define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
80#define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
81
82enum {
83 CMD_SYNC = 0,
84 CMD_ASYNC = BIT(0),
85 CMD_WANT_SKB = BIT(1),
86 CMD_ON_DEMAND = BIT(2),
87};
88
89#define DEF_CMD_PAYLOAD_SIZE 320
90
91/**
92 * struct iwl_device_cmd
93 *
94 * For allocation of the command and tx queues, this establishes the overall
95 * size of the largest command we send to uCode, except for commands that
96 * aren't fully copied and use other TFD space.
97 */
98struct iwl_device_cmd {
99 struct iwl_cmd_header hdr; /* uCode API */
100 union {
101 u32 flags;
102 u8 val8;
103 u16 val16;
104 u32 val32;
105 struct iwl_tx_cmd tx;
106 struct iwl6000_channel_switch_cmd chswitch;
107 u8 payload[DEF_CMD_PAYLOAD_SIZE];
108 } __packed cmd;
109} __packed;
110
111#define TFD_MAX_PAYLOAD_SIZE (sizeof(struct iwl_device_cmd))
112
113#define IWL_MAX_CMD_TFDS 2
114
115enum iwl_hcmd_dataflag {
116 IWL_HCMD_DFL_NOCOPY = BIT(0),
117};
118
119/**
120 * struct iwl_host_cmd - Host command to the uCode
121 * @data: array of chunks that composes the data of the host command
122 * @reply_page: pointer to the page that holds the response to the host command
123 * @callback:
124 * @flags: can be CMD_* note CMD_WANT_SKB is incompatible withe CMD_ASYNC
125 * @len: array of the lenths of the chunks in data
126 * @dataflags:
127 * @id: id of the host command
128 */
129struct iwl_host_cmd {
130 const void *data[IWL_MAX_CMD_TFDS];
131 unsigned long reply_page;
132 void (*callback)(struct iwl_shared *shrd,
133 struct iwl_device_cmd *cmd,
134 struct iwl_rx_packet *pkt);
135 u32 flags;
136 u16 len[IWL_MAX_CMD_TFDS];
137 u8 dataflags[IWL_MAX_CMD_TFDS];
138 u8 id;
139};
80 140
81/** 141/**
82 * struct iwl_trans_ops - transport specific operations 142 * struct iwl_trans_ops - transport specific operations