aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlegacy/3945-mac.c
diff options
context:
space:
mode:
authorStanislaw Gruszka <sgruszka@redhat.com>2013-02-13 09:49:08 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-02-14 14:24:07 -0500
commitbdb084b22d8aee66c87af5e9c36bd6cf7f3bccfd (patch)
tree62cdfe1e5a6a6a71b43b7580338837661e579cf0 /drivers/net/wireless/iwlegacy/3945-mac.c
parent4ea545d476d3182056aeb042c439237ed61d261e (diff)
iwlegacy: more checks for dma mapping errors
This patch check output of pci_map_single() calls. I missed them on my previous patch "iwlegacy: check for dma mapping errors", which fixed only pci_map_page() calls. To handle remaining possible dma mappings errors, we need to rearrange ilXXXX_tx_skb() and il_enqueue_hcmd() functions. Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlegacy/3945-mac.c')
-rw-r--r--drivers/net/wireless/iwlegacy/3945-mac.c51
1 files changed, 27 insertions, 24 deletions
diff --git a/drivers/net/wireless/iwlegacy/3945-mac.c b/drivers/net/wireless/iwlegacy/3945-mac.c
index 83856d1a6101..3630a41df50d 100644
--- a/drivers/net/wireless/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/iwlegacy/3945-mac.c
@@ -572,26 +572,11 @@ il3945_tx_skb(struct il_priv *il,
572 il3945_hw_build_tx_cmd_rate(il, out_cmd, info, hdr, sta_id); 572 il3945_hw_build_tx_cmd_rate(il, out_cmd, info, hdr, sta_id);
573 573
574 /* Total # bytes to be transmitted */ 574 /* Total # bytes to be transmitted */
575 len = (u16) skb->len; 575 tx_cmd->len = cpu_to_le16((u16) skb->len);
576 tx_cmd->len = cpu_to_le16(len);
577 576
578 il_update_stats(il, true, fc, len);
579 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK; 577 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK;
580 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK; 578 tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK;
581 579
582 if (!ieee80211_has_morefrags(hdr->frame_control)) {
583 txq->need_update = 1;
584 } else {
585 wait_write_ptr = 1;
586 txq->need_update = 0;
587 }
588
589 D_TX("sequence nr = 0X%x\n", le16_to_cpu(out_cmd->hdr.sequence));
590 D_TX("tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags));
591 il_print_hex_dump(il, IL_DL_TX, tx_cmd, sizeof(*tx_cmd));
592 il_print_hex_dump(il, IL_DL_TX, (u8 *) tx_cmd->hdr,
593 ieee80211_hdrlen(fc));
594
595 /* 580 /*
596 * Use the first empty entry in this queue's command buffer array 581 * Use the first empty entry in this queue's command buffer array
597 * to contain the Tx command and MAC header concatenated together 582 * to contain the Tx command and MAC header concatenated together
@@ -610,14 +595,8 @@ il3945_tx_skb(struct il_priv *il,
610 * within command buffer array. */ 595 * within command buffer array. */
611 txcmd_phys = 596 txcmd_phys =
612 pci_map_single(il->pci_dev, &out_cmd->hdr, len, PCI_DMA_TODEVICE); 597 pci_map_single(il->pci_dev, &out_cmd->hdr, len, PCI_DMA_TODEVICE);
613 /* we do not map meta data ... so we can safely access address to 598 if (unlikely(pci_dma_mapping_error(il->pci_dev, txcmd_phys)))
614 * provide to unmap command*/ 599 goto drop_unlock;
615 dma_unmap_addr_set(out_meta, mapping, txcmd_phys);
616 dma_unmap_len_set(out_meta, len, len);
617
618 /* Add buffer containing Tx command and MAC(!) header to TFD's
619 * first entry */
620 il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, len, 1, 0);
621 600
622 /* Set up TFD's 2nd entry to point directly to remainder of skb, 601 /* Set up TFD's 2nd entry to point directly to remainder of skb,
623 * if any (802.11 null frames have no payload). */ 602 * if any (802.11 null frames have no payload). */
@@ -626,10 +605,34 @@ il3945_tx_skb(struct il_priv *il,
626 phys_addr = 605 phys_addr =
627 pci_map_single(il->pci_dev, skb->data + hdr_len, len, 606 pci_map_single(il->pci_dev, skb->data + hdr_len, len,
628 PCI_DMA_TODEVICE); 607 PCI_DMA_TODEVICE);
608 if (unlikely(pci_dma_mapping_error(il->pci_dev, phys_addr)))
609 goto drop_unlock;
610 }
611
612 /* Add buffer containing Tx command and MAC(!) header to TFD's
613 * first entry */
614 il->ops->txq_attach_buf_to_tfd(il, txq, txcmd_phys, len, 1, 0);
615 dma_unmap_addr_set(out_meta, mapping, txcmd_phys);
616 dma_unmap_len_set(out_meta, len, len);
617 if (len)
629 il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, len, 0, 618 il->ops->txq_attach_buf_to_tfd(il, txq, phys_addr, len, 0,
630 U32_PAD(len)); 619 U32_PAD(len));
620
621 if (!ieee80211_has_morefrags(hdr->frame_control)) {
622 txq->need_update = 1;
623 } else {
624 wait_write_ptr = 1;
625 txq->need_update = 0;
631 } 626 }
632 627
628 il_update_stats(il, true, fc, skb->len);
629
630 D_TX("sequence nr = 0X%x\n", le16_to_cpu(out_cmd->hdr.sequence));
631 D_TX("tx_flags = 0X%x\n", le32_to_cpu(tx_cmd->tx_flags));
632 il_print_hex_dump(il, IL_DL_TX, tx_cmd, sizeof(*tx_cmd));
633 il_print_hex_dump(il, IL_DL_TX, (u8 *) tx_cmd->hdr,
634 ieee80211_hdrlen(fc));
635
633 /* Tell device the write idx *just past* this latest filled TFD */ 636 /* Tell device the write idx *just past* this latest filled TFD */
634 q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd); 637 q->write_ptr = il_queue_inc_wrap(q->write_ptr, q->n_bd);
635 il_txq_update_write_ptr(il, txq); 638 il_txq_update_write_ptr(il, txq);