diff options
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/addr.c | 30 | ||||
-rw-r--r-- | drivers/infiniband/core/cm.c | 4 | ||||
-rw-r--r-- | drivers/infiniband/core/uverbs.h | 2 | ||||
-rw-r--r-- | drivers/infiniband/core/uverbs_main.c | 8 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_allocator.c | 15 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/Kconfig | 3 | ||||
-rw-r--r-- | drivers/infiniband/ulp/srp/ib_srp.c | 19 |
7 files changed, 52 insertions, 29 deletions
diff --git a/drivers/infiniband/core/addr.c b/drivers/infiniband/core/addr.c index d294bbc42f09..1205e8027829 100644 --- a/drivers/infiniband/core/addr.c +++ b/drivers/infiniband/core/addr.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <net/arp.h> | 35 | #include <net/arp.h> |
36 | #include <net/neighbour.h> | 36 | #include <net/neighbour.h> |
37 | #include <net/route.h> | 37 | #include <net/route.h> |
38 | #include <net/netevent.h> | ||
38 | #include <rdma/ib_addr.h> | 39 | #include <rdma/ib_addr.h> |
39 | 40 | ||
40 | MODULE_AUTHOR("Sean Hefty"); | 41 | MODULE_AUTHOR("Sean Hefty"); |
@@ -326,25 +327,22 @@ void rdma_addr_cancel(struct rdma_dev_addr *addr) | |||
326 | } | 327 | } |
327 | EXPORT_SYMBOL(rdma_addr_cancel); | 328 | EXPORT_SYMBOL(rdma_addr_cancel); |
328 | 329 | ||
329 | static int addr_arp_recv(struct sk_buff *skb, struct net_device *dev, | 330 | static int netevent_callback(struct notifier_block *self, unsigned long event, |
330 | struct packet_type *pkt, struct net_device *orig_dev) | 331 | void *ctx) |
331 | { | 332 | { |
332 | struct arphdr *arp_hdr; | 333 | if (event == NETEVENT_NEIGH_UPDATE) { |
334 | struct neighbour *neigh = ctx; | ||
333 | 335 | ||
334 | arp_hdr = (struct arphdr *) skb->nh.raw; | 336 | if (neigh->dev->type == ARPHRD_INFINIBAND && |
335 | 337 | (neigh->nud_state & NUD_VALID)) { | |
336 | if (arp_hdr->ar_op == htons(ARPOP_REQUEST) || | 338 | set_timeout(jiffies); |
337 | arp_hdr->ar_op == htons(ARPOP_REPLY)) | 339 | } |
338 | set_timeout(jiffies); | 340 | } |
339 | |||
340 | kfree_skb(skb); | ||
341 | return 0; | 341 | return 0; |
342 | } | 342 | } |
343 | 343 | ||
344 | static struct packet_type addr_arp = { | 344 | static struct notifier_block nb = { |
345 | .type = __constant_htons(ETH_P_ARP), | 345 | .notifier_call = netevent_callback |
346 | .func = addr_arp_recv, | ||
347 | .af_packet_priv = (void*) 1, | ||
348 | }; | 346 | }; |
349 | 347 | ||
350 | static int addr_init(void) | 348 | static int addr_init(void) |
@@ -353,13 +351,13 @@ static int addr_init(void) | |||
353 | if (!addr_wq) | 351 | if (!addr_wq) |
354 | return -ENOMEM; | 352 | return -ENOMEM; |
355 | 353 | ||
356 | dev_add_pack(&addr_arp); | 354 | register_netevent_notifier(&nb); |
357 | return 0; | 355 | return 0; |
358 | } | 356 | } |
359 | 357 | ||
360 | static void addr_cleanup(void) | 358 | static void addr_cleanup(void) |
361 | { | 359 | { |
362 | dev_remove_pack(&addr_arp); | 360 | unregister_netevent_notifier(&nb); |
363 | destroy_workqueue(addr_wq); | 361 | destroy_workqueue(addr_wq); |
364 | } | 362 | } |
365 | 363 | ||
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c index f85c97f7500a..0de335b7bfc2 100644 --- a/drivers/infiniband/core/cm.c +++ b/drivers/infiniband/core/cm.c | |||
@@ -975,8 +975,10 @@ int ib_send_cm_req(struct ib_cm_id *cm_id, | |||
975 | 975 | ||
976 | cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv-> | 976 | cm_id_priv->timewait_info = cm_create_timewait_info(cm_id_priv-> |
977 | id.local_id); | 977 | id.local_id); |
978 | if (IS_ERR(cm_id_priv->timewait_info)) | 978 | if (IS_ERR(cm_id_priv->timewait_info)) { |
979 | ret = PTR_ERR(cm_id_priv->timewait_info); | ||
979 | goto out; | 980 | goto out; |
981 | } | ||
980 | 982 | ||
981 | ret = cm_init_av_by_path(param->primary_path, &cm_id_priv->av); | 983 | ret = cm_init_av_by_path(param->primary_path, &cm_id_priv->av); |
982 | if (ret) | 984 | if (ret) |
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h index bb9bee56a824..102a59c033ff 100644 --- a/drivers/infiniband/core/uverbs.h +++ b/drivers/infiniband/core/uverbs.h | |||
@@ -42,6 +42,7 @@ | |||
42 | #include <linux/kref.h> | 42 | #include <linux/kref.h> |
43 | #include <linux/idr.h> | 43 | #include <linux/idr.h> |
44 | #include <linux/mutex.h> | 44 | #include <linux/mutex.h> |
45 | #include <linux/completion.h> | ||
45 | 46 | ||
46 | #include <rdma/ib_verbs.h> | 47 | #include <rdma/ib_verbs.h> |
47 | #include <rdma/ib_user_verbs.h> | 48 | #include <rdma/ib_user_verbs.h> |
@@ -69,6 +70,7 @@ | |||
69 | 70 | ||
70 | struct ib_uverbs_device { | 71 | struct ib_uverbs_device { |
71 | struct kref ref; | 72 | struct kref ref; |
73 | struct completion comp; | ||
72 | int devnum; | 74 | int devnum; |
73 | struct cdev *dev; | 75 | struct cdev *dev; |
74 | struct class_device *class_dev; | 76 | struct class_device *class_dev; |
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c index e725cccc7cde..4e16314e8e6d 100644 --- a/drivers/infiniband/core/uverbs_main.c +++ b/drivers/infiniband/core/uverbs_main.c | |||
@@ -122,7 +122,7 @@ static void ib_uverbs_release_dev(struct kref *ref) | |||
122 | struct ib_uverbs_device *dev = | 122 | struct ib_uverbs_device *dev = |
123 | container_of(ref, struct ib_uverbs_device, ref); | 123 | container_of(ref, struct ib_uverbs_device, ref); |
124 | 124 | ||
125 | kfree(dev); | 125 | complete(&dev->comp); |
126 | } | 126 | } |
127 | 127 | ||
128 | void ib_uverbs_release_ucq(struct ib_uverbs_file *file, | 128 | void ib_uverbs_release_ucq(struct ib_uverbs_file *file, |
@@ -740,6 +740,7 @@ static void ib_uverbs_add_one(struct ib_device *device) | |||
740 | return; | 740 | return; |
741 | 741 | ||
742 | kref_init(&uverbs_dev->ref); | 742 | kref_init(&uverbs_dev->ref); |
743 | init_completion(&uverbs_dev->comp); | ||
743 | 744 | ||
744 | spin_lock(&map_lock); | 745 | spin_lock(&map_lock); |
745 | uverbs_dev->devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES); | 746 | uverbs_dev->devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES); |
@@ -793,6 +794,8 @@ err_cdev: | |||
793 | 794 | ||
794 | err: | 795 | err: |
795 | kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); | 796 | kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); |
797 | wait_for_completion(&uverbs_dev->comp); | ||
798 | kfree(uverbs_dev); | ||
796 | return; | 799 | return; |
797 | } | 800 | } |
798 | 801 | ||
@@ -812,7 +815,10 @@ static void ib_uverbs_remove_one(struct ib_device *device) | |||
812 | spin_unlock(&map_lock); | 815 | spin_unlock(&map_lock); |
813 | 816 | ||
814 | clear_bit(uverbs_dev->devnum, dev_map); | 817 | clear_bit(uverbs_dev->devnum, dev_map); |
818 | |||
815 | kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); | 819 | kref_put(&uverbs_dev->ref, ib_uverbs_release_dev); |
820 | wait_for_completion(&uverbs_dev->comp); | ||
821 | kfree(uverbs_dev); | ||
816 | } | 822 | } |
817 | 823 | ||
818 | static int uverbs_event_get_sb(struct file_system_type *fs_type, int flags, | 824 | static int uverbs_event_get_sb(struct file_system_type *fs_type, int flags, |
diff --git a/drivers/infiniband/hw/mthca/mthca_allocator.c b/drivers/infiniband/hw/mthca/mthca_allocator.c index 9ba3211cef7c..25157f57a6d0 100644 --- a/drivers/infiniband/hw/mthca/mthca_allocator.c +++ b/drivers/infiniband/hw/mthca/mthca_allocator.c | |||
@@ -108,14 +108,15 @@ void mthca_alloc_cleanup(struct mthca_alloc *alloc) | |||
108 | * serialize access to the array. | 108 | * serialize access to the array. |
109 | */ | 109 | */ |
110 | 110 | ||
111 | #define MTHCA_ARRAY_MASK (PAGE_SIZE / sizeof (void *) - 1) | ||
112 | |||
111 | void *mthca_array_get(struct mthca_array *array, int index) | 113 | void *mthca_array_get(struct mthca_array *array, int index) |
112 | { | 114 | { |
113 | int p = (index * sizeof (void *)) >> PAGE_SHIFT; | 115 | int p = (index * sizeof (void *)) >> PAGE_SHIFT; |
114 | 116 | ||
115 | if (array->page_list[p].page) { | 117 | if (array->page_list[p].page) |
116 | int i = index & (PAGE_SIZE / sizeof (void *) - 1); | 118 | return array->page_list[p].page[index & MTHCA_ARRAY_MASK]; |
117 | return array->page_list[p].page[i]; | 119 | else |
118 | } else | ||
119 | return NULL; | 120 | return NULL; |
120 | } | 121 | } |
121 | 122 | ||
@@ -130,8 +131,7 @@ int mthca_array_set(struct mthca_array *array, int index, void *value) | |||
130 | if (!array->page_list[p].page) | 131 | if (!array->page_list[p].page) |
131 | return -ENOMEM; | 132 | return -ENOMEM; |
132 | 133 | ||
133 | array->page_list[p].page[index & (PAGE_SIZE / sizeof (void *) - 1)] = | 134 | array->page_list[p].page[index & MTHCA_ARRAY_MASK] = value; |
134 | value; | ||
135 | ++array->page_list[p].used; | 135 | ++array->page_list[p].used; |
136 | 136 | ||
137 | return 0; | 137 | return 0; |
@@ -144,7 +144,8 @@ void mthca_array_clear(struct mthca_array *array, int index) | |||
144 | if (--array->page_list[p].used == 0) { | 144 | if (--array->page_list[p].used == 0) { |
145 | free_page((unsigned long) array->page_list[p].page); | 145 | free_page((unsigned long) array->page_list[p].page); |
146 | array->page_list[p].page = NULL; | 146 | array->page_list[p].page = NULL; |
147 | } | 147 | } else |
148 | array->page_list[p].page[index & MTHCA_ARRAY_MASK] = NULL; | ||
148 | 149 | ||
149 | if (array->page_list[p].used < 0) | 150 | if (array->page_list[p].used < 0) |
150 | pr_debug("Array %p index %d page %d with ref count %d < 0\n", | 151 | pr_debug("Array %p index %d page %d with ref count %d < 0\n", |
diff --git a/drivers/infiniband/ulp/ipoib/Kconfig b/drivers/infiniband/ulp/ipoib/Kconfig index 13d6d01c72c0..d74653d7de1c 100644 --- a/drivers/infiniband/ulp/ipoib/Kconfig +++ b/drivers/infiniband/ulp/ipoib/Kconfig | |||
@@ -6,8 +6,7 @@ config INFINIBAND_IPOIB | |||
6 | transports IP packets over InfiniBand so you can use your IB | 6 | transports IP packets over InfiniBand so you can use your IB |
7 | device as a fancy NIC. | 7 | device as a fancy NIC. |
8 | 8 | ||
9 | The IPoIB protocol is defined by the IETF ipoib working | 9 | See Documentation/infiniband/ipoib.txt for more information |
10 | group: <http://www.ietf.org/html.charters/ipoib-charter.html>. | ||
11 | 10 | ||
12 | config INFINIBAND_IPOIB_DEBUG | 11 | config INFINIBAND_IPOIB_DEBUG |
13 | bool "IP-over-InfiniBand debugging" if EMBEDDED | 12 | bool "IP-over-InfiniBand debugging" if EMBEDDED |
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c index 8f472e7113b4..8257d5a2c8f8 100644 --- a/drivers/infiniband/ulp/srp/ib_srp.c +++ b/drivers/infiniband/ulp/srp/ib_srp.c | |||
@@ -77,6 +77,14 @@ MODULE_PARM_DESC(topspin_workarounds, | |||
77 | 77 | ||
78 | static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad }; | 78 | static const u8 topspin_oui[3] = { 0x00, 0x05, 0xad }; |
79 | 79 | ||
80 | static int mellanox_workarounds = 1; | ||
81 | |||
82 | module_param(mellanox_workarounds, int, 0444); | ||
83 | MODULE_PARM_DESC(mellanox_workarounds, | ||
84 | "Enable workarounds for Mellanox SRP target bugs if != 0"); | ||
85 | |||
86 | static const u8 mellanox_oui[3] = { 0x00, 0x02, 0xc9 }; | ||
87 | |||
80 | static void srp_add_one(struct ib_device *device); | 88 | static void srp_add_one(struct ib_device *device); |
81 | static void srp_remove_one(struct ib_device *device); | 89 | static void srp_remove_one(struct ib_device *device); |
82 | static void srp_completion(struct ib_cq *cq, void *target_ptr); | 90 | static void srp_completion(struct ib_cq *cq, void *target_ptr); |
@@ -526,8 +534,10 @@ static int srp_reconnect_target(struct srp_target_port *target) | |||
526 | while (ib_poll_cq(target->cq, 1, &wc) > 0) | 534 | while (ib_poll_cq(target->cq, 1, &wc) > 0) |
527 | ; /* nothing */ | 535 | ; /* nothing */ |
528 | 536 | ||
537 | spin_lock_irq(target->scsi_host->host_lock); | ||
529 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) | 538 | list_for_each_entry_safe(req, tmp, &target->req_queue, list) |
530 | srp_reset_req(target, req); | 539 | srp_reset_req(target, req); |
540 | spin_unlock_irq(target->scsi_host->host_lock); | ||
531 | 541 | ||
532 | target->rx_head = 0; | 542 | target->rx_head = 0; |
533 | target->tx_head = 0; | 543 | target->tx_head = 0; |
@@ -567,7 +577,7 @@ err: | |||
567 | return ret; | 577 | return ret; |
568 | } | 578 | } |
569 | 579 | ||
570 | static int srp_map_fmr(struct srp_device *dev, struct scatterlist *scat, | 580 | static int srp_map_fmr(struct srp_target_port *target, struct scatterlist *scat, |
571 | int sg_cnt, struct srp_request *req, | 581 | int sg_cnt, struct srp_request *req, |
572 | struct srp_direct_buf *buf) | 582 | struct srp_direct_buf *buf) |
573 | { | 583 | { |
@@ -577,10 +587,15 @@ static int srp_map_fmr(struct srp_device *dev, struct scatterlist *scat, | |||
577 | int page_cnt; | 587 | int page_cnt; |
578 | int i, j; | 588 | int i, j; |
579 | int ret; | 589 | int ret; |
590 | struct srp_device *dev = target->srp_host->dev; | ||
580 | 591 | ||
581 | if (!dev->fmr_pool) | 592 | if (!dev->fmr_pool) |
582 | return -ENODEV; | 593 | return -ENODEV; |
583 | 594 | ||
595 | if ((sg_dma_address(&scat[0]) & ~dev->fmr_page_mask) && | ||
596 | mellanox_workarounds && !memcmp(&target->ioc_guid, mellanox_oui, 3)) | ||
597 | return -EINVAL; | ||
598 | |||
584 | len = page_cnt = 0; | 599 | len = page_cnt = 0; |
585 | for (i = 0; i < sg_cnt; ++i) { | 600 | for (i = 0; i < sg_cnt; ++i) { |
586 | if (sg_dma_address(&scat[i]) & ~dev->fmr_page_mask) { | 601 | if (sg_dma_address(&scat[i]) & ~dev->fmr_page_mask) { |
@@ -683,7 +698,7 @@ static int srp_map_data(struct scsi_cmnd *scmnd, struct srp_target_port *target, | |||
683 | buf->va = cpu_to_be64(sg_dma_address(scat)); | 698 | buf->va = cpu_to_be64(sg_dma_address(scat)); |
684 | buf->key = cpu_to_be32(target->srp_host->dev->mr->rkey); | 699 | buf->key = cpu_to_be32(target->srp_host->dev->mr->rkey); |
685 | buf->len = cpu_to_be32(sg_dma_len(scat)); | 700 | buf->len = cpu_to_be32(sg_dma_len(scat)); |
686 | } else if (srp_map_fmr(target->srp_host->dev, scat, count, req, | 701 | } else if (srp_map_fmr(target, scat, count, req, |
687 | (void *) cmd->add_data)) { | 702 | (void *) cmd->add_data)) { |
688 | /* | 703 | /* |
689 | * FMR mapping failed, and the scatterlist has more | 704 | * FMR mapping failed, and the scatterlist has more |