aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h
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/net/wireless/iwlwifi/iwl-trans-int-pcie.h
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/net/wireless/iwlwifi/iwl-trans-int-pcie.h')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-trans-int-pcie.h92
1 files changed, 92 insertions, 0 deletions
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