Commit f6815077e75c5b7f55b56fc3788e328514d4e72a

Authored by stephen hemminger
Committed by David S. Miller
1 parent 974c37e9d8

sky2: fix transmit DMA map leakage

The book keeping structure for transmit always had the flags value
cleared so transmit DMA maps were never released correctly.
Based on patch by Jarek Poplawski, problem observed by Michael Breuer.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 3 additions and 5 deletions Side-by-side Diff

... ... @@ -1025,11 +1025,8 @@
1025 1025 static inline struct sky2_tx_le *get_tx_le(struct sky2_port *sky2, u16 *slot)
1026 1026 {
1027 1027 struct sky2_tx_le *le = sky2->tx_le + *slot;
1028   - struct tx_ring_info *re = sky2->tx_ring + *slot;
1029 1028  
1030 1029 *slot = RING_NEXT(*slot, sky2->tx_ring_size);
1031   - re->flags = 0;
1032   - re->skb = NULL;
1033 1030 le->ctrl = 0;
1034 1031 return le;
1035 1032 }
... ... @@ -1622,8 +1619,7 @@
1622 1619 return count;
1623 1620 }
1624 1621  
1625   -static void sky2_tx_unmap(struct pci_dev *pdev,
1626   - const struct tx_ring_info *re)
  1622 +static void sky2_tx_unmap(struct pci_dev *pdev, struct tx_ring_info *re)
1627 1623 {
1628 1624 if (re->flags & TX_MAP_SINGLE)
1629 1625 pci_unmap_single(pdev, pci_unmap_addr(re, mapaddr),
... ... @@ -1633,6 +1629,7 @@
1633 1629 pci_unmap_page(pdev, pci_unmap_addr(re, mapaddr),
1634 1630 pci_unmap_len(re, maplen),
1635 1631 PCI_DMA_TODEVICE);
  1632 + re->flags = 0;
1636 1633 }
1637 1634  
1638 1635 /*
... ... @@ -1839,6 +1836,7 @@
1839 1836 dev->stats.tx_packets++;
1840 1837 dev->stats.tx_bytes += skb->len;
1841 1838  
  1839 + re->skb = NULL;
1842 1840 dev_kfree_skb_any(skb);
1843 1841  
1844 1842 sky2->tx_next = RING_NEXT(idx, sky2->tx_ring_size);