aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sunhme.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2009-12-03 01:26:38 -0500
committerDavid S. Miller <davem@davemloft.net>2009-12-03 01:26:38 -0500
commitff236f7af82fae0818d7cbb5a0717d3218d00bdd (patch)
tree0dff9c6789cf1b72e3dfe24aca9e14485391f122 /drivers/net/sunhme.c
parent8818a9d884e3a589899be3303958fff182e98e55 (diff)
sunhme: fix dma warning in Sun HME
Fix dma-api-checking warnings in Sun HME Sun HME driver is mapping the first fragment with dma_map_single and subsequent fragments with dma_map_page. It is unmapping all fragments with dma_unmap_single and that produces the warning. This patch changes it so that it unmaps only the first fragment with dma_unmap_single and subsequent fragments are unmapped with dma_unmap_page. WARNING: at lib/dma-debug.c:816 check_unmap+0x3ac/0x780() hme 0000:01:01.1: DMA-API: device driver frees DMA memory with wrong function [device address=0x00000000c1082000] [size=32 bytes] [mapped as page] [unmapped as single] Modules linked in: nbd sunhme openpromfs sermouse unix Call Trace: [0000000000456910] warn_slowpath_common+0x50/0xa0 [0000000000571f4c] check_unmap+0x3ac/0x780 [0000000000572570] debug_dma_unmap_page+0x50/0x60 [000000001002f5fc] happy_meal_tx+0x11c/0x260 [sunhme] [000000001002fc4c] happy_meal_interrupt+0xcc/0xe0 [sunhme] [0000000000492d94] handle_fasteoi_irq+0x74/0x100 [000000000042ac0c] handler_irq+0xcc/0x100 [0000000000426a54] valid_addr_bitmap_patch+0x14/0x1c0 [0000000000665de0] _spin_unlock_irqrestore+0x40/0x60 [0000000000462bb8] mod_timer+0x118/0x1a0 [00000000005ec254] sk_reset_timer+0x14/0x40 [0000000000635e4c] tcp_event_new_data_sent+0x8c/0xc0 [0000000000639374] __tcp_push_pending_frames+0x34/0xc0 ---[ end trace 73d5c42c1e9f11c4 ]--- Mapped at: [<000000001002f148>] happy_meal_start_xmit+0x308/0x480 [sunhme] [<00000000005fc858>] dev_hard_start_xmit+0x318/0x3c0 [<000000000060fec4>] sch_direct_xmit+0x1a4/0x200 [<00000000005fced0>] dev_queue_xmit+0x410/0x560 [<0000000000604a1c>] neigh_resolve_output+0xfc/0x300 Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sunhme.c')
-rw-r--r--drivers/net/sunhme.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 1f842a78acd1..0970e1774d13 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -1226,10 +1226,16 @@ static void happy_meal_clean_rings(struct happy_meal *hp)
1226 for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) { 1226 for (frag = 0; frag <= skb_shinfo(skb)->nr_frags; frag++) {
1227 txd = &hp->happy_block->happy_meal_txd[i]; 1227 txd = &hp->happy_block->happy_meal_txd[i];
1228 dma_addr = hme_read_desc32(hp, &txd->tx_addr); 1228 dma_addr = hme_read_desc32(hp, &txd->tx_addr);
1229 dma_unmap_single(hp->dma_dev, dma_addr, 1229 if (!frag)
1230 (hme_read_desc32(hp, &txd->tx_flags) 1230 dma_unmap_single(hp->dma_dev, dma_addr,
1231 & TXFLAG_SIZE), 1231 (hme_read_desc32(hp, &txd->tx_flags)
1232 DMA_TO_DEVICE); 1232 & TXFLAG_SIZE),
1233 DMA_TO_DEVICE);
1234 else
1235 dma_unmap_page(hp->dma_dev, dma_addr,
1236 (hme_read_desc32(hp, &txd->tx_flags)
1237 & TXFLAG_SIZE),
1238 DMA_TO_DEVICE);
1233 1239
1234 if (frag != skb_shinfo(skb)->nr_frags) 1240 if (frag != skb_shinfo(skb)->nr_frags)
1235 i++; 1241 i++;
@@ -1953,7 +1959,10 @@ static void happy_meal_tx(struct happy_meal *hp)
1953 dma_len = hme_read_desc32(hp, &this->tx_flags); 1959 dma_len = hme_read_desc32(hp, &this->tx_flags);
1954 1960
1955 dma_len &= TXFLAG_SIZE; 1961 dma_len &= TXFLAG_SIZE;
1956 dma_unmap_single(hp->dma_dev, dma_addr, dma_len, DMA_TO_DEVICE); 1962 if (!frag)
1963 dma_unmap_single(hp->dma_dev, dma_addr, dma_len, DMA_TO_DEVICE);
1964 else
1965 dma_unmap_page(hp->dma_dev, dma_addr, dma_len, DMA_TO_DEVICE);
1957 1966
1958 elem = NEXT_TX(elem); 1967 elem = NEXT_TX(elem);
1959 this = &txbase[elem]; 1968 this = &txbase[elem];