diff options
author | Al Viro <viro@ftp.linux.org.uk> | 2007-12-22 12:53:02 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-12-22 22:53:06 -0500 |
commit | e5a314210087558f21617255754e7687e9a7f81d (patch) | |
tree | 7d6a5bef489782d82855b3cbb084c8a17381ed54 /drivers/net/yellowfin.c | |
parent | 51bf2976b55d07f9daae9697a0a3ac9f58abcedc (diff) |
yellowfin: annotations and fixes (.24 fodder?)
pci_unmap_single() and friends getting a little-endian address...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/yellowfin.c')
-rw-r--r-- | drivers/net/yellowfin.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/net/yellowfin.c b/drivers/net/yellowfin.c index 87f002ade531..fe6ff3e3d525 100644 --- a/drivers/net/yellowfin.c +++ b/drivers/net/yellowfin.c | |||
@@ -265,10 +265,10 @@ enum yellowfin_offsets { | |||
265 | /* The Yellowfin Rx and Tx buffer descriptors. | 265 | /* The Yellowfin Rx and Tx buffer descriptors. |
266 | Elements are written as 32 bit for endian portability. */ | 266 | Elements are written as 32 bit for endian portability. */ |
267 | struct yellowfin_desc { | 267 | struct yellowfin_desc { |
268 | u32 dbdma_cmd; | 268 | __le32 dbdma_cmd; |
269 | u32 addr; | 269 | __le32 addr; |
270 | u32 branch_addr; | 270 | __le32 branch_addr; |
271 | u32 result_status; | 271 | __le32 result_status; |
272 | }; | 272 | }; |
273 | 273 | ||
274 | struct tx_status_words { | 274 | struct tx_status_words { |
@@ -922,7 +922,7 @@ static irqreturn_t yellowfin_interrupt(int irq, void *dev_instance) | |||
922 | dev->stats.tx_packets++; | 922 | dev->stats.tx_packets++; |
923 | dev->stats.tx_bytes += skb->len; | 923 | dev->stats.tx_bytes += skb->len; |
924 | /* Free the original skb. */ | 924 | /* Free the original skb. */ |
925 | pci_unmap_single(yp->pci_dev, yp->tx_ring[entry].addr, | 925 | pci_unmap_single(yp->pci_dev, le32_to_cpu(yp->tx_ring[entry].addr), |
926 | skb->len, PCI_DMA_TODEVICE); | 926 | skb->len, PCI_DMA_TODEVICE); |
927 | dev_kfree_skb_irq(skb); | 927 | dev_kfree_skb_irq(skb); |
928 | yp->tx_skbuff[entry] = NULL; | 928 | yp->tx_skbuff[entry] = NULL; |
@@ -1056,13 +1056,13 @@ static int yellowfin_rx(struct net_device *dev) | |||
1056 | 1056 | ||
1057 | if(!desc->result_status) | 1057 | if(!desc->result_status) |
1058 | break; | 1058 | break; |
1059 | pci_dma_sync_single_for_cpu(yp->pci_dev, desc->addr, | 1059 | pci_dma_sync_single_for_cpu(yp->pci_dev, le32_to_cpu(desc->addr), |
1060 | yp->rx_buf_sz, PCI_DMA_FROMDEVICE); | 1060 | yp->rx_buf_sz, PCI_DMA_FROMDEVICE); |
1061 | desc_status = le32_to_cpu(desc->result_status) >> 16; | 1061 | desc_status = le32_to_cpu(desc->result_status) >> 16; |
1062 | buf_addr = rx_skb->data; | 1062 | buf_addr = rx_skb->data; |
1063 | data_size = (le32_to_cpu(desc->dbdma_cmd) - | 1063 | data_size = (le32_to_cpu(desc->dbdma_cmd) - |
1064 | le32_to_cpu(desc->result_status)) & 0xffff; | 1064 | le32_to_cpu(desc->result_status)) & 0xffff; |
1065 | frame_status = le16_to_cpu(get_unaligned((s16*)&(buf_addr[data_size - 2]))); | 1065 | frame_status = le16_to_cpu(get_unaligned((__le16*)&(buf_addr[data_size - 2]))); |
1066 | if (yellowfin_debug > 4) | 1066 | if (yellowfin_debug > 4) |
1067 | printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", | 1067 | printk(KERN_DEBUG " yellowfin_rx() status was %4.4x.\n", |
1068 | frame_status); | 1068 | frame_status); |
@@ -1123,7 +1123,7 @@ static int yellowfin_rx(struct net_device *dev) | |||
1123 | if (pkt_len > rx_copybreak) { | 1123 | if (pkt_len > rx_copybreak) { |
1124 | skb_put(skb = rx_skb, pkt_len); | 1124 | skb_put(skb = rx_skb, pkt_len); |
1125 | pci_unmap_single(yp->pci_dev, | 1125 | pci_unmap_single(yp->pci_dev, |
1126 | yp->rx_ring[entry].addr, | 1126 | le32_to_cpu(yp->rx_ring[entry].addr), |
1127 | yp->rx_buf_sz, | 1127 | yp->rx_buf_sz, |
1128 | PCI_DMA_FROMDEVICE); | 1128 | PCI_DMA_FROMDEVICE); |
1129 | yp->rx_skbuff[entry] = NULL; | 1129 | yp->rx_skbuff[entry] = NULL; |
@@ -1134,9 +1134,10 @@ static int yellowfin_rx(struct net_device *dev) | |||
1134 | skb_reserve(skb, 2); /* 16 byte align the IP header */ | 1134 | skb_reserve(skb, 2); /* 16 byte align the IP header */ |
1135 | skb_copy_to_linear_data(skb, rx_skb->data, pkt_len); | 1135 | skb_copy_to_linear_data(skb, rx_skb->data, pkt_len); |
1136 | skb_put(skb, pkt_len); | 1136 | skb_put(skb, pkt_len); |
1137 | pci_dma_sync_single_for_device(yp->pci_dev, desc->addr, | 1137 | pci_dma_sync_single_for_device(yp->pci_dev, |
1138 | yp->rx_buf_sz, | 1138 | le32_to_cpu(desc->addr), |
1139 | PCI_DMA_FROMDEVICE); | 1139 | yp->rx_buf_sz, |
1140 | PCI_DMA_FROMDEVICE); | ||
1140 | } | 1141 | } |
1141 | skb->protocol = eth_type_trans(skb, dev); | 1142 | skb->protocol = eth_type_trans(skb, dev); |
1142 | netif_rx(skb); | 1143 | netif_rx(skb); |
@@ -1252,7 +1253,7 @@ static int yellowfin_close(struct net_device *dev) | |||
1252 | /* Free all the skbuffs in the Rx queue. */ | 1253 | /* Free all the skbuffs in the Rx queue. */ |
1253 | for (i = 0; i < RX_RING_SIZE; i++) { | 1254 | for (i = 0; i < RX_RING_SIZE; i++) { |
1254 | yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP); | 1255 | yp->rx_ring[i].dbdma_cmd = cpu_to_le32(CMD_STOP); |
1255 | yp->rx_ring[i].addr = 0xBADF00D0; /* An invalid address. */ | 1256 | yp->rx_ring[i].addr = cpu_to_le32(0xBADF00D0); /* An invalid address. */ |
1256 | if (yp->rx_skbuff[i]) { | 1257 | if (yp->rx_skbuff[i]) { |
1257 | dev_kfree_skb(yp->rx_skbuff[i]); | 1258 | dev_kfree_skb(yp->rx_skbuff[i]); |
1258 | } | 1259 | } |