aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/iwlwifi')
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-fh.h12
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945-hw.h11
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.c19
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-3945.h8
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h13
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c40
6 files changed, 46 insertions, 57 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-fh.h b/drivers/net/wireless/iwlwifi/iwl-3945-fh.h
index bbcd0cefc724..53ed24942a07 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-fh.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-fh.h
@@ -172,7 +172,17 @@
172 172
173#define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000) 173#define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE (0x01000000)
174 174
175#define TFD_QUEUE_SIZE_MAX (256) 175struct iwl3945_tfd_tb {
176 __le32 addr;
177 __le32 len;
178} __attribute__ ((packed));
179
180struct iwl3945_tfd {
181 __le32 control_flags;
182 struct iwl3945_tfd_tb tbs[4];
183 u8 __pad[28];
184} __attribute__ ((packed));
185
176 186
177#endif /* __iwl_3945_fh_h__ */ 187#endif /* __iwl_3945_fh_h__ */
178 188
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
index fc1b774c806b..1ba59dfacd1b 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945-hw.h
@@ -304,17 +304,6 @@ struct iwl3945_shared {
304 __le32 tx_base_ptr[8]; 304 __le32 tx_base_ptr[8];
305} __attribute__ ((packed)); 305} __attribute__ ((packed));
306 306
307struct iwl3945_tfd_frame_data {
308 __le32 addr;
309 __le32 len;
310} __attribute__ ((packed));
311
312struct iwl3945_tfd_frame {
313 __le32 control_flags;
314 struct iwl3945_tfd_frame_data pa[4];
315 u8 reserved[28];
316} __attribute__ ((packed));
317
318static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags) 307static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags)
319{ 308{
320 return le16_to_cpu(rate_n_flags) & 0xFF; 309 return le16_to_cpu(rate_n_flags) & 0xFF;
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c
index cb864449c397..6810909f3fef 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.c
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.c
@@ -38,6 +38,7 @@
38#include <asm/unaligned.h> 38#include <asm/unaligned.h>
39#include <net/mac80211.h> 39#include <net/mac80211.h>
40 40
41#include "iwl-fh.h"
41#include "iwl-3945-fh.h" 42#include "iwl-3945-fh.h"
42#include "iwl-commands.h" 43#include "iwl-commands.h"
43#include "iwl-3945.h" 44#include "iwl-3945.h"
@@ -307,7 +308,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
307{ 308{
308 struct iwl3945_tx_queue *txq = &priv->txq39[txq_id]; 309 struct iwl3945_tx_queue *txq = &priv->txq39[txq_id];
309 struct iwl_queue *q = &txq->q; 310 struct iwl_queue *q = &txq->q;
310 struct iwl3945_tx_info *tx_info; 311 struct iwl_tx_info *tx_info;
311 312
312 BUG_ON(txq_id == IWL_CMD_QUEUE_NUM); 313 BUG_ON(txq_id == IWL_CMD_QUEUE_NUM);
313 314
@@ -728,7 +729,7 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
728{ 729{
729 int count; 730 int count;
730 u32 pad; 731 u32 pad;
731 struct iwl3945_tfd_frame *tfd = (struct iwl3945_tfd_frame *)ptr; 732 struct iwl3945_tfd *tfd = (struct iwl3945_tfd *)ptr;
732 733
733 count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags)); 734 count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
734 pad = TFD_CTL_PAD_GET(le32_to_cpu(tfd->control_flags)); 735 pad = TFD_CTL_PAD_GET(le32_to_cpu(tfd->control_flags));
@@ -739,8 +740,8 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
739 return -EINVAL; 740 return -EINVAL;
740 } 741 }
741 742
742 tfd->pa[count].addr = cpu_to_le32(addr); 743 tfd->tbs[count].addr = cpu_to_le32(addr);
743 tfd->pa[count].len = cpu_to_le32(len); 744 tfd->tbs[count].len = cpu_to_le32(len);
744 745
745 count++; 746 count++;
746 747
@@ -757,8 +758,8 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
757 */ 758 */
758int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq) 759int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
759{ 760{
760 struct iwl3945_tfd_frame *bd_tmp = (struct iwl3945_tfd_frame *)&txq->bd[0]; 761 struct iwl3945_tfd *tfd_tmp = (struct iwl3945_tfd *)&txq->tfds[0];
761 struct iwl3945_tfd_frame *bd = &bd_tmp[txq->q.read_ptr]; 762 struct iwl3945_tfd *tfd = &tfd_tmp[txq->q.read_ptr];
762 struct pci_dev *dev = priv->pci_dev; 763 struct pci_dev *dev = priv->pci_dev;
763 int i; 764 int i;
764 int counter; 765 int counter;
@@ -769,7 +770,7 @@ int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
769 return 0; 770 return 0;
770 771
771 /* sanity check */ 772 /* sanity check */
772 counter = TFD_CTL_COUNT_GET(le32_to_cpu(bd->control_flags)); 773 counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
773 if (counter > NUM_TFD_CHUNKS) { 774 if (counter > NUM_TFD_CHUNKS) {
774 IWL_ERR(priv, "Too many chunks: %i\n", counter); 775 IWL_ERR(priv, "Too many chunks: %i\n", counter);
775 /* @todo issue fatal error, it is quite serious situation */ 776 /* @todo issue fatal error, it is quite serious situation */
@@ -779,8 +780,8 @@ int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
779 /* unmap chunks if any */ 780 /* unmap chunks if any */
780 781
781 for (i = 1; i < counter; i++) { 782 for (i = 1; i < counter; i++) {
782 pci_unmap_single(dev, le32_to_cpu(bd->pa[i].addr), 783 pci_unmap_single(dev, le32_to_cpu(tfd->tbs[i].addr),
783 le32_to_cpu(bd->pa[i].len), PCI_DMA_TODEVICE); 784 le32_to_cpu(tfd->tbs[i].len), PCI_DMA_TODEVICE);
784 if (txq->txb[txq->q.read_ptr].skb[0]) { 785 if (txq->txb[txq->q.read_ptr].skb[0]) {
785 struct sk_buff *skb = txq->txb[txq->q.read_ptr].skb[0]; 786 struct sk_buff *skb = txq->txb[txq->q.read_ptr].skb[0];
786 if (txq->txb[txq->q.read_ptr].skb[0]) { 787 if (txq->txb[txq->q.read_ptr].skb[0]) {
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h
index aff6a3a53898..716c4b462335 100644
--- a/drivers/net/wireless/iwlwifi/iwl-3945.h
+++ b/drivers/net/wireless/iwlwifi/iwl-3945.h
@@ -45,6 +45,7 @@ extern struct pci_device_id iwl3945_hw_card_ids[];
45 45
46#include "iwl-csr.h" 46#include "iwl-csr.h"
47#include "iwl-prph.h" 47#include "iwl-prph.h"
48#include "iwl-fh.h"
48#include "iwl-3945-hw.h" 49#include "iwl-3945-hw.h"
49#include "iwl-debug.h" 50#include "iwl-debug.h"
50#include "iwl-power.h" 51#include "iwl-power.h"
@@ -107,13 +108,6 @@ enum iwl3945_antenna {
107 108
108int iwl3945_x2_queue_used(const struct iwl_queue *q, int i); 109int iwl3945_x2_queue_used(const struct iwl_queue *q, int i);
109 110
110#define MAX_NUM_OF_TBS (20)
111
112/* One for each TFD */
113struct iwl3945_tx_info {
114 struct sk_buff *skb[MAX_NUM_OF_TBS];
115};
116
117#include "iwl-agn-rs.h" 111#include "iwl-agn-rs.h"
118 112
119#define IWL_TX_FIFO_AC0 0 113#define IWL_TX_FIFO_AC0 0
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index 8981c054a4cb..1ad4d084e357 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -36,14 +36,15 @@
36#include <linux/kernel.h> 36#include <linux/kernel.h>
37#include <net/ieee80211_radiotap.h> 37#include <net/ieee80211_radiotap.h>
38 38
39#include "iwl-rfkill.h"
40#include "iwl-eeprom.h" 39#include "iwl-eeprom.h"
41#include "iwl-4965-hw.h"
42#include "iwl-3945-hw.h"
43#include "iwl-3945-led.h"
44#include "iwl-csr.h" 40#include "iwl-csr.h"
45#include "iwl-prph.h" 41#include "iwl-prph.h"
42#include "iwl-fh.h"
46#include "iwl-debug.h" 43#include "iwl-debug.h"
44#include "iwl-rfkill.h"
45#include "iwl-4965-hw.h"
46#include "iwl-3945-hw.h"
47#include "iwl-3945-led.h"
47#include "iwl-led.h" 48#include "iwl-led.h"
48#include "iwl-power.h" 49#include "iwl-power.h"
49#include "iwl-agn-rs.h" 50#include "iwl-agn-rs.h"
@@ -239,10 +240,10 @@ struct iwl_channel_info {
239 */ 240 */
240struct iwl3945_tx_queue { 241struct iwl3945_tx_queue {
241 struct iwl_queue q; 242 struct iwl_queue q;
242 struct iwl3945_tfd_frame *bd; 243 struct iwl3945_tfd *tfds;
243 struct iwl_cmd *cmd; 244 struct iwl_cmd *cmd;
244 dma_addr_t dma_addr_cmd; 245 dma_addr_t dma_addr_cmd;
245 struct iwl3945_tx_info *txb; 246 struct iwl_tx_info *txb;
246 int need_update; 247 int need_update;
247 int active; 248 int active;
248}; 249};
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 207d55bea5fa..c37fa00af6d7 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -48,9 +48,10 @@
48 48
49#define DRV_NAME "iwl3945" 49#define DRV_NAME "iwl3945"
50 50
51#include "iwl-fh.h"
52#include "iwl-3945-fh.h"
51#include "iwl-commands.h" 53#include "iwl-commands.h"
52#include "iwl-3945.h" 54#include "iwl-3945.h"
53#include "iwl-3945-fh.h"
54#include "iwl-helpers.h" 55#include "iwl-helpers.h"
55#include "iwl-core.h" 56#include "iwl-core.h"
56#include "iwl-dev.h" 57#include "iwl-dev.h"
@@ -180,13 +181,13 @@ static int iwl3945_tx_queue_alloc(struct iwl_priv *priv,
180 181
181 /* Circular buffer of transmit frame descriptors (TFDs), 182 /* Circular buffer of transmit frame descriptors (TFDs),
182 * shared with device */ 183 * shared with device */
183 txq->bd = pci_alloc_consistent(dev, 184 txq->tfds = pci_alloc_consistent(dev,
184 sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX, 185 sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX,
185 &txq->q.dma_addr); 186 &txq->q.dma_addr);
186 187
187 if (!txq->bd) { 188 if (!txq->tfds) {
188 IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n", 189 IWL_ERR(priv, "pci_alloc_consistent(%zd) failed\n",
189 sizeof(txq->bd[0]) * TFD_QUEUE_SIZE_MAX); 190 sizeof(txq->tfds[0]) * TFD_QUEUE_SIZE_MAX);
190 goto error; 191 goto error;
191 } 192 }
192 txq->q.id = id; 193 txq->q.id = id;
@@ -278,8 +279,8 @@ void iwl3945_tx_queue_free(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
278 279
279 /* De-alloc circular buffer of TFDs */ 280 /* De-alloc circular buffer of TFDs */
280 if (txq->q.n_bd) 281 if (txq->q.n_bd)
281 pci_free_consistent(dev, sizeof(struct iwl3945_tfd_frame) * 282 pci_free_consistent(dev, sizeof(struct iwl3945_tfd) *
282 txq->q.n_bd, txq->bd, txq->q.dma_addr); 283 txq->q.n_bd, txq->tfds, txq->q.dma_addr);
283 284
284 /* De-alloc array of per-TFD driver data */ 285 /* De-alloc array of per-TFD driver data */
285 kfree(txq->txb); 286 kfree(txq->txb);
@@ -445,14 +446,12 @@ static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
445{ 446{
446 struct iwl3945_tx_queue *txq = &priv->txq39[IWL_CMD_QUEUE_NUM]; 447 struct iwl3945_tx_queue *txq = &priv->txq39[IWL_CMD_QUEUE_NUM];
447 struct iwl_queue *q = &txq->q; 448 struct iwl_queue *q = &txq->q;
448 struct iwl3945_tfd_frame *tfd; 449 struct iwl3945_tfd *tfd;
449 u32 *control_flags;
450 struct iwl_cmd *out_cmd; 450 struct iwl_cmd *out_cmd;
451 u32 idx; 451 u32 idx;
452 u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr)); 452 u16 fix_size = (u16)(cmd->len + sizeof(out_cmd->hdr));
453 dma_addr_t phys_addr; 453 dma_addr_t phys_addr;
454 int pad; 454 int pad;
455 u16 count;
456 int ret; 455 int ret;
457 unsigned long flags; 456 unsigned long flags;
458 457
@@ -475,11 +474,9 @@ static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
475 474
476 spin_lock_irqsave(&priv->hcmd_lock, flags); 475 spin_lock_irqsave(&priv->hcmd_lock, flags);
477 476
478 tfd = &txq->bd[q->write_ptr]; 477 tfd = &txq->tfds[q->write_ptr];
479 memset(tfd, 0, sizeof(*tfd)); 478 memset(tfd, 0, sizeof(*tfd));
480 479
481 control_flags = (u32 *) tfd;
482
483 idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE); 480 idx = get_cmd_index(q, q->write_ptr, cmd->meta.flags & CMD_SIZE_HUGE);
484 out_cmd = &txq->cmd[idx]; 481 out_cmd = &txq->cmd[idx];
485 482
@@ -501,8 +498,7 @@ static int iwl3945_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
501 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size); 498 iwl3945_hw_txq_attach_buf_to_tfd(priv, tfd, phys_addr, fix_size);
502 499
503 pad = U32_PAD(cmd->len); 500 pad = U32_PAD(cmd->len);
504 count = TFD_CTL_COUNT_GET(*control_flags); 501 tfd->control_flags |= cpu_to_le32(TFD_CTL_PAD_SET(pad));
505 *control_flags = TFD_CTL_COUNT_SET(count) | TFD_CTL_PAD_SET(pad);
506 502
507 IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, " 503 IWL_DEBUG_HC("Sending command %s (#%x), seq: 0x%04X, "
508 "%d bytes at %d[%d]:%d\n", 504 "%d bytes at %d[%d]:%d\n",
@@ -2231,8 +2227,7 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
2231{ 2227{
2232 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data; 2228 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *)skb->data;
2233 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 2229 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
2234 struct iwl3945_tfd_frame *tfd; 2230 struct iwl3945_tfd *tfd;
2235 u32 *control_flags;
2236 int txq_id = skb_get_queue_mapping(skb); 2231 int txq_id = skb_get_queue_mapping(skb);
2237 struct iwl3945_tx_queue *txq = NULL; 2232 struct iwl3945_tx_queue *txq = NULL;
2238 struct iwl_queue *q = NULL; 2233 struct iwl_queue *q = NULL;
@@ -2317,13 +2312,12 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
2317 spin_lock_irqsave(&priv->lock, flags); 2312 spin_lock_irqsave(&priv->lock, flags);
2318 2313
2319 /* Set up first empty TFD within this queue's circular TFD buffer */ 2314 /* Set up first empty TFD within this queue's circular TFD buffer */
2320 tfd = &txq->bd[q->write_ptr]; 2315 tfd = &txq->tfds[q->write_ptr];
2321 memset(tfd, 0, sizeof(*tfd)); 2316 memset(tfd, 0, sizeof(*tfd));
2322 control_flags = (u32 *) tfd;
2323 idx = get_cmd_index(q, q->write_ptr, 0); 2317 idx = get_cmd_index(q, q->write_ptr, 0);
2324 2318
2325 /* Set up driver data for this TFD */ 2319 /* Set up driver data for this TFD */
2326 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl3945_tx_info)); 2320 memset(&(txq->txb[q->write_ptr]), 0, sizeof(struct iwl_tx_info));
2327 txq->txb[q->write_ptr].skb[0] = skb; 2321 txq->txb[q->write_ptr].skb[0] = skb;
2328 2322
2329 /* Init first empty entry in queue's array of Tx/cmd buffers */ 2323 /* Init first empty entry in queue's array of Tx/cmd buffers */
@@ -2387,12 +2381,12 @@ static int iwl3945_tx_skb(struct iwl_priv *priv, struct sk_buff *skb)
2387 2381
2388 if (!len) 2382 if (!len)
2389 /* If there is no payload, then we use only one Tx buffer */ 2383 /* If there is no payload, then we use only one Tx buffer */
2390 *control_flags = TFD_CTL_COUNT_SET(1); 2384 tfd->control_flags = cpu_to_le32(TFD_CTL_COUNT_SET(1));
2391 else 2385 else
2392 /* Else use 2 buffers. 2386 /* Else use 2 buffers.
2393 * Tell 3945 about any padding after MAC header */ 2387 * Tell 3945 about any padding after MAC header */
2394 *control_flags = TFD_CTL_COUNT_SET(2) | 2388 tfd->control_flags = cpu_to_le32(TFD_CTL_COUNT_SET(2) |
2395 TFD_CTL_PAD_SET(U32_PAD(len)); 2389 TFD_CTL_PAD_SET(U32_PAD(len)));
2396 2390
2397 /* Total # bytes to be transmitted */ 2391 /* Total # bytes to be transmitted */
2398 len = (u16)skb->len; 2392 len = (u16)skb->len;