aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/mlx4
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/mlx4')
-rw-r--r--drivers/net/mlx4/alloc.c37
-rw-r--r--drivers/net/mlx4/cmd.c1
-rw-r--r--drivers/net/mlx4/cq.c1
-rw-r--r--drivers/net/mlx4/en_main.c1
-rw-r--r--drivers/net/mlx4/en_netdev.c1
-rw-r--r--drivers/net/mlx4/en_resources.c1
-rw-r--r--drivers/net/mlx4/en_rx.c11
-rw-r--r--drivers/net/mlx4/en_tx.c3
-rw-r--r--drivers/net/mlx4/eq.c1
-rw-r--r--drivers/net/mlx4/fw.c3
-rw-r--r--drivers/net/mlx4/icm.c1
-rw-r--r--drivers/net/mlx4/intf.c2
-rw-r--r--drivers/net/mlx4/main.c6
-rw-r--r--drivers/net/mlx4/mcg.c1
-rw-r--r--drivers/net/mlx4/mlx4_en.h2
-rw-r--r--drivers/net/mlx4/mr.c1
-rw-r--r--drivers/net/mlx4/profile.c2
-rw-r--r--drivers/net/mlx4/qp.c1
-rw-r--r--drivers/net/mlx4/sense.c2
-rw-r--r--drivers/net/mlx4/srq.c1
20 files changed, 34 insertions, 45 deletions
diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c
index ad95d5f7b630..8c8515619b8e 100644
--- a/drivers/net/mlx4/alloc.c
+++ b/drivers/net/mlx4/alloc.c
@@ -72,35 +72,6 @@ void mlx4_bitmap_free(struct mlx4_bitmap *bitmap, u32 obj)
72 mlx4_bitmap_free_range(bitmap, obj, 1); 72 mlx4_bitmap_free_range(bitmap, obj, 1);
73} 73}
74 74
75static unsigned long find_aligned_range(unsigned long *bitmap,
76 u32 start, u32 nbits,
77 int len, int align)
78{
79 unsigned long end, i;
80
81again:
82 start = ALIGN(start, align);
83
84 while ((start < nbits) && test_bit(start, bitmap))
85 start += align;
86
87 if (start >= nbits)
88 return -1;
89
90 end = start+len;
91 if (end > nbits)
92 return -1;
93
94 for (i = start + 1; i < end; i++) {
95 if (test_bit(i, bitmap)) {
96 start = i + 1;
97 goto again;
98 }
99 }
100
101 return start;
102}
103
104u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt, int align) 75u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt, int align)
105{ 76{
106 u32 obj, i; 77 u32 obj, i;
@@ -110,13 +81,13 @@ u32 mlx4_bitmap_alloc_range(struct mlx4_bitmap *bitmap, int cnt, int align)
110 81
111 spin_lock(&bitmap->lock); 82 spin_lock(&bitmap->lock);
112 83
113 obj = find_aligned_range(bitmap->table, bitmap->last, 84 obj = bitmap_find_next_zero_area(bitmap->table, bitmap->max,
114 bitmap->max, cnt, align); 85 bitmap->last, cnt, align - 1);
115 if (obj >= bitmap->max) { 86 if (obj >= bitmap->max) {
116 bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top) 87 bitmap->top = (bitmap->top + bitmap->max + bitmap->reserved_top)
117 & bitmap->mask; 88 & bitmap->mask;
118 obj = find_aligned_range(bitmap->table, 0, bitmap->max, 89 obj = bitmap_find_next_zero_area(bitmap->table, bitmap->max,
119 cnt, align); 90 0, cnt, align - 1);
120 } 91 }
121 92
122 if (obj < bitmap->max) { 93 if (obj < bitmap->max) {
diff --git a/drivers/net/mlx4/cmd.c b/drivers/net/mlx4/cmd.c
index 65ec77dc31f5..23cee7b6af91 100644
--- a/drivers/net/mlx4/cmd.c
+++ b/drivers/net/mlx4/cmd.c
@@ -33,6 +33,7 @@
33 */ 33 */
34 34
35#include <linux/sched.h> 35#include <linux/sched.h>
36#include <linux/slab.h>
36#include <linux/pci.h> 37#include <linux/pci.h>
37#include <linux/errno.h> 38#include <linux/errno.h>
38 39
diff --git a/drivers/net/mlx4/cq.c b/drivers/net/mlx4/cq.c
index ccfe276943f0..7cd34e9c7c7e 100644
--- a/drivers/net/mlx4/cq.c
+++ b/drivers/net/mlx4/cq.c
@@ -35,6 +35,7 @@
35 */ 35 */
36 36
37#include <linux/hardirq.h> 37#include <linux/hardirq.h>
38#include <linux/gfp.h>
38 39
39#include <linux/mlx4/cmd.h> 40#include <linux/mlx4/cmd.h>
40#include <linux/mlx4/cq.h> 41#include <linux/mlx4/cq.h>
diff --git a/drivers/net/mlx4/en_main.c b/drivers/net/mlx4/en_main.c
index 507e11fce9ed..cbabf14f95d0 100644
--- a/drivers/net/mlx4/en_main.c
+++ b/drivers/net/mlx4/en_main.c
@@ -35,6 +35,7 @@
35#include <linux/module.h> 35#include <linux/module.h>
36#include <linux/delay.h> 36#include <linux/delay.h>
37#include <linux/netdevice.h> 37#include <linux/netdevice.h>
38#include <linux/slab.h>
38 39
39#include <linux/mlx4/driver.h> 40#include <linux/mlx4/driver.h>
40#include <linux/mlx4/device.h> 41#include <linux/mlx4/device.h>
diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c
index c48b0f4b17b7..73c3d20c6453 100644
--- a/drivers/net/mlx4/en_netdev.c
+++ b/drivers/net/mlx4/en_netdev.c
@@ -35,6 +35,7 @@
35#include <linux/tcp.h> 35#include <linux/tcp.h>
36#include <linux/if_vlan.h> 36#include <linux/if_vlan.h>
37#include <linux/delay.h> 37#include <linux/delay.h>
38#include <linux/slab.h>
38 39
39#include <linux/mlx4/driver.h> 40#include <linux/mlx4/driver.h>
40#include <linux/mlx4/device.h> 41#include <linux/mlx4/device.h>
diff --git a/drivers/net/mlx4/en_resources.c b/drivers/net/mlx4/en_resources.c
index 16256784a943..0dfb4ec8a9dd 100644
--- a/drivers/net/mlx4/en_resources.c
+++ b/drivers/net/mlx4/en_resources.c
@@ -31,6 +31,7 @@
31 * 31 *
32 */ 32 */
33 33
34#include <linux/slab.h>
34#include <linux/vmalloc.h> 35#include <linux/vmalloc.h>
35#include <linux/mlx4/qp.h> 36#include <linux/mlx4/qp.h>
36 37
diff --git a/drivers/net/mlx4/en_rx.c b/drivers/net/mlx4/en_rx.c
index 03b781a7a182..8e2fcb7103c3 100644
--- a/drivers/net/mlx4/en_rx.c
+++ b/drivers/net/mlx4/en_rx.c
@@ -32,6 +32,7 @@
32 */ 32 */
33 33
34#include <linux/mlx4/cq.h> 34#include <linux/mlx4/cq.h>
35#include <linux/slab.h>
35#include <linux/mlx4/qp.h> 36#include <linux/mlx4/qp.h>
36#include <linux/skbuff.h> 37#include <linux/skbuff.h>
37#include <linux/if_ether.h> 38#include <linux/if_ether.h>
@@ -204,7 +205,7 @@ static void mlx4_en_free_rx_desc(struct mlx4_en_priv *priv,
204 en_dbg(DRV, priv, "Freeing fragment:%d\n", nr); 205 en_dbg(DRV, priv, "Freeing fragment:%d\n", nr);
205 dma = be64_to_cpu(rx_desc->data[nr].addr); 206 dma = be64_to_cpu(rx_desc->data[nr].addr);
206 207
207 en_dbg(DRV, priv, "Unmaping buffer at dma:0x%llx\n", (u64) dma); 208 en_dbg(DRV, priv, "Unmapping buffer at dma:0x%llx\n", (u64) dma);
208 pci_unmap_single(mdev->pdev, dma, skb_frags[nr].size, 209 pci_unmap_single(mdev->pdev, dma, skb_frags[nr].size,
209 PCI_DMA_FROMDEVICE); 210 PCI_DMA_FROMDEVICE);
210 put_page(skb_frags[nr].page); 211 put_page(skb_frags[nr].page);
@@ -508,11 +509,11 @@ static struct sk_buff *mlx4_en_rx_skb(struct mlx4_en_priv *priv,
508 /* We are copying all relevant data to the skb - temporarily 509 /* We are copying all relevant data to the skb - temporarily
509 * synch buffers for the copy */ 510 * synch buffers for the copy */
510 dma = be64_to_cpu(rx_desc->data[0].addr); 511 dma = be64_to_cpu(rx_desc->data[0].addr);
511 dma_sync_single_range_for_cpu(&mdev->pdev->dev, dma, 0, 512 dma_sync_single_for_cpu(&mdev->pdev->dev, dma, length,
512 length, DMA_FROM_DEVICE); 513 DMA_FROM_DEVICE);
513 skb_copy_to_linear_data(skb, va, length); 514 skb_copy_to_linear_data(skb, va, length);
514 dma_sync_single_range_for_device(&mdev->pdev->dev, dma, 0, 515 dma_sync_single_for_device(&mdev->pdev->dev, dma, length,
515 length, DMA_FROM_DEVICE); 516 DMA_FROM_DEVICE);
516 skb->tail += length; 517 skb->tail += length;
517 } else { 518 } else {
518 519
diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c
index 8c7279965b44..580968f304eb 100644
--- a/drivers/net/mlx4/en_tx.c
+++ b/drivers/net/mlx4/en_tx.c
@@ -33,6 +33,7 @@
33 33
34#include <asm/page.h> 34#include <asm/page.h>
35#include <linux/mlx4/cq.h> 35#include <linux/mlx4/cq.h>
36#include <linux/slab.h>
36#include <linux/mlx4/qp.h> 37#include <linux/mlx4/qp.h>
37#include <linux/skbuff.h> 38#include <linux/skbuff.h>
38#include <linux/if_vlan.h> 39#include <linux/if_vlan.h>
@@ -47,7 +48,7 @@ enum {
47static int inline_thold __read_mostly = MAX_INLINE; 48static int inline_thold __read_mostly = MAX_INLINE;
48 49
49module_param_named(inline_thold, inline_thold, int, 0444); 50module_param_named(inline_thold, inline_thold, int, 0444);
50MODULE_PARM_DESC(inline_thold, "treshold for using inline data"); 51MODULE_PARM_DESC(inline_thold, "threshold for using inline data");
51 52
52int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv, 53int mlx4_en_create_tx_ring(struct mlx4_en_priv *priv,
53 struct mlx4_en_tx_ring *ring, u32 size, 54 struct mlx4_en_tx_ring *ring, u32 size,
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index bffb7995cb70..7365bf488b81 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -32,6 +32,7 @@
32 */ 32 */
33 33
34#include <linux/interrupt.h> 34#include <linux/interrupt.h>
35#include <linux/slab.h>
35#include <linux/mm.h> 36#include <linux/mm.h>
36#include <linux/dma-mapping.h> 37#include <linux/dma-mapping.h>
37 38
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c
index 3c16602172fc..04f42ae1eda0 100644
--- a/drivers/net/mlx4/fw.c
+++ b/drivers/net/mlx4/fw.c
@@ -90,6 +90,7 @@ static void dump_dev_cap_flags(struct mlx4_dev *dev, u32 flags)
90 [ 9] = "Q_Key violation counter", 90 [ 9] = "Q_Key violation counter",
91 [10] = "VMM", 91 [10] = "VMM",
92 [12] = "DPDP", 92 [12] = "DPDP",
93 [15] = "Big LSO headers",
93 [16] = "MW support", 94 [16] = "MW support",
94 [17] = "APM support", 95 [17] = "APM support",
95 [18] = "Atomic ops support", 96 [18] = "Atomic ops support",
@@ -235,7 +236,7 @@ int mlx4_QUERY_DEV_CAP(struct mlx4_dev *dev, struct mlx4_dev_cap *dev_cap)
235 MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_MPT_OFFSET); 236 MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_MPT_OFFSET);
236 dev_cap->max_mpts = 1 << (field & 0x3f); 237 dev_cap->max_mpts = 1 << (field & 0x3f);
237 MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_EQ_OFFSET); 238 MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_EQ_OFFSET);
238 dev_cap->reserved_eqs = 1 << (field & 0xf); 239 dev_cap->reserved_eqs = field & 0xf;
239 MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_EQ_OFFSET); 240 MLX4_GET(field, outbox, QUERY_DEV_CAP_MAX_EQ_OFFSET);
240 dev_cap->max_eqs = 1 << (field & 0xf); 241 dev_cap->max_eqs = 1 << (field & 0xf);
241 MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_MTT_OFFSET); 242 MLX4_GET(field, outbox, QUERY_DEV_CAP_RSVD_MTT_OFFSET);
diff --git a/drivers/net/mlx4/icm.c b/drivers/net/mlx4/icm.c
index 04b382fcb8c8..57288ca1395f 100644
--- a/drivers/net/mlx4/icm.c
+++ b/drivers/net/mlx4/icm.c
@@ -34,6 +34,7 @@
34#include <linux/errno.h> 34#include <linux/errno.h>
35#include <linux/mm.h> 35#include <linux/mm.h>
36#include <linux/scatterlist.h> 36#include <linux/scatterlist.h>
37#include <linux/slab.h>
37 38
38#include <linux/mlx4/cmd.h> 39#include <linux/mlx4/cmd.h>
39 40
diff --git a/drivers/net/mlx4/intf.c b/drivers/net/mlx4/intf.c
index 0e7eb1038f9f..555067802751 100644
--- a/drivers/net/mlx4/intf.c
+++ b/drivers/net/mlx4/intf.c
@@ -31,6 +31,8 @@
31 * SOFTWARE. 31 * SOFTWARE.
32 */ 32 */
33 33
34#include <linux/slab.h>
35
34#include "mlx4.h" 36#include "mlx4.h"
35 37
36struct mlx4_device_context { 38struct mlx4_device_context {
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 291a505fd4fc..e3e0d54a7c87 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -38,6 +38,7 @@
38#include <linux/errno.h> 38#include <linux/errno.h>
39#include <linux/pci.h> 39#include <linux/pci.h>
40#include <linux/dma-mapping.h> 40#include <linux/dma-mapping.h>
41#include <linux/slab.h>
41 42
42#include <linux/mlx4/device.h> 43#include <linux/mlx4/device.h>
43#include <linux/mlx4/doorbell.h> 44#include <linux/mlx4/doorbell.h>
@@ -1023,6 +1024,7 @@ static int mlx4_init_port_info(struct mlx4_dev *dev, int port)
1023 info->port_attr.attr.mode = S_IRUGO | S_IWUSR; 1024 info->port_attr.attr.mode = S_IRUGO | S_IWUSR;
1024 info->port_attr.show = show_port_type; 1025 info->port_attr.show = show_port_type;
1025 info->port_attr.store = set_port_type; 1026 info->port_attr.store = set_port_type;
1027 sysfs_attr_init(&info->port_attr.attr);
1026 1028
1027 err = device_create_file(&dev->pdev->dev, &info->port_attr); 1029 err = device_create_file(&dev->pdev->dev, &info->port_attr);
1028 if (err) { 1030 if (err) {
@@ -1174,7 +1176,7 @@ static int __mlx4_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
1174 return 0; 1176 return 0;
1175 1177
1176err_port: 1178err_port:
1177 for (port = 1; port <= dev->caps.num_ports; port++) 1179 for (--port; port >= 1; --port)
1178 mlx4_cleanup_port_info(&priv->port[port]); 1180 mlx4_cleanup_port_info(&priv->port[port]);
1179 1181
1180 mlx4_cleanup_mcg_table(dev); 1182 mlx4_cleanup_mcg_table(dev);
@@ -1271,7 +1273,7 @@ int mlx4_restart_one(struct pci_dev *pdev)
1271 return __mlx4_init_one(pdev, NULL); 1273 return __mlx4_init_one(pdev, NULL);
1272} 1274}
1273 1275
1274static struct pci_device_id mlx4_pci_table[] = { 1276static DEFINE_PCI_DEVICE_TABLE(mlx4_pci_table) = {
1275 { PCI_VDEVICE(MELLANOX, 0x6340) }, /* MT25408 "Hermon" SDR */ 1277 { PCI_VDEVICE(MELLANOX, 0x6340) }, /* MT25408 "Hermon" SDR */
1276 { PCI_VDEVICE(MELLANOX, 0x634a) }, /* MT25408 "Hermon" DDR */ 1278 { PCI_VDEVICE(MELLANOX, 0x634a) }, /* MT25408 "Hermon" DDR */
1277 { PCI_VDEVICE(MELLANOX, 0x6354) }, /* MT25408 "Hermon" QDR */ 1279 { PCI_VDEVICE(MELLANOX, 0x6354) }, /* MT25408 "Hermon" QDR */
diff --git a/drivers/net/mlx4/mcg.c b/drivers/net/mlx4/mcg.c
index 5ccbce9866fe..c4f88b7ef7b6 100644
--- a/drivers/net/mlx4/mcg.c
+++ b/drivers/net/mlx4/mcg.c
@@ -32,7 +32,6 @@
32 */ 32 */
33 33
34#include <linux/string.h> 34#include <linux/string.h>
35#include <linux/slab.h>
36 35
37#include <linux/mlx4/cmd.h> 36#include <linux/mlx4/cmd.h>
38 37
diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h
index 4376147b0ea0..82c3ebc584e3 100644
--- a/drivers/net/mlx4/mlx4_en.h
+++ b/drivers/net/mlx4/mlx4_en.h
@@ -162,7 +162,7 @@ enum {
162#define MLX4_EN_DEF_RX_PAUSE 1 162#define MLX4_EN_DEF_RX_PAUSE 1
163#define MLX4_EN_DEF_TX_PAUSE 1 163#define MLX4_EN_DEF_TX_PAUSE 1
164 164
165/* Interval between sucessive polls in the Tx routine when polling is used 165/* Interval between successive polls in the Tx routine when polling is used
166 instead of interrupts (in per-core Tx rings) - should be power of 2 */ 166 instead of interrupts (in per-core Tx rings) - should be power of 2 */
167#define MLX4_EN_TX_POLL_MODER 16 167#define MLX4_EN_TX_POLL_MODER 16
168#define MLX4_EN_TX_POLL_TIMEOUT (HZ / 4) 168#define MLX4_EN_TX_POLL_TIMEOUT (HZ / 4)
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c
index ca7ab8e7b4cc..3dc69be4949f 100644
--- a/drivers/net/mlx4/mr.c
+++ b/drivers/net/mlx4/mr.c
@@ -33,6 +33,7 @@
33 */ 33 */
34 34
35#include <linux/errno.h> 35#include <linux/errno.h>
36#include <linux/slab.h>
36 37
37#include <linux/mlx4/cmd.h> 38#include <linux/mlx4/cmd.h>
38 39
diff --git a/drivers/net/mlx4/profile.c b/drivers/net/mlx4/profile.c
index ca25b9dc8378..5caf0115fa5b 100644
--- a/drivers/net/mlx4/profile.c
+++ b/drivers/net/mlx4/profile.c
@@ -32,6 +32,8 @@
32 * SOFTWARE. 32 * SOFTWARE.
33 */ 33 */
34 34
35#include <linux/slab.h>
36
35#include "mlx4.h" 37#include "mlx4.h"
36#include "fw.h" 38#include "fw.h"
37 39
diff --git a/drivers/net/mlx4/qp.c b/drivers/net/mlx4/qp.c
index 42ab9fc01d3e..ec9350e5f21a 100644
--- a/drivers/net/mlx4/qp.c
+++ b/drivers/net/mlx4/qp.c
@@ -33,6 +33,7 @@
33 * SOFTWARE. 33 * SOFTWARE.
34 */ 34 */
35 35
36#include <linux/gfp.h>
36#include <linux/mlx4/cmd.h> 37#include <linux/mlx4/cmd.h>
37#include <linux/mlx4/qp.h> 38#include <linux/mlx4/qp.h>
38 39
diff --git a/drivers/net/mlx4/sense.c b/drivers/net/mlx4/sense.c
index f36ae691cab3..015fbe785c13 100644
--- a/drivers/net/mlx4/sense.c
+++ b/drivers/net/mlx4/sense.c
@@ -53,7 +53,7 @@ static int mlx4_SENSE_PORT(struct mlx4_dev *dev, int port,
53 53
54 if (out_param > 2) { 54 if (out_param > 2) {
55 mlx4_err(dev, "Sense returned illegal value: 0x%llx\n", out_param); 55 mlx4_err(dev, "Sense returned illegal value: 0x%llx\n", out_param);
56 return EINVAL; 56 return -EINVAL;
57 } 57 }
58 58
59 *type = out_param; 59 *type = out_param;
diff --git a/drivers/net/mlx4/srq.c b/drivers/net/mlx4/srq.c
index 1377d0dc8f1f..3b07b80a0456 100644
--- a/drivers/net/mlx4/srq.c
+++ b/drivers/net/mlx4/srq.c
@@ -32,6 +32,7 @@
32 */ 32 */
33 33
34#include <linux/mlx4/cmd.h> 34#include <linux/mlx4/cmd.h>
35#include <linux/gfp.h>
35 36
36#include "mlx4.h" 37#include "mlx4.h"
37#include "icm.h" 38#include "icm.h"