aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cm.c3
-rw-r--r--drivers/infiniband/core/fmr_pool.c38
-rw-r--r--drivers/infiniband/core/iwcm.c5
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_mem.c10
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c5
-rw-r--r--drivers/infiniband/hw/nes/nes.c2
-rw-r--r--drivers/infiniband/hw/nes/nes.h15
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c15
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.c13
-rw-r--r--drivers/infiniband/hw/nes/nes_hw.h2
-rw-r--r--drivers/infiniband/hw/nes/nes_verbs.c10
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c47
12 files changed, 92 insertions, 73 deletions
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index b10ade92efed..4df405157086 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -3759,6 +3759,7 @@ static void cm_remove_one(struct ib_device *device)
3759 port = cm_dev->port[i-1]; 3759 port = cm_dev->port[i-1];
3760 ib_modify_port(device, port->port_num, 0, &port_modify); 3760 ib_modify_port(device, port->port_num, 0, &port_modify);
3761 ib_unregister_mad_agent(port->mad_agent); 3761 ib_unregister_mad_agent(port->mad_agent);
3762 flush_workqueue(cm.wq);
3762 cm_remove_port_fs(port); 3763 cm_remove_port_fs(port);
3763 } 3764 }
3764 kobject_put(&cm_dev->dev_obj); 3765 kobject_put(&cm_dev->dev_obj);
@@ -3813,6 +3814,7 @@ static void __exit ib_cm_cleanup(void)
3813 cancel_delayed_work(&timewait_info->work.work); 3814 cancel_delayed_work(&timewait_info->work.work);
3814 spin_unlock_irq(&cm.lock); 3815 spin_unlock_irq(&cm.lock);
3815 3816
3817 ib_unregister_client(&cm_client);
3816 destroy_workqueue(cm.wq); 3818 destroy_workqueue(cm.wq);
3817 3819
3818 list_for_each_entry_safe(timewait_info, tmp, &cm.timewait_list, list) { 3820 list_for_each_entry_safe(timewait_info, tmp, &cm.timewait_list, list) {
@@ -3820,7 +3822,6 @@ static void __exit ib_cm_cleanup(void)
3820 kfree(timewait_info); 3822 kfree(timewait_info);
3821 } 3823 }
3822 3824
3823 ib_unregister_client(&cm_client);
3824 class_unregister(&cm_class); 3825 class_unregister(&cm_class);
3825 idr_destroy(&cm.local_id_table); 3826 idr_destroy(&cm.local_id_table);
3826} 3827}
diff --git a/drivers/infiniband/core/fmr_pool.c b/drivers/infiniband/core/fmr_pool.c
index 7f00347364f7..06d502c06a4d 100644
--- a/drivers/infiniband/core/fmr_pool.c
+++ b/drivers/infiniband/core/fmr_pool.c
@@ -139,7 +139,7 @@ static inline struct ib_pool_fmr *ib_fmr_cache_lookup(struct ib_fmr_pool *pool,
139static void ib_fmr_batch_release(struct ib_fmr_pool *pool) 139static void ib_fmr_batch_release(struct ib_fmr_pool *pool)
140{ 140{
141 int ret; 141 int ret;
142 struct ib_pool_fmr *fmr, *next; 142 struct ib_pool_fmr *fmr;
143 LIST_HEAD(unmap_list); 143 LIST_HEAD(unmap_list);
144 LIST_HEAD(fmr_list); 144 LIST_HEAD(fmr_list);
145 145
@@ -158,20 +158,6 @@ static void ib_fmr_batch_release(struct ib_fmr_pool *pool)
158#endif 158#endif
159 } 159 }
160 160
161 /*
162 * The free_list may hold FMRs that have been put there
163 * because they haven't reached the max_remap count.
164 * Invalidate their mapping as well.
165 */
166 list_for_each_entry_safe(fmr, next, &pool->free_list, list) {
167 if (fmr->remap_count == 0)
168 continue;
169 hlist_del_init(&fmr->cache_node);
170 fmr->remap_count = 0;
171 list_add_tail(&fmr->fmr->list, &fmr_list);
172 list_move(&fmr->list, &unmap_list);
173 }
174
175 list_splice(&pool->dirty_list, &unmap_list); 161 list_splice(&pool->dirty_list, &unmap_list);
176 INIT_LIST_HEAD(&pool->dirty_list); 162 INIT_LIST_HEAD(&pool->dirty_list);
177 pool->dirty_len = 0; 163 pool->dirty_len = 0;
@@ -384,6 +370,11 @@ void ib_destroy_fmr_pool(struct ib_fmr_pool *pool)
384 370
385 i = 0; 371 i = 0;
386 list_for_each_entry_safe(fmr, tmp, &pool->free_list, list) { 372 list_for_each_entry_safe(fmr, tmp, &pool->free_list, list) {
373 if (fmr->remap_count) {
374 INIT_LIST_HEAD(&fmr_list);
375 list_add_tail(&fmr->fmr->list, &fmr_list);
376 ib_unmap_fmr(&fmr_list);
377 }
387 ib_dealloc_fmr(fmr->fmr); 378 ib_dealloc_fmr(fmr->fmr);
388 list_del(&fmr->list); 379 list_del(&fmr->list);
389 kfree(fmr); 380 kfree(fmr);
@@ -407,8 +398,23 @@ EXPORT_SYMBOL(ib_destroy_fmr_pool);
407 */ 398 */
408int ib_flush_fmr_pool(struct ib_fmr_pool *pool) 399int ib_flush_fmr_pool(struct ib_fmr_pool *pool)
409{ 400{
410 int serial = atomic_inc_return(&pool->req_ser); 401 int serial;
402 struct ib_pool_fmr *fmr, *next;
403
404 /*
405 * The free_list holds FMRs that may have been used
406 * but have not been remapped enough times to be dirty.
407 * Put them on the dirty list now so that the cleanup
408 * thread will reap them too.
409 */
410 spin_lock_irq(&pool->pool_lock);
411 list_for_each_entry_safe(fmr, next, &pool->free_list, list) {
412 if (fmr->remap_count > 0)
413 list_move(&fmr->list, &pool->dirty_list);
414 }
415 spin_unlock_irq(&pool->pool_lock);
411 416
417 serial = atomic_inc_return(&pool->req_ser);
412 wake_up_process(pool->thread); 418 wake_up_process(pool->thread);
413 419
414 if (wait_event_interruptible(pool->force_wait, 420 if (wait_event_interruptible(pool->force_wait,
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
index 223b1aa7d92b..81c9195b512a 100644
--- a/drivers/infiniband/core/iwcm.c
+++ b/drivers/infiniband/core/iwcm.c
@@ -839,6 +839,7 @@ static void cm_work_handler(struct work_struct *_work)
839 unsigned long flags; 839 unsigned long flags;
840 int empty; 840 int empty;
841 int ret = 0; 841 int ret = 0;
842 int destroy_id;
842 843
843 spin_lock_irqsave(&cm_id_priv->lock, flags); 844 spin_lock_irqsave(&cm_id_priv->lock, flags);
844 empty = list_empty(&cm_id_priv->work_list); 845 empty = list_empty(&cm_id_priv->work_list);
@@ -857,9 +858,9 @@ static void cm_work_handler(struct work_struct *_work)
857 destroy_cm_id(&cm_id_priv->id); 858 destroy_cm_id(&cm_id_priv->id);
858 } 859 }
859 BUG_ON(atomic_read(&cm_id_priv->refcount)==0); 860 BUG_ON(atomic_read(&cm_id_priv->refcount)==0);
861 destroy_id = test_bit(IWCM_F_CALLBACK_DESTROY, &cm_id_priv->flags);
860 if (iwcm_deref_id(cm_id_priv)) { 862 if (iwcm_deref_id(cm_id_priv)) {
861 if (test_bit(IWCM_F_CALLBACK_DESTROY, 863 if (destroy_id) {
862 &cm_id_priv->flags)) {
863 BUG_ON(!list_empty(&cm_id_priv->work_list)); 864 BUG_ON(!list_empty(&cm_id_priv->work_list));
864 free_cm_id(cm_id_priv); 865 free_cm_id(cm_id_priv);
865 } 866 }
diff --git a/drivers/infiniband/hw/cxgb3/iwch_mem.c b/drivers/infiniband/hw/cxgb3/iwch_mem.c
index 73bfd1656f86..b8797c66676d 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_mem.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_mem.c
@@ -136,14 +136,8 @@ int build_phys_page_list(struct ib_phys_buf *buffer_list,
136 136
137 /* Find largest page shift we can use to cover buffers */ 137 /* Find largest page shift we can use to cover buffers */
138 for (*shift = PAGE_SHIFT; *shift < 27; ++(*shift)) 138 for (*shift = PAGE_SHIFT; *shift < 27; ++(*shift))
139 if (num_phys_buf > 1) { 139 if ((1ULL << *shift) & mask)
140 if ((1ULL << *shift) & mask) 140 break;
141 break;
142 } else
143 if (1ULL << *shift >=
144 buffer_list[0].size +
145 (buffer_list[0].addr & ((1ULL << *shift) - 1)))
146 break;
147 141
148 buffer_list[0].size += buffer_list[0].addr & ((1ULL << *shift) - 1); 142 buffer_list[0].size += buffer_list[0].addr & ((1ULL << *shift) - 1);
149 buffer_list[0].addr &= ~0ull << *shift; 143 buffer_list[0].addr &= ~0ull << *shift;
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index df1838f8f94d..b2ea9210467f 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -189,7 +189,7 @@ static struct ib_cq *iwch_create_cq(struct ib_device *ibdev, int entries, int ve
189 return ERR_PTR(-ENOMEM); 189 return ERR_PTR(-ENOMEM);
190 } 190 }
191 chp->rhp = rhp; 191 chp->rhp = rhp;
192 chp->ibcq.cqe = (1 << chp->cq.size_log2) - 1; 192 chp->ibcq.cqe = 1 << chp->cq.size_log2;
193 spin_lock_init(&chp->lock); 193 spin_lock_init(&chp->lock);
194 atomic_set(&chp->refcnt, 1); 194 atomic_set(&chp->refcnt, 1);
195 init_waitqueue_head(&chp->wait); 195 init_waitqueue_head(&chp->wait);
@@ -819,8 +819,11 @@ static struct ib_qp *iwch_create_qp(struct ib_pd *pd,
819 kfree(qhp); 819 kfree(qhp);
820 return ERR_PTR(-ENOMEM); 820 return ERR_PTR(-ENOMEM);
821 } 821 }
822
822 attrs->cap.max_recv_wr = rqsize - 1; 823 attrs->cap.max_recv_wr = rqsize - 1;
823 attrs->cap.max_send_wr = sqsize; 824 attrs->cap.max_send_wr = sqsize;
825 attrs->cap.max_inline_data = T3_MAX_INLINE;
826
824 qhp->rhp = rhp; 827 qhp->rhp = rhp;
825 qhp->attr.pd = php->pdid; 828 qhp->attr.pd = php->pdid;
826 qhp->attr.scq = ((struct iwch_cq *) attrs->send_cq)->cq.cqid; 829 qhp->attr.scq = ((struct iwch_cq *) attrs->send_cq)->cq.cqid;
diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
index 7f8853b44ee1..b2112f5a422f 100644
--- a/drivers/infiniband/hw/nes/nes.c
+++ b/drivers/infiniband/hw/nes/nes.c
@@ -567,12 +567,12 @@ static int __devinit nes_probe(struct pci_dev *pcidev, const struct pci_device_i
567 567
568 /* Init the adapter */ 568 /* Init the adapter */
569 nesdev->nesadapter = nes_init_adapter(nesdev, hw_rev); 569 nesdev->nesadapter = nes_init_adapter(nesdev, hw_rev);
570 nesdev->nesadapter->et_rx_coalesce_usecs_irq = interrupt_mod_interval;
571 if (!nesdev->nesadapter) { 570 if (!nesdev->nesadapter) {
572 printk(KERN_ERR PFX "Unable to initialize adapter.\n"); 571 printk(KERN_ERR PFX "Unable to initialize adapter.\n");
573 ret = -ENOMEM; 572 ret = -ENOMEM;
574 goto bail5; 573 goto bail5;
575 } 574 }
575 nesdev->nesadapter->et_rx_coalesce_usecs_irq = interrupt_mod_interval;
576 576
577 /* nesdev->base_doorbell_index = 577 /* nesdev->base_doorbell_index =
578 nesdev->nesadapter->pd_config_base[PCI_FUNC(nesdev->pcidev->devfn)]; */ 578 nesdev->nesadapter->pd_config_base[PCI_FUNC(nesdev->pcidev->devfn)]; */
diff --git a/drivers/infiniband/hw/nes/nes.h b/drivers/infiniband/hw/nes/nes.h
index fd57e8a1582f..a48b288618ec 100644
--- a/drivers/infiniband/hw/nes/nes.h
+++ b/drivers/infiniband/hw/nes/nes.h
@@ -285,6 +285,21 @@ struct nes_device {
285}; 285};
286 286
287 287
288static inline __le32 get_crc_value(struct nes_v4_quad *nes_quad)
289{
290 u32 crc_value;
291 crc_value = crc32c(~0, (void *)nes_quad, sizeof (struct nes_v4_quad));
292
293 /*
294 * With commit ef19454b ("[LIB] crc32c: Keep intermediate crc
295 * state in cpu order"), behavior of crc32c changes on
296 * big-endian platforms. Our algorithm expects the previous
297 * behavior; otherwise we have RDMA connection establishment
298 * issue on big-endian.
299 */
300 return cpu_to_le32(crc_value);
301}
302
288static inline void 303static inline void
289set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value) 304set_wqe_64bit_value(__le32 *wqe_words, u32 index, u64 value)
290{ 305{
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index bd5cfeaac203..39adb267fb15 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -370,11 +370,11 @@ int schedule_nes_timer(struct nes_cm_node *cm_node, struct sk_buff *skb,
370 int ret = 0; 370 int ret = 0;
371 u32 was_timer_set; 371 u32 was_timer_set;
372 372
373 if (!cm_node)
374 return -EINVAL;
373 new_send = kzalloc(sizeof(*new_send), GFP_ATOMIC); 375 new_send = kzalloc(sizeof(*new_send), GFP_ATOMIC);
374 if (!new_send) 376 if (!new_send)
375 return -1; 377 return -1;
376 if (!cm_node)
377 return -EINVAL;
378 378
379 /* new_send->timetosend = currenttime */ 379 /* new_send->timetosend = currenttime */
380 new_send->retrycount = NES_DEFAULT_RETRYS; 380 new_send->retrycount = NES_DEFAULT_RETRYS;
@@ -947,6 +947,7 @@ static int mini_cm_dec_refcnt_listen(struct nes_cm_core *cm_core,
947 nes_debug(NES_DBG_CM, "destroying listener (%p)\n", listener); 947 nes_debug(NES_DBG_CM, "destroying listener (%p)\n", listener);
948 948
949 kfree(listener); 949 kfree(listener);
950 listener = NULL;
950 ret = 0; 951 ret = 0;
951 cm_listens_destroyed++; 952 cm_listens_destroyed++;
952 } else { 953 } else {
@@ -2319,6 +2320,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2319 struct iw_cm_event cm_event; 2320 struct iw_cm_event cm_event;
2320 struct nes_hw_qp_wqe *wqe; 2321 struct nes_hw_qp_wqe *wqe;
2321 struct nes_v4_quad nes_quad; 2322 struct nes_v4_quad nes_quad;
2323 u32 crc_value;
2322 int ret; 2324 int ret;
2323 2325
2324 ibqp = nes_get_qp(cm_id->device, conn_param->qpn); 2326 ibqp = nes_get_qp(cm_id->device, conn_param->qpn);
@@ -2435,8 +2437,8 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2435 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; 2437 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
2436 2438
2437 /* Produce hash key */ 2439 /* Produce hash key */
2438 nesqp->hte_index = cpu_to_be32( 2440 crc_value = get_crc_value(&nes_quad);
2439 crc32c(~0, (void *)&nes_quad, sizeof(nes_quad)) ^ 0xffffffff); 2441 nesqp->hte_index = cpu_to_be32(crc_value ^ 0xffffffff);
2440 nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, CRC = 0x%08X\n", 2442 nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, CRC = 0x%08X\n",
2441 nesqp->hte_index, nesqp->hte_index & adapter->hte_index_mask); 2443 nesqp->hte_index, nesqp->hte_index & adapter->hte_index_mask);
2442 2444
@@ -2750,6 +2752,7 @@ void cm_event_connected(struct nes_cm_event *event)
2750 struct iw_cm_event cm_event; 2752 struct iw_cm_event cm_event;
2751 struct nes_hw_qp_wqe *wqe; 2753 struct nes_hw_qp_wqe *wqe;
2752 struct nes_v4_quad nes_quad; 2754 struct nes_v4_quad nes_quad;
2755 u32 crc_value;
2753 int ret; 2756 int ret;
2754 2757
2755 /* get all our handles */ 2758 /* get all our handles */
@@ -2827,8 +2830,8 @@ void cm_event_connected(struct nes_cm_event *event)
2827 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; 2830 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
2828 2831
2829 /* Produce hash key */ 2832 /* Produce hash key */
2830 nesqp->hte_index = cpu_to_be32( 2833 crc_value = get_crc_value(&nes_quad);
2831 crc32c(~0, (void *)&nes_quad, sizeof(nes_quad)) ^ 0xffffffff); 2834 nesqp->hte_index = cpu_to_be32(crc_value ^ 0xffffffff);
2832 nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, After CRC = 0x%08X\n", 2835 nes_debug(NES_DBG_CM, "HTE Index = 0x%08X, After CRC = 0x%08X\n",
2833 nesqp->hte_index, nesqp->hte_index & nesadapter->hte_index_mask); 2836 nesqp->hte_index, nesqp->hte_index & nesadapter->hte_index_mask);
2834 2837
diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
index 7c4c0fbf0abd..49e53e4c1ebe 100644
--- a/drivers/infiniband/hw/nes/nes_hw.c
+++ b/drivers/infiniband/hw/nes/nes_hw.c
@@ -156,15 +156,14 @@ static void nes_nic_tune_timer(struct nes_device *nesdev)
156 156
157 spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags); 157 spin_lock_irqsave(&nesadapter->periodic_timer_lock, flags);
158 158
159 if (shared_timer->cq_count_old < cq_count) { 159 if (shared_timer->cq_count_old <= cq_count)
160 if (cq_count > shared_timer->threshold_low) 160 shared_timer->cq_direction_downward = 0;
161 shared_timer->cq_direction_downward=0; 161 else
162 }
163 if (shared_timer->cq_count_old >= cq_count)
164 shared_timer->cq_direction_downward++; 162 shared_timer->cq_direction_downward++;
165 shared_timer->cq_count_old = cq_count; 163 shared_timer->cq_count_old = cq_count;
166 if (shared_timer->cq_direction_downward > NES_NIC_CQ_DOWNWARD_TREND) { 164 if (shared_timer->cq_direction_downward > NES_NIC_CQ_DOWNWARD_TREND) {
167 if (cq_count <= shared_timer->threshold_low) { 165 if (cq_count <= shared_timer->threshold_low &&
166 shared_timer->threshold_low > 4) {
168 shared_timer->threshold_low = shared_timer->threshold_low/2; 167 shared_timer->threshold_low = shared_timer->threshold_low/2;
169 shared_timer->cq_direction_downward=0; 168 shared_timer->cq_direction_downward=0;
170 nesdev->currcq_count = 0; 169 nesdev->currcq_count = 0;
@@ -1728,7 +1727,6 @@ int nes_napi_isr(struct nes_device *nesdev)
1728 nesdev->int_req &= ~NES_INT_TIMER; 1727 nesdev->int_req &= ~NES_INT_TIMER;
1729 nes_write32(nesdev->regs+NES_INTF_INT_MASK, ~(nesdev->intf_int_req)); 1728 nes_write32(nesdev->regs+NES_INTF_INT_MASK, ~(nesdev->intf_int_req));
1730 nes_write32(nesdev->regs+NES_INT_MASK, ~nesdev->int_req); 1729 nes_write32(nesdev->regs+NES_INT_MASK, ~nesdev->int_req);
1731 nesadapter->tune_timer.timer_in_use_old = 0;
1732 } 1730 }
1733 nesdev->deepcq_count = 0; 1731 nesdev->deepcq_count = 0;
1734 return 1; 1732 return 1;
@@ -1867,7 +1865,6 @@ void nes_dpc(unsigned long param)
1867 nesdev->int_req &= ~NES_INT_TIMER; 1865 nesdev->int_req &= ~NES_INT_TIMER;
1868 nes_write32(nesdev->regs + NES_INTF_INT_MASK, ~(nesdev->intf_int_req)); 1866 nes_write32(nesdev->regs + NES_INTF_INT_MASK, ~(nesdev->intf_int_req));
1869 nes_write32(nesdev->regs+NES_INT_MASK, ~nesdev->int_req); 1867 nes_write32(nesdev->regs+NES_INT_MASK, ~nesdev->int_req);
1870 nesdev->nesadapter->tune_timer.timer_in_use_old = 0;
1871 } else { 1868 } else {
1872 nes_write32(nesdev->regs+NES_INT_MASK, 0x0000ffff|(~nesdev->int_req)); 1869 nes_write32(nesdev->regs+NES_INT_MASK, 0x0000ffff|(~nesdev->int_req));
1873 } 1870 }
diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h
index 1e10df550c9e..b7e2844f096b 100644
--- a/drivers/infiniband/hw/nes/nes_hw.h
+++ b/drivers/infiniband/hw/nes/nes_hw.h
@@ -962,7 +962,7 @@ struct nes_arp_entry {
962#define DEFAULT_JUMBO_NES_QL_LOW 12 962#define DEFAULT_JUMBO_NES_QL_LOW 12
963#define DEFAULT_JUMBO_NES_QL_TARGET 40 963#define DEFAULT_JUMBO_NES_QL_TARGET 40
964#define DEFAULT_JUMBO_NES_QL_HIGH 128 964#define DEFAULT_JUMBO_NES_QL_HIGH 128
965#define NES_NIC_CQ_DOWNWARD_TREND 8 965#define NES_NIC_CQ_DOWNWARD_TREND 16
966 966
967struct nes_hw_tune_timer { 967struct nes_hw_tune_timer {
968 //u16 cq_count; 968 //u16 cq_count;
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c
index 4dafbe16e82a..a651e9d9f0ef 100644
--- a/drivers/infiniband/hw/nes/nes_verbs.c
+++ b/drivers/infiniband/hw/nes/nes_verbs.c
@@ -929,7 +929,7 @@ static struct ib_pd *nes_alloc_pd(struct ib_device *ibdev,
929 NES_MAX_USER_DB_REGIONS, nesucontext->first_free_db); 929 NES_MAX_USER_DB_REGIONS, nesucontext->first_free_db);
930 nes_debug(NES_DBG_PD, "find_first_zero_biton doorbells returned %u, mapping pd_id %u.\n", 930 nes_debug(NES_DBG_PD, "find_first_zero_biton doorbells returned %u, mapping pd_id %u.\n",
931 nespd->mmap_db_index, nespd->pd_id); 931 nespd->mmap_db_index, nespd->pd_id);
932 if (nespd->mmap_db_index > NES_MAX_USER_DB_REGIONS) { 932 if (nespd->mmap_db_index >= NES_MAX_USER_DB_REGIONS) {
933 nes_debug(NES_DBG_PD, "mmap_db_index > MAX\n"); 933 nes_debug(NES_DBG_PD, "mmap_db_index > MAX\n");
934 nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num); 934 nes_free_resource(nesadapter, nesadapter->allocated_pds, pd_num);
935 kfree(nespd); 935 kfree(nespd);
@@ -1327,7 +1327,7 @@ static struct ib_qp *nes_create_qp(struct ib_pd *ibpd,
1327 (long long unsigned int)req.user_wqe_buffers); 1327 (long long unsigned int)req.user_wqe_buffers);
1328 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num); 1328 nes_free_resource(nesadapter, nesadapter->allocated_qps, qp_num);
1329 kfree(nesqp->allocated_buffer); 1329 kfree(nesqp->allocated_buffer);
1330 return ERR_PTR(-ENOMEM); 1330 return ERR_PTR(-EFAULT);
1331 } 1331 }
1332 } 1332 }
1333 1333
@@ -1674,6 +1674,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
1674 } 1674 }
1675 nes_debug(NES_DBG_CQ, "CQ Virtual Address = %08lX, size = %u.\n", 1675 nes_debug(NES_DBG_CQ, "CQ Virtual Address = %08lX, size = %u.\n",
1676 (unsigned long)req.user_cq_buffer, entries); 1676 (unsigned long)req.user_cq_buffer, entries);
1677 err = 1;
1677 list_for_each_entry(nespbl, &nes_ucontext->cq_reg_mem_list, list) { 1678 list_for_each_entry(nespbl, &nes_ucontext->cq_reg_mem_list, list) {
1678 if (nespbl->user_base == (unsigned long )req.user_cq_buffer) { 1679 if (nespbl->user_base == (unsigned long )req.user_cq_buffer) {
1679 list_del(&nespbl->list); 1680 list_del(&nespbl->list);
@@ -1686,7 +1687,7 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
1686 if (err) { 1687 if (err) {
1687 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num); 1688 nes_free_resource(nesadapter, nesadapter->allocated_cqs, cq_num);
1688 kfree(nescq); 1689 kfree(nescq);
1689 return ERR_PTR(err); 1690 return ERR_PTR(-EFAULT);
1690 } 1691 }
1691 1692
1692 pbl_entries = nespbl->pbl_size >> 3; 1693 pbl_entries = nespbl->pbl_size >> 3;
@@ -1831,9 +1832,6 @@ static struct ib_cq *nes_create_cq(struct ib_device *ibdev, int entries,
1831 spin_unlock_irqrestore(&nesdev->cqp.lock, flags); 1832 spin_unlock_irqrestore(&nesdev->cqp.lock, flags);
1832 } 1833 }
1833 } 1834 }
1834 nes_debug(NES_DBG_CQ, "iWARP CQ%u create timeout expired, major code = 0x%04X,"
1835 " minor code = 0x%04X\n",
1836 nescq->hw_cq.cq_number, cqp_request->major_code, cqp_request->minor_code);
1837 if (!context) 1835 if (!context)
1838 pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem, 1836 pci_free_consistent(nesdev->pcidev, nescq->cq_mem_size, mem,
1839 nescq->hw_cq.cq_pbase); 1837 nescq->hw_cq.cq_pbase);
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 714b8db02b29..993f0a8ff28f 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -237,36 +237,32 @@ static int iser_free_ib_conn_res(struct iser_conn *ib_conn)
237static 237static
238struct iser_device *iser_device_find_by_ib_device(struct rdma_cm_id *cma_id) 238struct iser_device *iser_device_find_by_ib_device(struct rdma_cm_id *cma_id)
239{ 239{
240 struct list_head *p_list; 240 struct iser_device *device;
241 struct iser_device *device = NULL;
242 241
243 mutex_lock(&ig.device_list_mutex); 242 mutex_lock(&ig.device_list_mutex);
244 243
245 p_list = ig.device_list.next; 244 list_for_each_entry(device, &ig.device_list, ig_list)
246 while (p_list != &ig.device_list) {
247 device = list_entry(p_list, struct iser_device, ig_list);
248 /* find if there's a match using the node GUID */ 245 /* find if there's a match using the node GUID */
249 if (device->ib_device->node_guid == cma_id->device->node_guid) 246 if (device->ib_device->node_guid == cma_id->device->node_guid)
250 break; 247 goto inc_refcnt;
251 }
252 248
253 if (device == NULL) { 249 device = kzalloc(sizeof *device, GFP_KERNEL);
254 device = kzalloc(sizeof *device, GFP_KERNEL); 250 if (device == NULL)
255 if (device == NULL) 251 goto out;
256 goto out; 252
257 /* assign this device to the device */ 253 /* assign this device to the device */
258 device->ib_device = cma_id->device; 254 device->ib_device = cma_id->device;
259 /* init the device and link it into ig device list */ 255 /* init the device and link it into ig device list */
260 if (iser_create_device_ib_res(device)) { 256 if (iser_create_device_ib_res(device)) {
261 kfree(device); 257 kfree(device);
262 device = NULL; 258 device = NULL;
263 goto out; 259 goto out;
264 }
265 list_add(&device->ig_list, &ig.device_list);
266 } 260 }
267out: 261 list_add(&device->ig_list, &ig.device_list);
268 BUG_ON(device == NULL); 262
263inc_refcnt:
269 device->refcount++; 264 device->refcount++;
265out:
270 mutex_unlock(&ig.device_list_mutex); 266 mutex_unlock(&ig.device_list_mutex);
271 return device; 267 return device;
272} 268}
@@ -372,6 +368,12 @@ static void iser_addr_handler(struct rdma_cm_id *cma_id)
372 int ret; 368 int ret;
373 369
374 device = iser_device_find_by_ib_device(cma_id); 370 device = iser_device_find_by_ib_device(cma_id);
371 if (!device) {
372 iser_err("device lookup/creation failed\n");
373 iser_connect_error(cma_id);
374 return;
375 }
376
375 ib_conn = (struct iser_conn *)cma_id->context; 377 ib_conn = (struct iser_conn *)cma_id->context;
376 ib_conn->device = device; 378 ib_conn->device = device;
377 379
@@ -380,7 +382,6 @@ static void iser_addr_handler(struct rdma_cm_id *cma_id)
380 iser_err("resolve route failed: %d\n", ret); 382 iser_err("resolve route failed: %d\n", ret);
381 iser_connect_error(cma_id); 383 iser_connect_error(cma_id);
382 } 384 }
383 return;
384} 385}
385 386
386static void iser_route_handler(struct rdma_cm_id *cma_id) 387static void iser_route_handler(struct rdma_cm_id *cma_id)