aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/spider_net.c18
-rw-r--r--drivers/net/spider_net.h2
2 files changed, 6 insertions, 14 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 418138dd6c68..9dd282346e1c 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 }
diff --git a/drivers/net/spider_net.h b/drivers/net/spider_net.h
index b3b46119b424..cb85cbb3d92d 100644
--- a/drivers/net/spider_net.h
+++ b/drivers/net/spider_net.h
@@ -24,7 +24,7 @@
24#ifndef _SPIDER_NET_H 24#ifndef _SPIDER_NET_H
25#define _SPIDER_NET_H 25#define _SPIDER_NET_H
26 26
27#define VERSION "1.1 A" 27#define VERSION "1.5 A"
28 28
29#include "sungem_phy.h" 29#include "sungem_phy.h"
30 30