aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorGuo-Fu Tseng <cooldavid@cooldavid.org>2011-07-20 12:57:36 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-21 18:22:52 -0400
commit94c5b41b327e08de0ddf563237855f55080652a1 (patch)
tree99c40627fde925340b565d8aa2883ce6fb49e859 /drivers/net
parente6625fa48e6580a74b7e700efd7e6463e282810b (diff)
jme: Fix unmap error (Causing system freeze)
This patch add the missing dma_unmap(). Which solved the critical issue of system freeze on heavy load. Michal Miroslaw's rejected patch: [PATCH v2 10/46] net: jme: convert to generic DMA API Pointed out the issue also, thank you Michal. But the fix was incorrect. It would unmap needed address when low memory. Got lots of feedback from End user and Gentoo Bugzilla. https://bugs.gentoo.org/show_bug.cgi?id=373109 Thank you all. :) Cc: stable@kernel.org Signed-off-by: Guo-Fu Tseng <cooldavid@cooldavid.org> Acked-by: Chris Wright <chrisw@sous-sol.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/jme.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/drivers/net/jme.c b/drivers/net/jme.c
index b5b174a8c149..19738143aa91 100644
--- a/drivers/net/jme.c
+++ b/drivers/net/jme.c
@@ -753,20 +753,28 @@ jme_make_new_rx_buf(struct jme_adapter *jme, int i)
753 struct jme_ring *rxring = &(jme->rxring[0]); 753 struct jme_ring *rxring = &(jme->rxring[0]);
754 struct jme_buffer_info *rxbi = rxring->bufinf + i; 754 struct jme_buffer_info *rxbi = rxring->bufinf + i;
755 struct sk_buff *skb; 755 struct sk_buff *skb;
756 dma_addr_t mapping;
756 757
757 skb = netdev_alloc_skb(jme->dev, 758 skb = netdev_alloc_skb(jme->dev,
758 jme->dev->mtu + RX_EXTRA_LEN); 759 jme->dev->mtu + RX_EXTRA_LEN);
759 if (unlikely(!skb)) 760 if (unlikely(!skb))
760 return -ENOMEM; 761 return -ENOMEM;
761 762
763 mapping = pci_map_page(jme->pdev, virt_to_page(skb->data),
764 offset_in_page(skb->data), skb_tailroom(skb),
765 PCI_DMA_FROMDEVICE);
766 if (unlikely(pci_dma_mapping_error(jme->pdev, mapping))) {
767 dev_kfree_skb(skb);
768 return -ENOMEM;
769 }
770
771 if (likely(rxbi->mapping))
772 pci_unmap_page(jme->pdev, rxbi->mapping,
773 rxbi->len, PCI_DMA_FROMDEVICE);
774
762 rxbi->skb = skb; 775 rxbi->skb = skb;
763 rxbi->len = skb_tailroom(skb); 776 rxbi->len = skb_tailroom(skb);
764 rxbi->mapping = pci_map_page(jme->pdev, 777 rxbi->mapping = mapping;
765 virt_to_page(skb->data),
766 offset_in_page(skb->data),
767 rxbi->len,
768 PCI_DMA_FROMDEVICE);
769
770 return 0; 778 return 0;
771} 779}
772 780