diff options
author | Winkler, Tomas <tomas.winkler@intel.com> | 2008-12-21 22:31:23 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-01-29 15:59:27 -0500 |
commit | 51af3d3fbbe326077a7e245268a7de325de6ecd2 (patch) | |
tree | 5cf3010f1cdd86d58f0b234be9eb8fa65d032fc9 /drivers/net | |
parent | e52119c50d6a35506b1c063eeacf7acc40b4e03d (diff) |
iwl3945: use rx queue management infrastructure from iwlcore
This patch uses rx queue alloc free and reset function from iwlcore.
This should fix the regression reported by Kalle Valo.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl3945-base.c | 81 |
3 files changed, 3 insertions, 85 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.c b/drivers/net/wireless/iwlwifi/iwl-3945.c index 0260545e356f..d4ee15ed5e4c 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945.c | |||
@@ -1202,13 +1202,13 @@ int iwl3945_hw_nic_init(struct iwl_priv *priv) | |||
1202 | 1202 | ||
1203 | /* Allocate the RX queue, or reset if it is already allocated */ | 1203 | /* Allocate the RX queue, or reset if it is already allocated */ |
1204 | if (!rxq->bd) { | 1204 | if (!rxq->bd) { |
1205 | rc = iwl3945_rx_queue_alloc(priv); | 1205 | rc = iwl_rx_queue_alloc(priv); |
1206 | if (rc) { | 1206 | if (rc) { |
1207 | IWL_ERR(priv, "Unable to initialize Rx queue\n"); | 1207 | IWL_ERR(priv, "Unable to initialize Rx queue\n"); |
1208 | return -ENOMEM; | 1208 | return -ENOMEM; |
1209 | } | 1209 | } |
1210 | } else | 1210 | } else |
1211 | iwl3945_rx_queue_reset(priv, rxq); | 1211 | iwl_rx_queue_reset(priv, rxq); |
1212 | 1212 | ||
1213 | iwl3945_rx_replenish(priv); | 1213 | iwl3945_rx_replenish(priv); |
1214 | 1214 | ||
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945.h b/drivers/net/wireless/iwlwifi/iwl-3945.h index e584032a1a3d..c5f5481edb35 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945.h +++ b/drivers/net/wireless/iwlwifi/iwl-3945.h | |||
@@ -213,9 +213,6 @@ extern u8 iwl3945_add_station(struct iwl_priv *priv, const u8 *bssid, | |||
213 | int is_ap, u8 flags); | 213 | int is_ap, u8 flags); |
214 | extern int iwl3945_power_init_handle(struct iwl_priv *priv); | 214 | extern int iwl3945_power_init_handle(struct iwl_priv *priv); |
215 | extern int iwl3945_eeprom_init(struct iwl_priv *priv); | 215 | extern int iwl3945_eeprom_init(struct iwl_priv *priv); |
216 | extern int iwl3945_rx_queue_alloc(struct iwl_priv *priv); | ||
217 | extern void iwl3945_rx_queue_reset(struct iwl_priv *priv, | ||
218 | struct iwl_rx_queue *rxq); | ||
219 | extern int iwl3945_calc_db_from_ratio(int sig_ratio); | 216 | extern int iwl3945_calc_db_from_ratio(int sig_ratio); |
220 | extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm); | 217 | extern int iwl3945_calc_sig_qual(int rssi_dbm, int noise_dbm); |
221 | extern int iwl3945_tx_queue_init(struct iwl_priv *priv, | 218 | extern int iwl3945_tx_queue_init(struct iwl_priv *priv, |
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c index 0059d2889314..a176f42fd7cf 100644 --- a/drivers/net/wireless/iwlwifi/iwl3945-base.c +++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c | |||
@@ -3186,7 +3186,6 @@ static void iwl3945_tx_cmd_complete(struct iwl_priv *priv, | |||
3186 | * | 3186 | * |
3187 | * Driver sequence: | 3187 | * Driver sequence: |
3188 | * | 3188 | * |
3189 | * iwl3945_rx_queue_alloc() Allocates rx_free | ||
3190 | * iwl3945_rx_replenish() Replenishes rx_free list from rx_used, and calls | 3189 | * iwl3945_rx_replenish() Replenishes rx_free list from rx_used, and calls |
3191 | * iwl3945_rx_queue_restock | 3190 | * iwl3945_rx_queue_restock |
3192 | * iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx | 3191 | * iwl3945_rx_queue_restock() Moves available buffers from rx_free into Rx |
@@ -3405,84 +3404,6 @@ void iwl3945_rx_replenish(void *data) | |||
3405 | spin_unlock_irqrestore(&priv->lock, flags); | 3404 | spin_unlock_irqrestore(&priv->lock, flags); |
3406 | } | 3405 | } |
3407 | 3406 | ||
3408 | /* Assumes that the skb field of the buffers in 'pool' is kept accurate. | ||
3409 | * If an SKB has been detached, the POOL needs to have its SKB set to NULL | ||
3410 | * This free routine walks the list of POOL entries and if SKB is set to | ||
3411 | * non NULL it is unmapped and freed | ||
3412 | */ | ||
3413 | static void iwl3945_rx_queue_free(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | ||
3414 | { | ||
3415 | int i; | ||
3416 | for (i = 0; i < RX_QUEUE_SIZE + RX_FREE_BUFFERS; i++) { | ||
3417 | if (rxq->pool[i].skb != NULL) { | ||
3418 | pci_unmap_single(priv->pci_dev, | ||
3419 | rxq->pool[i].real_dma_addr, | ||
3420 | IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | ||
3421 | dev_kfree_skb(rxq->pool[i].skb); | ||
3422 | } | ||
3423 | } | ||
3424 | |||
3425 | pci_free_consistent(priv->pci_dev, 4 * RX_QUEUE_SIZE, rxq->bd, | ||
3426 | rxq->dma_addr); | ||
3427 | rxq->bd = NULL; | ||
3428 | } | ||
3429 | |||
3430 | int iwl3945_rx_queue_alloc(struct iwl_priv *priv) | ||
3431 | { | ||
3432 | struct iwl_rx_queue *rxq = &priv->rxq; | ||
3433 | struct pci_dev *dev = priv->pci_dev; | ||
3434 | int i; | ||
3435 | |||
3436 | spin_lock_init(&rxq->lock); | ||
3437 | INIT_LIST_HEAD(&rxq->rx_free); | ||
3438 | INIT_LIST_HEAD(&rxq->rx_used); | ||
3439 | |||
3440 | /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ | ||
3441 | rxq->bd = pci_alloc_consistent(dev, 4 * RX_QUEUE_SIZE, &rxq->dma_addr); | ||
3442 | if (!rxq->bd) | ||
3443 | return -ENOMEM; | ||
3444 | |||
3445 | /* Fill the rx_used queue with _all_ of the Rx buffers */ | ||
3446 | for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) | ||
3447 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | ||
3448 | |||
3449 | /* Set us so that we have processed and used all buffers, but have | ||
3450 | * not restocked the Rx queue with fresh buffers */ | ||
3451 | rxq->read = rxq->write = 0; | ||
3452 | rxq->free_count = 0; | ||
3453 | rxq->need_update = 0; | ||
3454 | return 0; | ||
3455 | } | ||
3456 | |||
3457 | void iwl3945_rx_queue_reset(struct iwl_priv *priv, struct iwl_rx_queue *rxq) | ||
3458 | { | ||
3459 | unsigned long flags; | ||
3460 | int i; | ||
3461 | spin_lock_irqsave(&rxq->lock, flags); | ||
3462 | INIT_LIST_HEAD(&rxq->rx_free); | ||
3463 | INIT_LIST_HEAD(&rxq->rx_used); | ||
3464 | /* Fill the rx_used queue with _all_ of the Rx buffers */ | ||
3465 | for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) { | ||
3466 | /* In the reset function, these buffers may have been allocated | ||
3467 | * to an SKB, so we need to unmap and free potential storage */ | ||
3468 | if (rxq->pool[i].skb != NULL) { | ||
3469 | pci_unmap_single(priv->pci_dev, | ||
3470 | rxq->pool[i].real_dma_addr, | ||
3471 | IWL_RX_BUF_SIZE, PCI_DMA_FROMDEVICE); | ||
3472 | priv->alloc_rxb_skb--; | ||
3473 | dev_kfree_skb(rxq->pool[i].skb); | ||
3474 | rxq->pool[i].skb = NULL; | ||
3475 | } | ||
3476 | list_add_tail(&rxq->pool[i].list, &rxq->rx_used); | ||
3477 | } | ||
3478 | |||
3479 | /* Set us so that we have processed and used all buffers, but have | ||
3480 | * not restocked the Rx queue with fresh buffers */ | ||
3481 | rxq->read = rxq->write = 0; | ||
3482 | rxq->free_count = 0; | ||
3483 | spin_unlock_irqrestore(&rxq->lock, flags); | ||
3484 | } | ||
3485 | |||
3486 | /* Convert linear signal-to-noise ratio into dB */ | 3407 | /* Convert linear signal-to-noise ratio into dB */ |
3487 | static u8 ratio2dB[100] = { | 3408 | static u8 ratio2dB[100] = { |
3488 | /* 0 1 2 3 4 5 6 7 8 9 */ | 3409 | /* 0 1 2 3 4 5 6 7 8 9 */ |
@@ -7731,7 +7652,7 @@ static void __devexit iwl3945_pci_remove(struct pci_dev *pdev) | |||
7731 | iwl3945_dealloc_ucode_pci(priv); | 7652 | iwl3945_dealloc_ucode_pci(priv); |
7732 | 7653 | ||
7733 | if (priv->rxq.bd) | 7654 | if (priv->rxq.bd) |
7734 | iwl3945_rx_queue_free(priv, &priv->rxq); | 7655 | iwl_rx_queue_free(priv, &priv->rxq); |
7735 | iwl3945_hw_txq_ctx_free(priv); | 7656 | iwl3945_hw_txq_ctx_free(priv); |
7736 | 7657 | ||
7737 | iwl3945_unset_hw_params(priv); | 7658 | iwl3945_unset_hw_params(priv); |