diff options
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl3945-base.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 40 |
1 files changed, 17 insertions, 23 deletions
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; |