aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/myri10ge/myri10ge.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/myri10ge/myri10ge.c')
-rw-r--r--drivers/net/myri10ge/myri10ge.c54
1 files changed, 27 insertions, 27 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index ecde0876a785..e0b47cc8a86e 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -110,15 +110,15 @@ MODULE_LICENSE("Dual BSD/GPL");
110struct myri10ge_rx_buffer_state { 110struct myri10ge_rx_buffer_state {
111 struct page *page; 111 struct page *page;
112 int page_offset; 112 int page_offset;
113 DECLARE_PCI_UNMAP_ADDR(bus) 113 DEFINE_DMA_UNMAP_ADDR(bus);
114 DECLARE_PCI_UNMAP_LEN(len) 114 DEFINE_DMA_UNMAP_LEN(len);
115}; 115};
116 116
117struct myri10ge_tx_buffer_state { 117struct myri10ge_tx_buffer_state {
118 struct sk_buff *skb; 118 struct sk_buff *skb;
119 int last; 119 int last;
120 DECLARE_PCI_UNMAP_ADDR(bus) 120 DEFINE_DMA_UNMAP_ADDR(bus);
121 DECLARE_PCI_UNMAP_LEN(len) 121 DEFINE_DMA_UNMAP_LEN(len);
122}; 122};
123 123
124struct myri10ge_cmd { 124struct myri10ge_cmd {
@@ -1234,7 +1234,7 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
1234 rx->info[idx].page_offset = rx->page_offset; 1234 rx->info[idx].page_offset = rx->page_offset;
1235 /* note that this is the address of the start of the 1235 /* note that this is the address of the start of the
1236 * page */ 1236 * page */
1237 pci_unmap_addr_set(&rx->info[idx], bus, rx->bus); 1237 dma_unmap_addr_set(&rx->info[idx], bus, rx->bus);
1238 rx->shadow[idx].addr_low = 1238 rx->shadow[idx].addr_low =
1239 htonl(MYRI10GE_LOWPART_TO_U32(rx->bus) + rx->page_offset); 1239 htonl(MYRI10GE_LOWPART_TO_U32(rx->bus) + rx->page_offset);
1240 rx->shadow[idx].addr_high = 1240 rx->shadow[idx].addr_high =
@@ -1266,7 +1266,7 @@ myri10ge_unmap_rx_page(struct pci_dev *pdev,
1266 /* unmap the recvd page if we're the only or last user of it */ 1266 /* unmap the recvd page if we're the only or last user of it */
1267 if (bytes >= MYRI10GE_ALLOC_SIZE / 2 || 1267 if (bytes >= MYRI10GE_ALLOC_SIZE / 2 ||
1268 (info->page_offset + 2 * bytes) > MYRI10GE_ALLOC_SIZE) { 1268 (info->page_offset + 2 * bytes) > MYRI10GE_ALLOC_SIZE) {
1269 pci_unmap_page(pdev, (pci_unmap_addr(info, bus) 1269 pci_unmap_page(pdev, (dma_unmap_addr(info, bus)
1270 & ~(MYRI10GE_ALLOC_SIZE - 1)), 1270 & ~(MYRI10GE_ALLOC_SIZE - 1)),
1271 MYRI10GE_ALLOC_SIZE, PCI_DMA_FROMDEVICE); 1271 MYRI10GE_ALLOC_SIZE, PCI_DMA_FROMDEVICE);
1272 } 1272 }
@@ -1373,21 +1373,21 @@ myri10ge_tx_done(struct myri10ge_slice_state *ss, int mcp_index)
1373 tx->info[idx].last = 0; 1373 tx->info[idx].last = 0;
1374 } 1374 }
1375 tx->done++; 1375 tx->done++;
1376 len = pci_unmap_len(&tx->info[idx], len); 1376 len = dma_unmap_len(&tx->info[idx], len);
1377 pci_unmap_len_set(&tx->info[idx], len, 0); 1377 dma_unmap_len_set(&tx->info[idx], len, 0);
1378 if (skb) { 1378 if (skb) {
1379 ss->stats.tx_bytes += skb->len; 1379 ss->stats.tx_bytes += skb->len;
1380 ss->stats.tx_packets++; 1380 ss->stats.tx_packets++;
1381 dev_kfree_skb_irq(skb); 1381 dev_kfree_skb_irq(skb);
1382 if (len) 1382 if (len)
1383 pci_unmap_single(pdev, 1383 pci_unmap_single(pdev,
1384 pci_unmap_addr(&tx->info[idx], 1384 dma_unmap_addr(&tx->info[idx],
1385 bus), len, 1385 bus), len,
1386 PCI_DMA_TODEVICE); 1386 PCI_DMA_TODEVICE);
1387 } else { 1387 } else {
1388 if (len) 1388 if (len)
1389 pci_unmap_page(pdev, 1389 pci_unmap_page(pdev,
1390 pci_unmap_addr(&tx->info[idx], 1390 dma_unmap_addr(&tx->info[idx],
1391 bus), len, 1391 bus), len,
1392 PCI_DMA_TODEVICE); 1392 PCI_DMA_TODEVICE);
1393 } 1393 }
@@ -2094,20 +2094,20 @@ static void myri10ge_free_rings(struct myri10ge_slice_state *ss)
2094 /* Mark as free */ 2094 /* Mark as free */
2095 tx->info[idx].skb = NULL; 2095 tx->info[idx].skb = NULL;
2096 tx->done++; 2096 tx->done++;
2097 len = pci_unmap_len(&tx->info[idx], len); 2097 len = dma_unmap_len(&tx->info[idx], len);
2098 pci_unmap_len_set(&tx->info[idx], len, 0); 2098 dma_unmap_len_set(&tx->info[idx], len, 0);
2099 if (skb) { 2099 if (skb) {
2100 ss->stats.tx_dropped++; 2100 ss->stats.tx_dropped++;
2101 dev_kfree_skb_any(skb); 2101 dev_kfree_skb_any(skb);
2102 if (len) 2102 if (len)
2103 pci_unmap_single(mgp->pdev, 2103 pci_unmap_single(mgp->pdev,
2104 pci_unmap_addr(&tx->info[idx], 2104 dma_unmap_addr(&tx->info[idx],
2105 bus), len, 2105 bus), len,
2106 PCI_DMA_TODEVICE); 2106 PCI_DMA_TODEVICE);
2107 } else { 2107 } else {
2108 if (len) 2108 if (len)
2109 pci_unmap_page(mgp->pdev, 2109 pci_unmap_page(mgp->pdev,
2110 pci_unmap_addr(&tx->info[idx], 2110 dma_unmap_addr(&tx->info[idx],
2111 bus), len, 2111 bus), len,
2112 PCI_DMA_TODEVICE); 2112 PCI_DMA_TODEVICE);
2113 } 2113 }
@@ -2757,12 +2757,12 @@ again:
2757 } 2757 }
2758 2758
2759 /* map the skb for DMA */ 2759 /* map the skb for DMA */
2760 len = skb->len - skb->data_len; 2760 len = skb_headlen(skb);
2761 idx = tx->req & tx->mask; 2761 idx = tx->req & tx->mask;
2762 tx->info[idx].skb = skb; 2762 tx->info[idx].skb = skb;
2763 bus = pci_map_single(mgp->pdev, skb->data, len, PCI_DMA_TODEVICE); 2763 bus = pci_map_single(mgp->pdev, skb->data, len, PCI_DMA_TODEVICE);
2764 pci_unmap_addr_set(&tx->info[idx], bus, bus); 2764 dma_unmap_addr_set(&tx->info[idx], bus, bus);
2765 pci_unmap_len_set(&tx->info[idx], len, len); 2765 dma_unmap_len_set(&tx->info[idx], len, len);
2766 2766
2767 frag_cnt = skb_shinfo(skb)->nr_frags; 2767 frag_cnt = skb_shinfo(skb)->nr_frags;
2768 frag_idx = 0; 2768 frag_idx = 0;
@@ -2865,8 +2865,8 @@ again:
2865 len = frag->size; 2865 len = frag->size;
2866 bus = pci_map_page(mgp->pdev, frag->page, frag->page_offset, 2866 bus = pci_map_page(mgp->pdev, frag->page, frag->page_offset,
2867 len, PCI_DMA_TODEVICE); 2867 len, PCI_DMA_TODEVICE);
2868 pci_unmap_addr_set(&tx->info[idx], bus, bus); 2868 dma_unmap_addr_set(&tx->info[idx], bus, bus);
2869 pci_unmap_len_set(&tx->info[idx], len, len); 2869 dma_unmap_len_set(&tx->info[idx], len, len);
2870 } 2870 }
2871 2871
2872 (req - rdma_count)->rdma_count = rdma_count; 2872 (req - rdma_count)->rdma_count = rdma_count;
@@ -2903,19 +2903,19 @@ abort_linearize:
2903 idx = tx->req & tx->mask; 2903 idx = tx->req & tx->mask;
2904 tx->info[idx].skb = NULL; 2904 tx->info[idx].skb = NULL;
2905 do { 2905 do {
2906 len = pci_unmap_len(&tx->info[idx], len); 2906 len = dma_unmap_len(&tx->info[idx], len);
2907 if (len) { 2907 if (len) {
2908 if (tx->info[idx].skb != NULL) 2908 if (tx->info[idx].skb != NULL)
2909 pci_unmap_single(mgp->pdev, 2909 pci_unmap_single(mgp->pdev,
2910 pci_unmap_addr(&tx->info[idx], 2910 dma_unmap_addr(&tx->info[idx],
2911 bus), len, 2911 bus), len,
2912 PCI_DMA_TODEVICE); 2912 PCI_DMA_TODEVICE);
2913 else 2913 else
2914 pci_unmap_page(mgp->pdev, 2914 pci_unmap_page(mgp->pdev,
2915 pci_unmap_addr(&tx->info[idx], 2915 dma_unmap_addr(&tx->info[idx],
2916 bus), len, 2916 bus), len,
2917 PCI_DMA_TODEVICE); 2917 PCI_DMA_TODEVICE);
2918 pci_unmap_len_set(&tx->info[idx], len, 0); 2918 dma_unmap_len_set(&tx->info[idx], len, 0);
2919 tx->info[idx].skb = NULL; 2919 tx->info[idx].skb = NULL;
2920 } 2920 }
2921 idx = (idx + 1) & tx->mask; 2921 idx = (idx + 1) & tx->mask;
@@ -3002,7 +3002,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
3002{ 3002{
3003 struct myri10ge_priv *mgp = netdev_priv(dev); 3003 struct myri10ge_priv *mgp = netdev_priv(dev);
3004 struct myri10ge_cmd cmd; 3004 struct myri10ge_cmd cmd;
3005 struct dev_mc_list *mc_list; 3005 struct netdev_hw_addr *ha;
3006 __be32 data[2] = { 0, 0 }; 3006 __be32 data[2] = { 0, 0 };
3007 int err; 3007 int err;
3008 3008
@@ -3039,8 +3039,8 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
3039 } 3039 }
3040 3040
3041 /* Walk the multicast list, and add each address */ 3041 /* Walk the multicast list, and add each address */
3042 netdev_for_each_mc_addr(mc_list, dev) { 3042 netdev_for_each_mc_addr(ha, dev) {
3043 memcpy(data, &mc_list->dmi_addr, 6); 3043 memcpy(data, &ha->addr, 6);
3044 cmd.data0 = ntohl(data[0]); 3044 cmd.data0 = ntohl(data[0]);
3045 cmd.data1 = ntohl(data[1]); 3045 cmd.data1 = ntohl(data[1]);
3046 err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP, 3046 err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP,
@@ -3048,7 +3048,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
3048 3048
3049 if (err != 0) { 3049 if (err != 0) {
3050 netdev_err(dev, "Failed MXGEFW_JOIN_MULTICAST_GROUP, error status:%d %pM\n", 3050 netdev_err(dev, "Failed MXGEFW_JOIN_MULTICAST_GROUP, error status:%d %pM\n",
3051 err, mc_list->dmi_addr); 3051 err, ha->addr);
3052 goto abort; 3052 goto abort;
3053 } 3053 }
3054 } 3054 }