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.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 676c513e12fc..e0b47cc8a86e 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -64,6 +64,7 @@
64#include <linux/moduleparam.h> 64#include <linux/moduleparam.h>
65#include <linux/io.h> 65#include <linux/io.h>
66#include <linux/log2.h> 66#include <linux/log2.h>
67#include <linux/slab.h>
67#include <net/checksum.h> 68#include <net/checksum.h>
68#include <net/ip.h> 69#include <net/ip.h>
69#include <net/tcp.h> 70#include <net/tcp.h>
@@ -109,15 +110,15 @@ MODULE_LICENSE("Dual BSD/GPL");
109struct myri10ge_rx_buffer_state { 110struct myri10ge_rx_buffer_state {
110 struct page *page; 111 struct page *page;
111 int page_offset; 112 int page_offset;
112 DECLARE_PCI_UNMAP_ADDR(bus) 113 DEFINE_DMA_UNMAP_ADDR(bus);
113 DECLARE_PCI_UNMAP_LEN(len) 114 DEFINE_DMA_UNMAP_LEN(len);
114}; 115};
115 116
116struct myri10ge_tx_buffer_state { 117struct myri10ge_tx_buffer_state {
117 struct sk_buff *skb; 118 struct sk_buff *skb;
118 int last; 119 int last;
119 DECLARE_PCI_UNMAP_ADDR(bus) 120 DEFINE_DMA_UNMAP_ADDR(bus);
120 DECLARE_PCI_UNMAP_LEN(len) 121 DEFINE_DMA_UNMAP_LEN(len);
121}; 122};
122 123
123struct myri10ge_cmd { 124struct myri10ge_cmd {
@@ -1233,7 +1234,7 @@ myri10ge_alloc_rx_pages(struct myri10ge_priv *mgp, struct myri10ge_rx_buf *rx,
1233 rx->info[idx].page_offset = rx->page_offset; 1234 rx->info[idx].page_offset = rx->page_offset;
1234 /* note that this is the address of the start of the 1235 /* note that this is the address of the start of the
1235 * page */ 1236 * page */
1236 pci_unmap_addr_set(&rx->info[idx], bus, rx->bus); 1237 dma_unmap_addr_set(&rx->info[idx], bus, rx->bus);
1237 rx->shadow[idx].addr_low = 1238 rx->shadow[idx].addr_low =
1238 htonl(MYRI10GE_LOWPART_TO_U32(rx->bus) + rx->page_offset); 1239 htonl(MYRI10GE_LOWPART_TO_U32(rx->bus) + rx->page_offset);
1239 rx->shadow[idx].addr_high = 1240 rx->shadow[idx].addr_high =
@@ -1265,7 +1266,7 @@ myri10ge_unmap_rx_page(struct pci_dev *pdev,
1265 /* 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 */
1266 if (bytes >= MYRI10GE_ALLOC_SIZE / 2 || 1267 if (bytes >= MYRI10GE_ALLOC_SIZE / 2 ||
1267 (info->page_offset + 2 * bytes) > MYRI10GE_ALLOC_SIZE) { 1268 (info->page_offset + 2 * bytes) > MYRI10GE_ALLOC_SIZE) {
1268 pci_unmap_page(pdev, (pci_unmap_addr(info, bus) 1269 pci_unmap_page(pdev, (dma_unmap_addr(info, bus)
1269 & ~(MYRI10GE_ALLOC_SIZE - 1)), 1270 & ~(MYRI10GE_ALLOC_SIZE - 1)),
1270 MYRI10GE_ALLOC_SIZE, PCI_DMA_FROMDEVICE); 1271 MYRI10GE_ALLOC_SIZE, PCI_DMA_FROMDEVICE);
1271 } 1272 }
@@ -1372,21 +1373,21 @@ myri10ge_tx_done(struct myri10ge_slice_state *ss, int mcp_index)
1372 tx->info[idx].last = 0; 1373 tx->info[idx].last = 0;
1373 } 1374 }
1374 tx->done++; 1375 tx->done++;
1375 len = pci_unmap_len(&tx->info[idx], len); 1376 len = dma_unmap_len(&tx->info[idx], len);
1376 pci_unmap_len_set(&tx->info[idx], len, 0); 1377 dma_unmap_len_set(&tx->info[idx], len, 0);
1377 if (skb) { 1378 if (skb) {
1378 ss->stats.tx_bytes += skb->len; 1379 ss->stats.tx_bytes += skb->len;
1379 ss->stats.tx_packets++; 1380 ss->stats.tx_packets++;
1380 dev_kfree_skb_irq(skb); 1381 dev_kfree_skb_irq(skb);
1381 if (len) 1382 if (len)
1382 pci_unmap_single(pdev, 1383 pci_unmap_single(pdev,
1383 pci_unmap_addr(&tx->info[idx], 1384 dma_unmap_addr(&tx->info[idx],
1384 bus), len, 1385 bus), len,
1385 PCI_DMA_TODEVICE); 1386 PCI_DMA_TODEVICE);
1386 } else { 1387 } else {
1387 if (len) 1388 if (len)
1388 pci_unmap_page(pdev, 1389 pci_unmap_page(pdev,
1389 pci_unmap_addr(&tx->info[idx], 1390 dma_unmap_addr(&tx->info[idx],
1390 bus), len, 1391 bus), len,
1391 PCI_DMA_TODEVICE); 1392 PCI_DMA_TODEVICE);
1392 } 1393 }
@@ -1689,7 +1690,7 @@ myri10ge_set_pauseparam(struct net_device *netdev,
1689 if (pause->tx_pause != mgp->pause) 1690 if (pause->tx_pause != mgp->pause)
1690 return myri10ge_change_pause(mgp, pause->tx_pause); 1691 return myri10ge_change_pause(mgp, pause->tx_pause);
1691 if (pause->rx_pause != mgp->pause) 1692 if (pause->rx_pause != mgp->pause)
1692 return myri10ge_change_pause(mgp, pause->tx_pause); 1693 return myri10ge_change_pause(mgp, pause->rx_pause);
1693 if (pause->autoneg != 0) 1694 if (pause->autoneg != 0)
1694 return -EINVAL; 1695 return -EINVAL;
1695 return 0; 1696 return 0;
@@ -2093,20 +2094,20 @@ static void myri10ge_free_rings(struct myri10ge_slice_state *ss)
2093 /* Mark as free */ 2094 /* Mark as free */
2094 tx->info[idx].skb = NULL; 2095 tx->info[idx].skb = NULL;
2095 tx->done++; 2096 tx->done++;
2096 len = pci_unmap_len(&tx->info[idx], len); 2097 len = dma_unmap_len(&tx->info[idx], len);
2097 pci_unmap_len_set(&tx->info[idx], len, 0); 2098 dma_unmap_len_set(&tx->info[idx], len, 0);
2098 if (skb) { 2099 if (skb) {
2099 ss->stats.tx_dropped++; 2100 ss->stats.tx_dropped++;
2100 dev_kfree_skb_any(skb); 2101 dev_kfree_skb_any(skb);
2101 if (len) 2102 if (len)
2102 pci_unmap_single(mgp->pdev, 2103 pci_unmap_single(mgp->pdev,
2103 pci_unmap_addr(&tx->info[idx], 2104 dma_unmap_addr(&tx->info[idx],
2104 bus), len, 2105 bus), len,
2105 PCI_DMA_TODEVICE); 2106 PCI_DMA_TODEVICE);
2106 } else { 2107 } else {
2107 if (len) 2108 if (len)
2108 pci_unmap_page(mgp->pdev, 2109 pci_unmap_page(mgp->pdev,
2109 pci_unmap_addr(&tx->info[idx], 2110 dma_unmap_addr(&tx->info[idx],
2110 bus), len, 2111 bus), len,
2111 PCI_DMA_TODEVICE); 2112 PCI_DMA_TODEVICE);
2112 } 2113 }
@@ -2756,12 +2757,12 @@ again:
2756 } 2757 }
2757 2758
2758 /* map the skb for DMA */ 2759 /* map the skb for DMA */
2759 len = skb->len - skb->data_len; 2760 len = skb_headlen(skb);
2760 idx = tx->req & tx->mask; 2761 idx = tx->req & tx->mask;
2761 tx->info[idx].skb = skb; 2762 tx->info[idx].skb = skb;
2762 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);
2763 pci_unmap_addr_set(&tx->info[idx], bus, bus); 2764 dma_unmap_addr_set(&tx->info[idx], bus, bus);
2764 pci_unmap_len_set(&tx->info[idx], len, len); 2765 dma_unmap_len_set(&tx->info[idx], len, len);
2765 2766
2766 frag_cnt = skb_shinfo(skb)->nr_frags; 2767 frag_cnt = skb_shinfo(skb)->nr_frags;
2767 frag_idx = 0; 2768 frag_idx = 0;
@@ -2864,8 +2865,8 @@ again:
2864 len = frag->size; 2865 len = frag->size;
2865 bus = pci_map_page(mgp->pdev, frag->page, frag->page_offset, 2866 bus = pci_map_page(mgp->pdev, frag->page, frag->page_offset,
2866 len, PCI_DMA_TODEVICE); 2867 len, PCI_DMA_TODEVICE);
2867 pci_unmap_addr_set(&tx->info[idx], bus, bus); 2868 dma_unmap_addr_set(&tx->info[idx], bus, bus);
2868 pci_unmap_len_set(&tx->info[idx], len, len); 2869 dma_unmap_len_set(&tx->info[idx], len, len);
2869 } 2870 }
2870 2871
2871 (req - rdma_count)->rdma_count = rdma_count; 2872 (req - rdma_count)->rdma_count = rdma_count;
@@ -2902,19 +2903,19 @@ abort_linearize:
2902 idx = tx->req & tx->mask; 2903 idx = tx->req & tx->mask;
2903 tx->info[idx].skb = NULL; 2904 tx->info[idx].skb = NULL;
2904 do { 2905 do {
2905 len = pci_unmap_len(&tx->info[idx], len); 2906 len = dma_unmap_len(&tx->info[idx], len);
2906 if (len) { 2907 if (len) {
2907 if (tx->info[idx].skb != NULL) 2908 if (tx->info[idx].skb != NULL)
2908 pci_unmap_single(mgp->pdev, 2909 pci_unmap_single(mgp->pdev,
2909 pci_unmap_addr(&tx->info[idx], 2910 dma_unmap_addr(&tx->info[idx],
2910 bus), len, 2911 bus), len,
2911 PCI_DMA_TODEVICE); 2912 PCI_DMA_TODEVICE);
2912 else 2913 else
2913 pci_unmap_page(mgp->pdev, 2914 pci_unmap_page(mgp->pdev,
2914 pci_unmap_addr(&tx->info[idx], 2915 dma_unmap_addr(&tx->info[idx],
2915 bus), len, 2916 bus), len,
2916 PCI_DMA_TODEVICE); 2917 PCI_DMA_TODEVICE);
2917 pci_unmap_len_set(&tx->info[idx], len, 0); 2918 dma_unmap_len_set(&tx->info[idx], len, 0);
2918 tx->info[idx].skb = NULL; 2919 tx->info[idx].skb = NULL;
2919 } 2920 }
2920 idx = (idx + 1) & tx->mask; 2921 idx = (idx + 1) & tx->mask;
@@ -3001,7 +3002,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
3001{ 3002{
3002 struct myri10ge_priv *mgp = netdev_priv(dev); 3003 struct myri10ge_priv *mgp = netdev_priv(dev);
3003 struct myri10ge_cmd cmd; 3004 struct myri10ge_cmd cmd;
3004 struct dev_mc_list *mc_list; 3005 struct netdev_hw_addr *ha;
3005 __be32 data[2] = { 0, 0 }; 3006 __be32 data[2] = { 0, 0 };
3006 int err; 3007 int err;
3007 3008
@@ -3038,8 +3039,8 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
3038 } 3039 }
3039 3040
3040 /* Walk the multicast list, and add each address */ 3041 /* Walk the multicast list, and add each address */
3041 netdev_for_each_mc_addr(mc_list, dev) { 3042 netdev_for_each_mc_addr(ha, dev) {
3042 memcpy(data, &mc_list->dmi_addr, 6); 3043 memcpy(data, &ha->addr, 6);
3043 cmd.data0 = ntohl(data[0]); 3044 cmd.data0 = ntohl(data[0]);
3044 cmd.data1 = ntohl(data[1]); 3045 cmd.data1 = ntohl(data[1]);
3045 err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP, 3046 err = myri10ge_send_cmd(mgp, MXGEFW_JOIN_MULTICAST_GROUP,
@@ -3047,7 +3048,7 @@ static void myri10ge_set_multicast_list(struct net_device *dev)
3047 3048
3048 if (err != 0) { 3049 if (err != 0) {
3049 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",
3050 err, mc_list->dmi_addr); 3051 err, ha->addr);
3051 goto abort; 3052 goto abort;
3052 } 3053 }
3053 } 3054 }
@@ -3687,7 +3688,6 @@ static void myri10ge_probe_slices(struct myri10ge_priv *mgp)
3687 if (status != 0) { 3688 if (status != 0) {
3688 dev_err(&mgp->pdev->dev, "failed reset\n"); 3689 dev_err(&mgp->pdev->dev, "failed reset\n");
3689 goto abort_with_fw; 3690 goto abort_with_fw;
3690 return;
3691 } 3691 }
3692 3692
3693 mgp->max_intr_slots = cmd.data0 / sizeof(struct mcp_slot); 3693 mgp->max_intr_slots = cmd.data0 / sizeof(struct mcp_slot);