diff options
author | David S. Miller <davem@davemloft.net> | 2011-07-21 23:21:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-21 23:21:27 -0400 |
commit | e627539090d5a4efe1d55f1dfa24f8ce08a454e8 (patch) | |
tree | 0e35e6923397d1129ea1469c9153fa1f5a26d55d /drivers/net/jme.c | |
parent | 557e2a394de0d142ba930ff3cdb2909419414e06 (diff) | |
parent | 94c5b41b327e08de0ddf563237855f55080652a1 (diff) |
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
Diffstat (limited to 'drivers/net/jme.c')
-rw-r--r-- | drivers/net/jme.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/net/jme.c b/drivers/net/jme.c index 85a11e0fa548..3ac262f55633 100644 --- a/drivers/net/jme.c +++ b/drivers/net/jme.c | |||
@@ -751,20 +751,28 @@ jme_make_new_rx_buf(struct jme_adapter *jme, int i) | |||
751 | struct jme_ring *rxring = &(jme->rxring[0]); | 751 | struct jme_ring *rxring = &(jme->rxring[0]); |
752 | struct jme_buffer_info *rxbi = rxring->bufinf + i; | 752 | struct jme_buffer_info *rxbi = rxring->bufinf + i; |
753 | struct sk_buff *skb; | 753 | struct sk_buff *skb; |
754 | dma_addr_t mapping; | ||
754 | 755 | ||
755 | skb = netdev_alloc_skb(jme->dev, | 756 | skb = netdev_alloc_skb(jme->dev, |
756 | jme->dev->mtu + RX_EXTRA_LEN); | 757 | jme->dev->mtu + RX_EXTRA_LEN); |
757 | if (unlikely(!skb)) | 758 | if (unlikely(!skb)) |
758 | return -ENOMEM; | 759 | return -ENOMEM; |
759 | 760 | ||
761 | mapping = pci_map_page(jme->pdev, virt_to_page(skb->data), | ||
762 | offset_in_page(skb->data), skb_tailroom(skb), | ||
763 | PCI_DMA_FROMDEVICE); | ||
764 | if (unlikely(pci_dma_mapping_error(jme->pdev, mapping))) { | ||
765 | dev_kfree_skb(skb); | ||
766 | return -ENOMEM; | ||
767 | } | ||
768 | |||
769 | if (likely(rxbi->mapping)) | ||
770 | pci_unmap_page(jme->pdev, rxbi->mapping, | ||
771 | rxbi->len, PCI_DMA_FROMDEVICE); | ||
772 | |||
760 | rxbi->skb = skb; | 773 | rxbi->skb = skb; |
761 | rxbi->len = skb_tailroom(skb); | 774 | rxbi->len = skb_tailroom(skb); |
762 | rxbi->mapping = pci_map_page(jme->pdev, | 775 | rxbi->mapping = mapping; |
763 | virt_to_page(skb->data), | ||
764 | offset_in_page(skb->data), | ||
765 | rxbi->len, | ||
766 | PCI_DMA_FROMDEVICE); | ||
767 | |||
768 | return 0; | 776 | return 0; |
769 | } | 777 | } |
770 | 778 | ||