aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAbhijeet Kolekar <abhijeet.kolekar@intel.com>2009-03-11 14:17:57 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-03-16 18:09:46 -0400
commit732587ab438d7528e38df7ceb2c46db9774dcf08 (patch)
treecf8c30141af23e159bf59448ef10873bb4625857
parentdd5b687edacab6cfacf7b9983e86a60c0612e994 (diff)
iwl3945: use iwl_tx_cmd_complete
iwl3945 uses iwl_tx_cmd_complete to reclaim the unused buffers of the queue. iwl_tx_cmd_complete in turn call the iwl_hcmd_queue_reclaim which will unmap the dma mapping to tx_cmd and frees the memory. Signed-off-by: Abhijeet Kolekar <abhijeet.kolekar@intel.com> Signed-off-by: Reinette Chatre <reinette.chatre@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c81
1 files changed, 1 insertions, 80 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index ae4c89625e5a..4465320f2735 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -1479,85 +1479,6 @@ static void iwl3945_setup_rx_handlers(struct iwl_priv *priv)
1479 iwl3945_hw_rx_handler_setup(priv); 1479 iwl3945_hw_rx_handler_setup(priv);
1480} 1480}
1481 1481
1482/**
1483 * iwl3945_cmd_queue_reclaim - Reclaim CMD queue entries
1484 * When FW advances 'R' index, all entries between old and new 'R' index
1485 * need to be reclaimed.
1486 */
1487static void iwl3945_cmd_queue_reclaim(struct iwl_priv *priv,
1488 int txq_id, int index)
1489{
1490 struct iwl_tx_queue *txq = &priv->txq[txq_id];
1491 struct iwl_queue *q = &txq->q;
1492 int nfreed = 0;
1493
1494 if ((index >= q->n_bd) || (iwl_queue_used(q, index) == 0)) {
1495 IWL_ERR(priv, "Read index for DMA queue txq id (%d), index %d, "
1496 "is out of range [0-%d] %d %d.\n", txq_id,
1497 index, q->n_bd, q->write_ptr, q->read_ptr);
1498 return;
1499 }
1500
1501 for (index = iwl_queue_inc_wrap(index, q->n_bd); q->read_ptr != index;
1502 q->read_ptr = iwl_queue_inc_wrap(q->read_ptr, q->n_bd)) {
1503 if (nfreed > 1) {
1504 IWL_ERR(priv, "HCMD skipped: index (%d) %d %d\n", index,
1505 q->write_ptr, q->read_ptr);
1506 queue_work(priv->workqueue, &priv->restart);
1507 break;
1508 }
1509 nfreed++;
1510 }
1511}
1512
1513
1514/**
1515 * iwl3945_tx_cmd_complete - Pull unused buffers off the queue and reclaim them
1516 * @rxb: Rx buffer to reclaim
1517 *
1518 * If an Rx buffer has an async callback associated with it the callback
1519 * will be executed. The attached skb (if present) will only be freed
1520 * if the callback returns 1
1521 */
1522static void iwl3945_tx_cmd_complete(struct iwl_priv *priv,
1523 struct iwl_rx_mem_buffer *rxb)
1524{
1525 struct iwl_rx_packet *pkt = (struct iwl_rx_packet *)rxb->skb->data;
1526 u16 sequence = le16_to_cpu(pkt->hdr.sequence);
1527 int txq_id = SEQ_TO_QUEUE(sequence);
1528 int index = SEQ_TO_INDEX(sequence);
1529 int huge = !!(pkt->hdr.sequence & SEQ_HUGE_FRAME);
1530 int cmd_index;
1531 struct iwl_cmd *cmd;
1532
1533 if (WARN(txq_id != IWL_CMD_QUEUE_NUM,
1534 "wrong command queue %d, sequence 0x%X readp=%d writep=%d\n",
1535 txq_id, sequence,
1536 priv->txq[IWL_CMD_QUEUE_NUM].q.read_ptr,
1537 priv->txq[IWL_CMD_QUEUE_NUM].q.write_ptr)) {
1538 iwl_print_hex_dump(priv, IWL_DL_INFO , rxb, 32);
1539 return;
1540 }
1541
1542 cmd_index = get_cmd_index(&priv->txq[IWL_CMD_QUEUE_NUM].q, index, huge);
1543 cmd = priv->txq[IWL_CMD_QUEUE_NUM].cmd[cmd_index];
1544
1545 /* Input error checking is done when commands are added to queue. */
1546 if (cmd->meta.flags & CMD_WANT_SKB) {
1547 cmd->meta.source->u.skb = rxb->skb;
1548 rxb->skb = NULL;
1549 } else if (cmd->meta.u.callback &&
1550 !cmd->meta.u.callback(priv, cmd, rxb->skb))
1551 rxb->skb = NULL;
1552
1553 iwl3945_cmd_queue_reclaim(priv, txq_id, index);
1554
1555 if (!(cmd->meta.flags & CMD_ASYNC)) {
1556 clear_bit(STATUS_HCMD_ACTIVE, &priv->status);
1557 wake_up_interruptible(&priv->wait_command_queue);
1558 }
1559}
1560
1561/************************** RX-FUNCTIONS ****************************/ 1482/************************** RX-FUNCTIONS ****************************/
1562/* 1483/*
1563 * Rx theory of operation 1484 * Rx theory of operation
@@ -1917,7 +1838,7 @@ static void iwl3945_rx_handle(struct iwl_priv *priv)
1917 * fire off the (possibly) blocking iwl_send_cmd() 1838 * fire off the (possibly) blocking iwl_send_cmd()
1918 * as we reclaim the driver command queue */ 1839 * as we reclaim the driver command queue */
1919 if (rxb && rxb->skb) 1840 if (rxb && rxb->skb)
1920 iwl3945_tx_cmd_complete(priv, rxb); 1841 iwl_tx_cmd_complete(priv, rxb);
1921 else 1842 else
1922 IWL_WARN(priv, "Claim null rxb?\n"); 1843 IWL_WARN(priv, "Claim null rxb?\n");
1923 } 1844 }