diff options
Diffstat (limited to 'drivers/net/spider_net.c')
-rw-r--r-- | drivers/net/spider_net.c | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index f88fcac0e46a..f16f696c1ff2 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -644,20 +644,12 @@ spider_net_prepare_tx_descr(struct spider_net_card *card, | |||
644 | struct spider_net_descr *descr; | 644 | struct spider_net_descr *descr; |
645 | dma_addr_t buf; | 645 | dma_addr_t buf; |
646 | unsigned long flags; | 646 | unsigned long flags; |
647 | int length; | ||
648 | 647 | ||
649 | length = skb->len; | 648 | buf = pci_map_single(card->pdev, skb->data, skb->len, PCI_DMA_TODEVICE); |
650 | if (length < ETH_ZLEN) { | ||
651 | if (skb_pad(skb, ETH_ZLEN-length)) | ||
652 | return 0; | ||
653 | length = ETH_ZLEN; | ||
654 | } | ||
655 | |||
656 | buf = pci_map_single(card->pdev, skb->data, length, PCI_DMA_TODEVICE); | ||
657 | if (pci_dma_mapping_error(buf)) { | 649 | if (pci_dma_mapping_error(buf)) { |
658 | if (netif_msg_tx_err(card) && net_ratelimit()) | 650 | if (netif_msg_tx_err(card) && net_ratelimit()) |
659 | pr_err("could not iommu-map packet (%p, %i). " | 651 | pr_err("could not iommu-map packet (%p, %i). " |
660 | "Dropping packet\n", skb->data, length); | 652 | "Dropping packet\n", skb->data, skb->len); |
661 | card->spider_stats.tx_iommu_map_error++; | 653 | card->spider_stats.tx_iommu_map_error++; |
662 | return -ENOMEM; | 654 | return -ENOMEM; |
663 | } | 655 | } |
@@ -667,7 +659,7 @@ spider_net_prepare_tx_descr(struct spider_net_card *card, | |||
667 | card->tx_chain.head = descr->next; | 659 | card->tx_chain.head = descr->next; |
668 | 660 | ||
669 | descr->buf_addr = buf; | 661 | descr->buf_addr = buf; |
670 | descr->buf_size = length; | 662 | descr->buf_size = skb->len; |
671 | descr->next_descr_addr = 0; | 663 | descr->next_descr_addr = 0; |
672 | descr->skb = skb; | 664 | descr->skb = skb; |
673 | descr->data_status = 0; | 665 | descr->data_status = 0; |
@@ -802,8 +794,8 @@ spider_net_release_tx_chain(struct spider_net_card *card, int brutal) | |||
802 | 794 | ||
803 | /* unmap the skb */ | 795 | /* unmap the skb */ |
804 | if (skb) { | 796 | if (skb) { |
805 | int len = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; | 797 | pci_unmap_single(card->pdev, buf_addr, skb->len, |
806 | pci_unmap_single(card->pdev, buf_addr, len, PCI_DMA_TODEVICE); | 798 | PCI_DMA_TODEVICE); |
807 | dev_kfree_skb(skb); | 799 | dev_kfree_skb(skb); |
808 | } | 800 | } |
809 | } | 801 | } |
@@ -1641,7 +1633,7 @@ spider_net_enable_card(struct spider_net_card *card) | |||
1641 | SPIDER_NET_INT2_MASK_VALUE); | 1633 | SPIDER_NET_INT2_MASK_VALUE); |
1642 | 1634 | ||
1643 | spider_net_write_reg(card, SPIDER_NET_GDTDMACCNTR, | 1635 | spider_net_write_reg(card, SPIDER_NET_GDTDMACCNTR, |
1644 | SPIDER_NET_GDTBSTA | SPIDER_NET_GDTDCEIDIS); | 1636 | SPIDER_NET_GDTBSTA); |
1645 | } | 1637 | } |
1646 | 1638 | ||
1647 | /** | 1639 | /** |