diff options
author | Arnd Bergmann <arnd@arndb.de> | 2006-01-12 17:16:43 -0500 |
---|---|---|
committer | Jeff Garzik <jgarzik@pobox.com> | 2006-01-17 07:25:00 -0500 |
commit | 8e0a613bf61ccaab376877d7c2ed50315b8ca6d7 (patch) | |
tree | 76964e5d482023c895487a7392a3e3e18d7dc599 /drivers | |
parent | 030d6753f8b6251927330431a7e5f0ac86bc6da9 (diff) |
[PATCH] spidernet: fix HW structures for 64 bit dma_addr_t
The driver incorrectly used dma_addr_t to describe
HW structures and consequently broke when that type
was changed in 2.6.15-rc.
This changed spidernet to use u32 for 32 bit HW defined
structure elements.
From: Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
Signed-off-by: Jens Osterkamp <Jens.Osterkamp@de.ibm.com>
Signed-off-by: Arnd Bergmann <arndb@de.ibm.com>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/spider_net.c | 13 | ||||
-rw-r--r-- | drivers/net/spider_net.h | 4 |
2 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/spider_net.c b/drivers/net/spider_net.c index 94e238f6ed31..86969191c3f7 100644 --- a/drivers/net/spider_net.c +++ b/drivers/net/spider_net.c | |||
@@ -480,6 +480,7 @@ static int | |||
480 | spider_net_prepare_rx_descr(struct spider_net_card *card, | 480 | spider_net_prepare_rx_descr(struct spider_net_card *card, |
481 | struct spider_net_descr *descr) | 481 | struct spider_net_descr *descr) |
482 | { | 482 | { |
483 | dma_addr_t buf; | ||
483 | int error = 0; | 484 | int error = 0; |
484 | int offset; | 485 | int offset; |
485 | int bufsize; | 486 | int bufsize; |
@@ -510,10 +511,11 @@ spider_net_prepare_rx_descr(struct spider_net_card *card, | |||
510 | if (offset) | 511 | if (offset) |
511 | skb_reserve(descr->skb, SPIDER_NET_RXBUF_ALIGN - offset); | 512 | skb_reserve(descr->skb, SPIDER_NET_RXBUF_ALIGN - offset); |
512 | /* io-mmu-map the skb */ | 513 | /* io-mmu-map the skb */ |
513 | descr->buf_addr = pci_map_single(card->pdev, descr->skb->data, | 514 | buf = pci_map_single(card->pdev, descr->skb->data, |
514 | SPIDER_NET_MAX_MTU, | 515 | SPIDER_NET_MAX_MTU, |
515 | PCI_DMA_BIDIRECTIONAL); | 516 | PCI_DMA_BIDIRECTIONAL); |
516 | if (descr->buf_addr == DMA_ERROR_CODE) { | 517 | descr->buf_addr = buf; |
518 | if (buf == DMA_ERROR_CODE) { | ||
517 | dev_kfree_skb_any(descr->skb); | 519 | dev_kfree_skb_any(descr->skb); |
518 | if (netif_msg_rx_err(card)) | 520 | if (netif_msg_rx_err(card)) |
519 | pr_err("Could not iommu-map rx buffer\n"); | 521 | pr_err("Could not iommu-map rx buffer\n"); |
@@ -914,15 +916,16 @@ spider_net_prepare_tx_descr(struct spider_net_card *card, | |||
914 | struct spider_net_descr *descr, | 916 | struct spider_net_descr *descr, |
915 | struct sk_buff *skb) | 917 | struct sk_buff *skb) |
916 | { | 918 | { |
917 | descr->buf_addr = pci_map_single(card->pdev, skb->data, | 919 | dma_addr_t buf = pci_map_single(card->pdev, skb->data, |
918 | skb->len, PCI_DMA_BIDIRECTIONAL); | 920 | skb->len, PCI_DMA_BIDIRECTIONAL); |
919 | if (descr->buf_addr == DMA_ERROR_CODE) { | 921 | if (buf == DMA_ERROR_CODE) { |
920 | if (netif_msg_tx_err(card)) | 922 | if (netif_msg_tx_err(card)) |
921 | pr_err("could not iommu-map packet (%p, %i). " | 923 | pr_err("could not iommu-map packet (%p, %i). " |
922 | "Dropping packet\n", skb->data, skb->len); | 924 | "Dropping packet\n", skb->data, skb->len); |
923 | return -ENOMEM; | 925 | return -ENOMEM; |
924 | } | 926 | } |
925 | 927 | ||
928 | descr->buf_addr = buf; | ||
926 | descr->buf_size = skb->len; | 929 | descr->buf_size = skb->len; |
927 | descr->skb = skb; | 930 | descr->skb = skb; |
928 | descr->data_status = 0; | 931 | descr->data_status = 0; |
diff --git a/drivers/net/spider_net.h b/drivers/net/spider_net.h index 22b2f2347351..98f11ecf48fc 100644 --- a/drivers/net/spider_net.h +++ b/drivers/net/spider_net.h | |||
@@ -373,9 +373,9 @@ enum spider_net_descr_status { | |||
373 | 373 | ||
374 | struct spider_net_descr { | 374 | struct spider_net_descr { |
375 | /* as defined by the hardware */ | 375 | /* as defined by the hardware */ |
376 | dma_addr_t buf_addr; | 376 | u32 buf_addr; |
377 | u32 buf_size; | 377 | u32 buf_size; |
378 | dma_addr_t next_descr_addr; | 378 | u32 next_descr_addr; |
379 | u32 dmac_cmd_status; | 379 | u32 dmac_cmd_status; |
380 | u32 result_size; | 380 | u32 result_size; |
381 | u32 valid_size; /* all zeroes for tx */ | 381 | u32 valid_size; /* all zeroes for tx */ |