Commit 8e0a613b authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Jeff Garzik

[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: default avatarJens Osterkamp <Jens.Osterkamp@de.ibm.com>
Signed-off-by: default avatarArnd Bergmann <arndb@de.ibm.com>
Signed-off-by: default avatarJeff Garzik <jgarzik@pobox.com>
parent 030d6753
...@@ -480,6 +480,7 @@ static int ...@@ -480,6 +480,7 @@ static int
spider_net_prepare_rx_descr(struct spider_net_card *card, spider_net_prepare_rx_descr(struct spider_net_card *card,
struct spider_net_descr *descr) struct spider_net_descr *descr)
{ {
dma_addr_t buf;
int error = 0; int error = 0;
int offset; int offset;
int bufsize; int bufsize;
...@@ -510,10 +511,11 @@ spider_net_prepare_rx_descr(struct spider_net_card *card, ...@@ -510,10 +511,11 @@ spider_net_prepare_rx_descr(struct spider_net_card *card,
if (offset) if (offset)
skb_reserve(descr->skb, SPIDER_NET_RXBUF_ALIGN - offset); skb_reserve(descr->skb, SPIDER_NET_RXBUF_ALIGN - offset);
/* io-mmu-map the skb */ /* io-mmu-map the skb */
descr->buf_addr = pci_map_single(card->pdev, descr->skb->data, buf = pci_map_single(card->pdev, descr->skb->data,
SPIDER_NET_MAX_MTU, SPIDER_NET_MAX_MTU,
PCI_DMA_BIDIRECTIONAL); PCI_DMA_BIDIRECTIONAL);
if (descr->buf_addr == DMA_ERROR_CODE) { descr->buf_addr = buf;
if (buf == DMA_ERROR_CODE) {
dev_kfree_skb_any(descr->skb); dev_kfree_skb_any(descr->skb);
if (netif_msg_rx_err(card)) if (netif_msg_rx_err(card))
pr_err("Could not iommu-map rx buffer\n"); pr_err("Could not iommu-map rx buffer\n");
...@@ -914,15 +916,16 @@ spider_net_prepare_tx_descr(struct spider_net_card *card, ...@@ -914,15 +916,16 @@ spider_net_prepare_tx_descr(struct spider_net_card *card,
struct spider_net_descr *descr, struct spider_net_descr *descr,
struct sk_buff *skb) struct sk_buff *skb)
{ {
descr->buf_addr = pci_map_single(card->pdev, skb->data, dma_addr_t buf = pci_map_single(card->pdev, skb->data,
skb->len, PCI_DMA_BIDIRECTIONAL); skb->len, PCI_DMA_BIDIRECTIONAL);
if (descr->buf_addr == DMA_ERROR_CODE) { if (buf == DMA_ERROR_CODE) {
if (netif_msg_tx_err(card)) if (netif_msg_tx_err(card))
pr_err("could not iommu-map packet (%p, %i). " pr_err("could not iommu-map packet (%p, %i). "
"Dropping packet\n", skb->data, skb->len); "Dropping packet\n", skb->data, skb->len);
return -ENOMEM; return -ENOMEM;
} }
descr->buf_addr = buf;
descr->buf_size = skb->len; descr->buf_size = skb->len;
descr->skb = skb; descr->skb = skb;
descr->data_status = 0; descr->data_status = 0;
......
...@@ -373,9 +373,9 @@ enum spider_net_descr_status { ...@@ -373,9 +373,9 @@ enum spider_net_descr_status {
struct spider_net_descr { struct spider_net_descr {
/* as defined by the hardware */ /* as defined by the hardware */
dma_addr_t buf_addr; u32 buf_addr;
u32 buf_size; u32 buf_size;
dma_addr_t next_descr_addr; u32 next_descr_addr;
u32 dmac_cmd_status; u32 dmac_cmd_status;
u32 result_size; u32 result_size;
u32 valid_size; /* all zeroes for tx */ u32 valid_size; /* all zeroes for tx */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment