aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/spider_net.c
diff options
context:
space:
mode:
authorLinas Vepstas <linas@austin.ibm.com>2006-10-10 17:21:10 -0400
committerJeff Garzik <jeff@garzik.org>2006-10-11 04:04:27 -0400
commit348bc2a6e306dc3e875cee3389e1405963ace617 (patch)
treee0801413480b419d9a7143b05f1f90f83f14477f /drivers/net/spider_net.c
parent66c097165cf6d4196e798145fb33c768164fb361 (diff)
[PATCH] powerpc/cell spidernet DMA direction fix
The ring buffer descriptors are DMA-accessed bidirectionally, but are not declared in this way. Fix this. Signed-off-by: Linas Vepstas <linas@austin.ibm.com> Cc: James K Lewis <jklewis@us.ibm.com> Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/spider_net.c')
-rw-r--r--drivers/net/spider_net.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c
index 88e7e41adec1..a26dd1c63189 100644
--- a/drivers/net/spider_net.c
+++ b/drivers/net/spider_net.c
@@ -301,7 +301,7 @@ static int
301spider_net_init_chain(struct spider_net_card *card, 301spider_net_init_chain(struct spider_net_card *card,
302 struct spider_net_descr_chain *chain, 302 struct spider_net_descr_chain *chain,
303 struct spider_net_descr *start_descr, 303 struct spider_net_descr *start_descr,
304 int direction, int no) 304 int no)
305{ 305{
306 int i; 306 int i;
307 struct spider_net_descr *descr; 307 struct spider_net_descr *descr;
@@ -316,7 +316,7 @@ spider_net_init_chain(struct spider_net_card *card,
316 316
317 buf = pci_map_single(card->pdev, descr, 317 buf = pci_map_single(card->pdev, descr,
318 SPIDER_NET_DESCR_SIZE, 318 SPIDER_NET_DESCR_SIZE,
319 direction); 319 PCI_DMA_BIDIRECTIONAL);
320 320
321 if (pci_dma_mapping_error(buf)) 321 if (pci_dma_mapping_error(buf))
322 goto iommu_error; 322 goto iommu_error;
@@ -330,11 +330,6 @@ spider_net_init_chain(struct spider_net_card *card,
330 (descr-1)->next = start_descr; 330 (descr-1)->next = start_descr;
331 start_descr->prev = descr-1; 331 start_descr->prev = descr-1;
332 332
333 descr = start_descr;
334 if (direction == PCI_DMA_FROMDEVICE)
335 for (i=0; i < no; i++, descr++)
336 descr->next_descr_addr = descr->next->bus_addr;
337
338 spin_lock_init(&chain->lock); 333 spin_lock_init(&chain->lock);
339 chain->head = start_descr; 334 chain->head = start_descr;
340 chain->tail = start_descr; 335 chain->tail = start_descr;
@@ -347,7 +342,7 @@ iommu_error:
347 if (descr->bus_addr) 342 if (descr->bus_addr)
348 pci_unmap_single(card->pdev, descr->bus_addr, 343 pci_unmap_single(card->pdev, descr->bus_addr,
349 SPIDER_NET_DESCR_SIZE, 344 SPIDER_NET_DESCR_SIZE,
350 direction); 345 PCI_DMA_BIDIRECTIONAL);
351 return -ENOMEM; 346 return -ENOMEM;
352} 347}
353 348
@@ -368,7 +363,7 @@ spider_net_free_rx_chain_contents(struct spider_net_card *card)
368 dev_kfree_skb(descr->skb); 363 dev_kfree_skb(descr->skb);
369 pci_unmap_single(card->pdev, descr->buf_addr, 364 pci_unmap_single(card->pdev, descr->buf_addr,
370 SPIDER_NET_MAX_FRAME, 365 SPIDER_NET_MAX_FRAME,
371 PCI_DMA_FROMDEVICE); 366 PCI_DMA_BIDIRECTIONAL);
372 } 367 }
373 descr = descr->next; 368 descr = descr->next;
374 } 369 }
@@ -1662,21 +1657,26 @@ int
1662spider_net_open(struct net_device *netdev) 1657spider_net_open(struct net_device *netdev)
1663{ 1658{
1664 struct spider_net_card *card = netdev_priv(netdev); 1659 struct spider_net_card *card = netdev_priv(netdev);
1665 int result; 1660 struct spider_net_descr *descr;
1661 int i, result;
1666 1662
1667 result = -ENOMEM; 1663 result = -ENOMEM;
1668 if (spider_net_init_chain(card, &card->tx_chain, card->descr, 1664 if (spider_net_init_chain(card, &card->tx_chain, card->descr,
1669 PCI_DMA_TODEVICE, card->num_tx_desc)) 1665 card->num_tx_desc))
1670 goto alloc_tx_failed; 1666 goto alloc_tx_failed;
1671 1667
1672 card->low_watermark = NULL; 1668 card->low_watermark = NULL;
1673 1669
1674 /* rx_chain is after tx_chain, so offset is descr + tx_count */ 1670 /* rx_chain is after tx_chain, so offset is descr + tx_count */
1675 if (spider_net_init_chain(card, &card->rx_chain, 1671 if (spider_net_init_chain(card, &card->rx_chain,
1676 card->descr + card->num_tx_desc, 1672 card->descr + card->num_tx_desc,
1677 PCI_DMA_FROMDEVICE, card->num_rx_desc)) 1673 card->num_rx_desc))
1678 goto alloc_rx_failed; 1674 goto alloc_rx_failed;
1679 1675
1676 descr = card->rx_chain.head;
1677 for (i=0; i < card->num_rx_desc; i++, descr++)
1678 descr->next_descr_addr = descr->next->bus_addr;
1679
1680 /* allocate rx skbs */ 1680 /* allocate rx skbs */
1681 if (spider_net_alloc_rx_skbs(card)) 1681 if (spider_net_alloc_rx_skbs(card))
1682 goto alloc_skbs_failed; 1682 goto alloc_skbs_failed;