aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/iwcm.c2
-rw-r--r--drivers/infiniband/core/verbs.c3
-rw-r--r--drivers/infiniband/hw/cxgb3/cxio_resource.c4
-rw-r--r--drivers/infiniband/hw/cxgb3/iwch_provider.c2
-rw-r--r--drivers/infiniband/hw/cxgb4/id_table.c4
-rw-r--r--drivers/infiniband/hw/cxgb4/qp.c25
-rw-r--r--drivers/infiniband/hw/ipath/ipath_verbs.c19
-rw-r--r--drivers/infiniband/hw/mlx4/cq.c21
-rw-r--r--drivers/infiniband/hw/mlx4/mad.c2
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c6
-rw-r--r--drivers/infiniband/hw/qib/qib_sysfs.c6
-rw-r--r--drivers/infiniband/hw/qib/qib_verbs.c3
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_cm.c2
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c2
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.c24
-rw-r--r--drivers/infiniband/ulp/iser/iscsi_iser.h24
-rw-r--r--drivers/infiniband/ulp/iser/iser_memory.c3
-rw-r--r--drivers/infiniband/ulp/iser/iser_verbs.c36
18 files changed, 125 insertions, 63 deletions
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
index 0bb99bb38809..c47c2034ca71 100644
--- a/drivers/infiniband/core/iwcm.c
+++ b/drivers/infiniband/core/iwcm.c
@@ -878,6 +878,8 @@ static void cm_work_handler(struct work_struct *_work)
878 } 878 }
879 return; 879 return;
880 } 880 }
881 if (empty)
882 return;
881 spin_lock_irqsave(&cm_id_priv->lock, flags); 883 spin_lock_irqsave(&cm_id_priv->lock, flags);
882 } 884 }
883 spin_unlock_irqrestore(&cm_id_priv->lock, flags); 885 spin_unlock_irqrestore(&cm_id_priv->lock, flags);
diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index a8fdd3381405..22192deb8828 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -348,7 +348,8 @@ static void __ib_shared_qp_event_handler(struct ib_event *event, void *context)
348 struct ib_qp *qp = context; 348 struct ib_qp *qp = context;
349 349
350 list_for_each_entry(event->element.qp, &qp->open_list, open_list) 350 list_for_each_entry(event->element.qp, &qp->open_list, open_list)
351 event->element.qp->event_handler(event, event->element.qp->qp_context); 351 if (event->element.qp->event_handler)
352 event->element.qp->event_handler(event, event->element.qp->qp_context);
352} 353}
353 354
354static void __ib_insert_xrcd_qp(struct ib_xrcd *xrcd, struct ib_qp *qp) 355static void __ib_insert_xrcd_qp(struct ib_xrcd *xrcd, struct ib_qp *qp)
diff --git a/drivers/infiniband/hw/cxgb3/cxio_resource.c b/drivers/infiniband/hw/cxgb3/cxio_resource.c
index 31f9201b2980..c40088ecf9f3 100644
--- a/drivers/infiniband/hw/cxgb3/cxio_resource.c
+++ b/drivers/infiniband/hw/cxgb3/cxio_resource.c
@@ -62,13 +62,13 @@ static int __cxio_init_resource_fifo(struct kfifo *fifo,
62 kfifo_in(fifo, (unsigned char *) &entry, sizeof(u32)); 62 kfifo_in(fifo, (unsigned char *) &entry, sizeof(u32));
63 if (random) { 63 if (random) {
64 j = 0; 64 j = 0;
65 random_bytes = random32(); 65 random_bytes = prandom_u32();
66 for (i = 0; i < RANDOM_SIZE; i++) 66 for (i = 0; i < RANDOM_SIZE; i++)
67 rarray[i] = i + skip_low; 67 rarray[i] = i + skip_low;
68 for (i = skip_low + RANDOM_SIZE; i < nr - skip_high; i++) { 68 for (i = skip_low + RANDOM_SIZE; i < nr - skip_high; i++) {
69 if (j >= RANDOM_SIZE) { 69 if (j >= RANDOM_SIZE) {
70 j = 0; 70 j = 0;
71 random_bytes = random32(); 71 random_bytes = prandom_u32();
72 } 72 }
73 idx = (random_bytes >> (j * 2)) & 0xF; 73 idx = (random_bytes >> (j * 2)) & 0xF;
74 kfifo_in(fifo, 74 kfifo_in(fifo,
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c
index 9c12da0cbd32..e87f2201b220 100644
--- a/drivers/infiniband/hw/cxgb3/iwch_provider.c
+++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c
@@ -559,7 +559,7 @@ static int iwch_reregister_phys_mem(struct ib_mr *mr,
559 __be64 *page_list = NULL; 559 __be64 *page_list = NULL;
560 int shift = 0; 560 int shift = 0;
561 u64 total_size; 561 u64 total_size;
562 int npages; 562 int npages = 0;
563 int ret; 563 int ret;
564 564
565 PDBG("%s ib_mr %p ib_pd %p\n", __func__, mr, pd); 565 PDBG("%s ib_mr %p ib_pd %p\n", __func__, mr, pd);
diff --git a/drivers/infiniband/hw/cxgb4/id_table.c b/drivers/infiniband/hw/cxgb4/id_table.c
index f95e5df30db2..0161ae6ad629 100644
--- a/drivers/infiniband/hw/cxgb4/id_table.c
+++ b/drivers/infiniband/hw/cxgb4/id_table.c
@@ -54,7 +54,7 @@ u32 c4iw_id_alloc(struct c4iw_id_table *alloc)
54 54
55 if (obj < alloc->max) { 55 if (obj < alloc->max) {
56 if (alloc->flags & C4IW_ID_TABLE_F_RANDOM) 56 if (alloc->flags & C4IW_ID_TABLE_F_RANDOM)
57 alloc->last += random32() % RANDOM_SKIP; 57 alloc->last += prandom_u32() % RANDOM_SKIP;
58 else 58 else
59 alloc->last = obj + 1; 59 alloc->last = obj + 1;
60 if (alloc->last >= alloc->max) 60 if (alloc->last >= alloc->max)
@@ -88,7 +88,7 @@ int c4iw_id_table_alloc(struct c4iw_id_table *alloc, u32 start, u32 num,
88 alloc->start = start; 88 alloc->start = start;
89 alloc->flags = flags; 89 alloc->flags = flags;
90 if (flags & C4IW_ID_TABLE_F_RANDOM) 90 if (flags & C4IW_ID_TABLE_F_RANDOM)
91 alloc->last = random32() % RANDOM_SKIP; 91 alloc->last = prandom_u32() % RANDOM_SKIP;
92 else 92 else
93 alloc->last = 0; 93 alloc->last = 0;
94 alloc->max = num; 94 alloc->max = num;
diff --git a/drivers/infiniband/hw/cxgb4/qp.c b/drivers/infiniband/hw/cxgb4/qp.c
index 70b1808a08f4..ed49ab345b6e 100644
--- a/drivers/infiniband/hw/cxgb4/qp.c
+++ b/drivers/infiniband/hw/cxgb4/qp.c
@@ -100,6 +100,16 @@ static int alloc_host_sq(struct c4iw_rdev *rdev, struct t4_sq *sq)
100 return 0; 100 return 0;
101} 101}
102 102
103static int alloc_sq(struct c4iw_rdev *rdev, struct t4_sq *sq, int user)
104{
105 int ret = -ENOSYS;
106 if (user)
107 ret = alloc_oc_sq(rdev, sq);
108 if (ret)
109 ret = alloc_host_sq(rdev, sq);
110 return ret;
111}
112
103static int destroy_qp(struct c4iw_rdev *rdev, struct t4_wq *wq, 113static int destroy_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
104 struct c4iw_dev_ucontext *uctx) 114 struct c4iw_dev_ucontext *uctx)
105{ 115{
@@ -168,18 +178,9 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
168 goto free_sw_rq; 178 goto free_sw_rq;
169 } 179 }
170 180
171 if (user) { 181 ret = alloc_sq(rdev, &wq->sq, user);
172 ret = alloc_oc_sq(rdev, &wq->sq); 182 if (ret)
173 if (ret) 183 goto free_hwaddr;
174 goto free_hwaddr;
175
176 ret = alloc_host_sq(rdev, &wq->sq);
177 if (ret)
178 goto free_sq;
179 } else
180 ret = alloc_host_sq(rdev, &wq->sq);
181 if (ret)
182 goto free_hwaddr;
183 memset(wq->sq.queue, 0, wq->sq.memsize); 184 memset(wq->sq.queue, 0, wq->sq.memsize);
184 dma_unmap_addr_set(&wq->sq, mapping, wq->sq.dma_addr); 185 dma_unmap_addr_set(&wq->sq, mapping, wq->sq.dma_addr);
185 186
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c
index ea93870266eb..44ea9390417c 100644
--- a/drivers/infiniband/hw/ipath/ipath_verbs.c
+++ b/drivers/infiniband/hw/ipath/ipath_verbs.c
@@ -2187,7 +2187,8 @@ int ipath_register_ib_device(struct ipath_devdata *dd)
2187 if (ret) 2187 if (ret)
2188 goto err_reg; 2188 goto err_reg;
2189 2189
2190 if (ipath_verbs_register_sysfs(dev)) 2190 ret = ipath_verbs_register_sysfs(dev);
2191 if (ret)
2191 goto err_class; 2192 goto err_class;
2192 2193
2193 enable_timer(dd); 2194 enable_timer(dd);
@@ -2327,15 +2328,15 @@ static int ipath_verbs_register_sysfs(struct ib_device *dev)
2327 int i; 2328 int i;
2328 int ret; 2329 int ret;
2329 2330
2330 for (i = 0; i < ARRAY_SIZE(ipath_class_attributes); ++i) 2331 for (i = 0; i < ARRAY_SIZE(ipath_class_attributes); ++i) {
2331 if (device_create_file(&dev->dev, 2332 ret = device_create_file(&dev->dev,
2332 ipath_class_attributes[i])) { 2333 ipath_class_attributes[i]);
2333 ret = 1; 2334 if (ret)
2334 goto bail; 2335 goto bail;
2335 } 2336 }
2336 2337 return 0;
2337 ret = 0;
2338
2339bail: 2338bail:
2339 for (i = 0; i < ARRAY_SIZE(ipath_class_attributes); ++i)
2340 device_remove_file(&dev->dev, ipath_class_attributes[i]);
2340 return ret; 2341 return ret;
2341} 2342}
diff --git a/drivers/infiniband/hw/mlx4/cq.c b/drivers/infiniband/hw/mlx4/cq.c
index ae67df35dd4d..dab4b5188a27 100644
--- a/drivers/infiniband/hw/mlx4/cq.c
+++ b/drivers/infiniband/hw/mlx4/cq.c
@@ -33,6 +33,7 @@
33 33
34#include <linux/mlx4/cq.h> 34#include <linux/mlx4/cq.h>
35#include <linux/mlx4/qp.h> 35#include <linux/mlx4/qp.h>
36#include <linux/mlx4/srq.h>
36#include <linux/slab.h> 37#include <linux/slab.h>
37 38
38#include "mlx4_ib.h" 39#include "mlx4_ib.h"
@@ -585,6 +586,7 @@ static int mlx4_ib_poll_one(struct mlx4_ib_cq *cq,
585 struct mlx4_qp *mqp; 586 struct mlx4_qp *mqp;
586 struct mlx4_ib_wq *wq; 587 struct mlx4_ib_wq *wq;
587 struct mlx4_ib_srq *srq; 588 struct mlx4_ib_srq *srq;
589 struct mlx4_srq *msrq = NULL;
588 int is_send; 590 int is_send;
589 int is_error; 591 int is_error;
590 u32 g_mlpath_rqpn; 592 u32 g_mlpath_rqpn;
@@ -653,6 +655,20 @@ repoll:
653 655
654 wc->qp = &(*cur_qp)->ibqp; 656 wc->qp = &(*cur_qp)->ibqp;
655 657
658 if (wc->qp->qp_type == IB_QPT_XRC_TGT) {
659 u32 srq_num;
660 g_mlpath_rqpn = be32_to_cpu(cqe->g_mlpath_rqpn);
661 srq_num = g_mlpath_rqpn & 0xffffff;
662 /* SRQ is also in the radix tree */
663 msrq = mlx4_srq_lookup(to_mdev(cq->ibcq.device)->dev,
664 srq_num);
665 if (unlikely(!msrq)) {
666 pr_warn("CQ %06x with entry for unknown SRQN %06x\n",
667 cq->mcq.cqn, srq_num);
668 return -EINVAL;
669 }
670 }
671
656 if (is_send) { 672 if (is_send) {
657 wq = &(*cur_qp)->sq; 673 wq = &(*cur_qp)->sq;
658 if (!(*cur_qp)->sq_signal_bits) { 674 if (!(*cur_qp)->sq_signal_bits) {
@@ -666,6 +682,11 @@ repoll:
666 wqe_ctr = be16_to_cpu(cqe->wqe_index); 682 wqe_ctr = be16_to_cpu(cqe->wqe_index);
667 wc->wr_id = srq->wrid[wqe_ctr]; 683 wc->wr_id = srq->wrid[wqe_ctr];
668 mlx4_ib_free_srq_wqe(srq, wqe_ctr); 684 mlx4_ib_free_srq_wqe(srq, wqe_ctr);
685 } else if (msrq) {
686 srq = to_mibsrq(msrq);
687 wqe_ctr = be16_to_cpu(cqe->wqe_index);
688 wc->wr_id = srq->wrid[wqe_ctr];
689 mlx4_ib_free_srq_wqe(srq, wqe_ctr);
669 } else { 690 } else {
670 wq = &(*cur_qp)->rq; 691 wq = &(*cur_qp)->rq;
671 tail = wq->tail & (wq->wqe_cnt - 1); 692 tail = wq->tail & (wq->wqe_cnt - 1);
diff --git a/drivers/infiniband/hw/mlx4/mad.c b/drivers/infiniband/hw/mlx4/mad.c
index 934792c477bc..4d599cedbb0b 100644
--- a/drivers/infiniband/hw/mlx4/mad.c
+++ b/drivers/infiniband/hw/mlx4/mad.c
@@ -93,7 +93,7 @@ static void __propagate_pkey_ev(struct mlx4_ib_dev *dev, int port_num,
93__be64 mlx4_ib_gen_node_guid(void) 93__be64 mlx4_ib_gen_node_guid(void)
94{ 94{
95#define NODE_GUID_HI ((u64) (((u64)IB_OPENIB_OUI) << 40)) 95#define NODE_GUID_HI ((u64) (((u64)IB_OPENIB_OUI) << 40))
96 return cpu_to_be64(NODE_GUID_HI | random32()); 96 return cpu_to_be64(NODE_GUID_HI | prandom_u32());
97} 97}
98 98
99__be64 mlx4_ib_get_new_demux_tid(struct mlx4_ib_demux_ctx *ctx) 99__be64 mlx4_ib_get_new_demux_tid(struct mlx4_ib_demux_ctx *ctx)
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index 35cced2a4da8..4f10af2905b5 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -1292,6 +1292,8 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
1292 if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) { 1292 if (cur_state == IB_QPS_RESET && new_state == IB_QPS_INIT) {
1293 context->sq_size_stride |= !!qp->sq_no_prefetch << 7; 1293 context->sq_size_stride |= !!qp->sq_no_prefetch << 7;
1294 context->xrcd = cpu_to_be32((u32) qp->xrcdn); 1294 context->xrcd = cpu_to_be32((u32) qp->xrcdn);
1295 if (ibqp->qp_type == IB_QPT_RAW_PACKET)
1296 context->param3 |= cpu_to_be32(1 << 30);
1295 } 1297 }
1296 1298
1297 if (qp->ibqp.uobject) 1299 if (qp->ibqp.uobject)
@@ -1458,6 +1460,10 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
1458 } 1460 }
1459 } 1461 }
1460 1462
1463 if (qp->ibqp.qp_type == IB_QPT_RAW_PACKET)
1464 context->pri_path.ackto = (context->pri_path.ackto & 0xf8) |
1465 MLX4_IB_LINK_TYPE_ETH;
1466
1461 if (cur_state == IB_QPS_RTS && new_state == IB_QPS_SQD && 1467 if (cur_state == IB_QPS_RTS && new_state == IB_QPS_SQD &&
1462 attr_mask & IB_QP_EN_SQD_ASYNC_NOTIFY && attr->en_sqd_async_notify) 1468 attr_mask & IB_QP_EN_SQD_ASYNC_NOTIFY && attr->en_sqd_async_notify)
1463 sqd_event = 1; 1469 sqd_event = 1;
diff --git a/drivers/infiniband/hw/qib/qib_sysfs.c b/drivers/infiniband/hw/qib/qib_sysfs.c
index 034cc821de5c..3c8e4e3caca6 100644
--- a/drivers/infiniband/hw/qib/qib_sysfs.c
+++ b/drivers/infiniband/hw/qib/qib_sysfs.c
@@ -808,10 +808,14 @@ int qib_verbs_register_sysfs(struct qib_devdata *dd)
808 for (i = 0; i < ARRAY_SIZE(qib_attributes); ++i) { 808 for (i = 0; i < ARRAY_SIZE(qib_attributes); ++i) {
809 ret = device_create_file(&dev->dev, qib_attributes[i]); 809 ret = device_create_file(&dev->dev, qib_attributes[i]);
810 if (ret) 810 if (ret)
811 return ret; 811 goto bail;
812 } 812 }
813 813
814 return 0; 814 return 0;
815bail:
816 for (i = 0; i < ARRAY_SIZE(qib_attributes); ++i)
817 device_remove_file(&dev->dev, qib_attributes[i]);
818 return ret;
815} 819}
816 820
817/* 821/*
diff --git a/drivers/infiniband/hw/qib/qib_verbs.c b/drivers/infiniband/hw/qib/qib_verbs.c
index 7c0ab16a2fe2..904c384aa361 100644
--- a/drivers/infiniband/hw/qib/qib_verbs.c
+++ b/drivers/infiniband/hw/qib/qib_verbs.c
@@ -2234,7 +2234,8 @@ int qib_register_ib_device(struct qib_devdata *dd)
2234 if (ret) 2234 if (ret)
2235 goto err_agents; 2235 goto err_agents;
2236 2236
2237 if (qib_verbs_register_sysfs(dd)) 2237 ret = qib_verbs_register_sysfs(dd);
2238 if (ret)
2238 goto err_class; 2239 goto err_class;
2239 2240
2240 goto bail; 2241 goto bail;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
index 1ef880de3a41..3eceb61e3532 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_cm.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_cm.c
@@ -460,7 +460,7 @@ static int ipoib_cm_req_handler(struct ib_cm_id *cm_id, struct ib_cm_event *even
460 goto err_qp; 460 goto err_qp;
461 } 461 }
462 462
463 psn = random32() & 0xffffff; 463 psn = prandom_u32() & 0xffffff;
464 ret = ipoib_cm_modify_rx_qp(dev, cm_id, p->qp, psn); 464 ret = ipoib_cm_modify_rx_qp(dev, cm_id, p->qp, psn);
465 if (ret) 465 if (ret)
466 goto err_modify; 466 goto err_modify;
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 8534afd04e7c..31dd2a7a880f 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -828,7 +828,7 @@ static int ipoib_hard_header(struct sk_buff *skb,
828 */ 828 */
829 memcpy(cb->hwaddr, daddr, INFINIBAND_ALEN); 829 memcpy(cb->hwaddr, daddr, INFINIBAND_ALEN);
830 830
831 return 0; 831 return sizeof *header;
832} 832}
833 833
834static void ipoib_set_mcast_list(struct net_device *dev) 834static void ipoib_set_mcast_list(struct net_device *dev)
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.c b/drivers/infiniband/ulp/iser/iscsi_iser.c
index 0ab8c9cc3a78..f19b0998a53c 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.c
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.c
@@ -82,10 +82,10 @@ module_param_named(max_lun, iscsi_max_lun, uint, S_IRUGO);
82 82
83int iser_debug_level = 0; 83int iser_debug_level = 0;
84 84
85MODULE_DESCRIPTION("iSER (iSCSI Extensions for RDMA) Datamover " 85MODULE_DESCRIPTION("iSER (iSCSI Extensions for RDMA) Datamover");
86 "v" DRV_VER " (" DRV_DATE ")");
87MODULE_LICENSE("Dual BSD/GPL"); 86MODULE_LICENSE("Dual BSD/GPL");
88MODULE_AUTHOR("Alex Nezhinsky, Dan Bar Dov, Or Gerlitz"); 87MODULE_AUTHOR("Alex Nezhinsky, Dan Bar Dov, Or Gerlitz");
88MODULE_VERSION(DRV_VER);
89 89
90module_param_named(debug_level, iser_debug_level, int, 0644); 90module_param_named(debug_level, iser_debug_level, int, 0644);
91MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0 (default:disabled)"); 91MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0 (default:disabled)");
@@ -370,8 +370,8 @@ iscsi_iser_conn_bind(struct iscsi_cls_session *cls_session,
370 /* binds the iSER connection retrieved from the previously 370 /* binds the iSER connection retrieved from the previously
371 * connected ep_handle to the iSCSI layer connection. exchanges 371 * connected ep_handle to the iSCSI layer connection. exchanges
372 * connection pointers */ 372 * connection pointers */
373 iser_err("binding iscsi/iser conn %p %p to ib_conn %p\n", 373 iser_info("binding iscsi/iser conn %p %p to ib_conn %p\n",
374 conn, conn->dd_data, ib_conn); 374 conn, conn->dd_data, ib_conn);
375 iser_conn = conn->dd_data; 375 iser_conn = conn->dd_data;
376 ib_conn->iser_conn = iser_conn; 376 ib_conn->iser_conn = iser_conn;
377 iser_conn->ib_conn = ib_conn; 377 iser_conn->ib_conn = ib_conn;
@@ -475,28 +475,28 @@ iscsi_iser_set_param(struct iscsi_cls_conn *cls_conn,
475 case ISCSI_PARAM_HDRDGST_EN: 475 case ISCSI_PARAM_HDRDGST_EN:
476 sscanf(buf, "%d", &value); 476 sscanf(buf, "%d", &value);
477 if (value) { 477 if (value) {
478 printk(KERN_ERR "DataDigest wasn't negotiated to None"); 478 iser_err("DataDigest wasn't negotiated to None");
479 return -EPROTO; 479 return -EPROTO;
480 } 480 }
481 break; 481 break;
482 case ISCSI_PARAM_DATADGST_EN: 482 case ISCSI_PARAM_DATADGST_EN:
483 sscanf(buf, "%d", &value); 483 sscanf(buf, "%d", &value);
484 if (value) { 484 if (value) {
485 printk(KERN_ERR "DataDigest wasn't negotiated to None"); 485 iser_err("DataDigest wasn't negotiated to None");
486 return -EPROTO; 486 return -EPROTO;
487 } 487 }
488 break; 488 break;
489 case ISCSI_PARAM_IFMARKER_EN: 489 case ISCSI_PARAM_IFMARKER_EN:
490 sscanf(buf, "%d", &value); 490 sscanf(buf, "%d", &value);
491 if (value) { 491 if (value) {
492 printk(KERN_ERR "IFMarker wasn't negotiated to No"); 492 iser_err("IFMarker wasn't negotiated to No");
493 return -EPROTO; 493 return -EPROTO;
494 } 494 }
495 break; 495 break;
496 case ISCSI_PARAM_OFMARKER_EN: 496 case ISCSI_PARAM_OFMARKER_EN:
497 sscanf(buf, "%d", &value); 497 sscanf(buf, "%d", &value);
498 if (value) { 498 if (value) {
499 printk(KERN_ERR "OFMarker wasn't negotiated to No"); 499 iser_err("OFMarker wasn't negotiated to No");
500 return -EPROTO; 500 return -EPROTO;
501 } 501 }
502 break; 502 break;
@@ -596,7 +596,7 @@ iscsi_iser_ep_poll(struct iscsi_endpoint *ep, int timeout_ms)
596 ib_conn->state == ISER_CONN_DOWN)) 596 ib_conn->state == ISER_CONN_DOWN))
597 rc = -1; 597 rc = -1;
598 598
599 iser_err("ib conn %p rc = %d\n", ib_conn, rc); 599 iser_info("ib conn %p rc = %d\n", ib_conn, rc);
600 600
601 if (rc > 0) 601 if (rc > 0)
602 return 1; /* success, this is the equivalent of POLLOUT */ 602 return 1; /* success, this is the equivalent of POLLOUT */
@@ -623,7 +623,7 @@ iscsi_iser_ep_disconnect(struct iscsi_endpoint *ep)
623 iscsi_suspend_tx(ib_conn->iser_conn->iscsi_conn); 623 iscsi_suspend_tx(ib_conn->iser_conn->iscsi_conn);
624 624
625 625
626 iser_err("ib conn %p state %d\n",ib_conn, ib_conn->state); 626 iser_info("ib conn %p state %d\n", ib_conn, ib_conn->state);
627 iser_conn_terminate(ib_conn); 627 iser_conn_terminate(ib_conn);
628} 628}
629 629
@@ -682,7 +682,7 @@ static umode_t iser_attr_is_visible(int param_type, int param)
682 682
683static struct scsi_host_template iscsi_iser_sht = { 683static struct scsi_host_template iscsi_iser_sht = {
684 .module = THIS_MODULE, 684 .module = THIS_MODULE,
685 .name = "iSCSI Initiator over iSER, v." DRV_VER, 685 .name = "iSCSI Initiator over iSER",
686 .queuecommand = iscsi_queuecommand, 686 .queuecommand = iscsi_queuecommand,
687 .change_queue_depth = iscsi_change_queue_depth, 687 .change_queue_depth = iscsi_change_queue_depth,
688 .sg_tablesize = ISCSI_ISER_SG_TABLESIZE, 688 .sg_tablesize = ISCSI_ISER_SG_TABLESIZE,
@@ -740,7 +740,7 @@ static int __init iser_init(void)
740 iser_dbg("Starting iSER datamover...\n"); 740 iser_dbg("Starting iSER datamover...\n");
741 741
742 if (iscsi_max_lun < 1) { 742 if (iscsi_max_lun < 1) {
743 printk(KERN_ERR "Invalid max_lun value of %u\n", iscsi_max_lun); 743 iser_err("Invalid max_lun value of %u\n", iscsi_max_lun);
744 return -EINVAL; 744 return -EINVAL;
745 } 745 }
746 746
diff --git a/drivers/infiniband/ulp/iser/iscsi_iser.h b/drivers/infiniband/ulp/iser/iscsi_iser.h
index 5babdb35bda7..06f578cde75b 100644
--- a/drivers/infiniband/ulp/iser/iscsi_iser.h
+++ b/drivers/infiniband/ulp/iser/iscsi_iser.h
@@ -42,6 +42,7 @@
42 42
43#include <linux/types.h> 43#include <linux/types.h>
44#include <linux/net.h> 44#include <linux/net.h>
45#include <linux/printk.h>
45#include <scsi/libiscsi.h> 46#include <scsi/libiscsi.h>
46#include <scsi/scsi_transport_iscsi.h> 47#include <scsi/scsi_transport_iscsi.h>
47 48
@@ -65,20 +66,26 @@
65 66
66#define DRV_NAME "iser" 67#define DRV_NAME "iser"
67#define PFX DRV_NAME ": " 68#define PFX DRV_NAME ": "
68#define DRV_VER "0.1" 69#define DRV_VER "1.1"
69#define DRV_DATE "May 7th, 2006"
70 70
71#define iser_dbg(fmt, arg...) \ 71#define iser_dbg(fmt, arg...) \
72 do { \ 72 do { \
73 if (iser_debug_level > 1) \ 73 if (iser_debug_level > 2) \
74 printk(KERN_DEBUG PFX "%s:" fmt,\ 74 printk(KERN_DEBUG PFX "%s:" fmt,\
75 __func__ , ## arg); \ 75 __func__ , ## arg); \
76 } while (0) 76 } while (0)
77 77
78#define iser_warn(fmt, arg...) \ 78#define iser_warn(fmt, arg...) \
79 do { \ 79 do { \
80 if (iser_debug_level > 1) \
81 pr_warn(PFX "%s:" fmt, \
82 __func__ , ## arg); \
83 } while (0)
84
85#define iser_info(fmt, arg...) \
86 do { \
80 if (iser_debug_level > 0) \ 87 if (iser_debug_level > 0) \
81 printk(KERN_DEBUG PFX "%s:" fmt,\ 88 pr_info(PFX "%s:" fmt, \
82 __func__ , ## arg); \ 89 __func__ , ## arg); \
83 } while (0) 90 } while (0)
84 91
@@ -133,6 +140,15 @@ struct iser_hdr {
133 __be64 read_va; 140 __be64 read_va;
134} __attribute__((packed)); 141} __attribute__((packed));
135 142
143
144#define ISER_ZBVA_NOT_SUPPORTED 0x80
145#define ISER_SEND_W_INV_NOT_SUPPORTED 0x40
146
147struct iser_cm_hdr {
148 u8 flags;
149 u8 rsvd[3];
150} __packed;
151
136/* Constant PDU lengths calculations */ 152/* Constant PDU lengths calculations */
137#define ISER_HEADERS_LEN (sizeof(struct iser_hdr) + sizeof(struct iscsi_hdr)) 153#define ISER_HEADERS_LEN (sizeof(struct iser_hdr) + sizeof(struct iscsi_hdr))
138 154
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c
index be1edb04b085..68ebb7fe072a 100644
--- a/drivers/infiniband/ulp/iser/iser_memory.c
+++ b/drivers/infiniband/ulp/iser/iser_memory.c
@@ -416,8 +416,9 @@ int iser_reg_rdma_mem(struct iscsi_iser_task *iser_task,
416 for (i=0 ; i<ib_conn->page_vec->length ; i++) 416 for (i=0 ; i<ib_conn->page_vec->length ; i++)
417 iser_err("page_vec[%d] = 0x%llx\n", i, 417 iser_err("page_vec[%d] = 0x%llx\n", i,
418 (unsigned long long) ib_conn->page_vec->pages[i]); 418 (unsigned long long) ib_conn->page_vec->pages[i]);
419 return err;
420 } 419 }
420 if (err)
421 return err;
421 } 422 }
422 return 0; 423 return 0;
423} 424}
diff --git a/drivers/infiniband/ulp/iser/iser_verbs.c b/drivers/infiniband/ulp/iser/iser_verbs.c
index 4debadc53106..5278916c3103 100644
--- a/drivers/infiniband/ulp/iser/iser_verbs.c
+++ b/drivers/infiniband/ulp/iser/iser_verbs.c
@@ -74,8 +74,9 @@ static int iser_create_device_ib_res(struct iser_device *device)
74 struct iser_cq_desc *cq_desc; 74 struct iser_cq_desc *cq_desc;
75 75
76 device->cqs_used = min(ISER_MAX_CQ, device->ib_device->num_comp_vectors); 76 device->cqs_used = min(ISER_MAX_CQ, device->ib_device->num_comp_vectors);
77 iser_err("using %d CQs, device %s supports %d vectors\n", device->cqs_used, 77 iser_info("using %d CQs, device %s supports %d vectors\n",
78 device->ib_device->name, device->ib_device->num_comp_vectors); 78 device->cqs_used, device->ib_device->name,
79 device->ib_device->num_comp_vectors);
79 80
80 device->cq_desc = kmalloc(sizeof(struct iser_cq_desc) * device->cqs_used, 81 device->cq_desc = kmalloc(sizeof(struct iser_cq_desc) * device->cqs_used,
81 GFP_KERNEL); 82 GFP_KERNEL);
@@ -262,7 +263,7 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn)
262 min_index = index; 263 min_index = index;
263 device->cq_active_qps[min_index]++; 264 device->cq_active_qps[min_index]++;
264 mutex_unlock(&ig.connlist_mutex); 265 mutex_unlock(&ig.connlist_mutex);
265 iser_err("cq index %d used for ib_conn %p\n", min_index, ib_conn); 266 iser_info("cq index %d used for ib_conn %p\n", min_index, ib_conn);
266 267
267 init_attr.event_handler = iser_qp_event_callback; 268 init_attr.event_handler = iser_qp_event_callback;
268 init_attr.qp_context = (void *)ib_conn; 269 init_attr.qp_context = (void *)ib_conn;
@@ -280,9 +281,9 @@ static int iser_create_ib_conn_res(struct iser_conn *ib_conn)
280 goto out_err; 281 goto out_err;
281 282
282 ib_conn->qp = ib_conn->cma_id->qp; 283 ib_conn->qp = ib_conn->cma_id->qp;
283 iser_err("setting conn %p cma_id %p: fmr_pool %p qp %p\n", 284 iser_info("setting conn %p cma_id %p: fmr_pool %p qp %p\n",
284 ib_conn, ib_conn->cma_id, 285 ib_conn, ib_conn->cma_id,
285 ib_conn->fmr_pool, ib_conn->cma_id->qp); 286 ib_conn->fmr_pool, ib_conn->cma_id->qp);
286 return ret; 287 return ret;
287 288
288out_err: 289out_err:
@@ -299,9 +300,9 @@ static int iser_free_ib_conn_res(struct iser_conn *ib_conn, int can_destroy_id)
299 int cq_index; 300 int cq_index;
300 BUG_ON(ib_conn == NULL); 301 BUG_ON(ib_conn == NULL);
301 302
302 iser_err("freeing conn %p cma_id %p fmr pool %p qp %p\n", 303 iser_info("freeing conn %p cma_id %p fmr pool %p qp %p\n",
303 ib_conn, ib_conn->cma_id, 304 ib_conn, ib_conn->cma_id,
304 ib_conn->fmr_pool, ib_conn->qp); 305 ib_conn->fmr_pool, ib_conn->qp);
305 306
306 /* qp is created only once both addr & route are resolved */ 307 /* qp is created only once both addr & route are resolved */
307 if (ib_conn->fmr_pool != NULL) 308 if (ib_conn->fmr_pool != NULL)
@@ -379,7 +380,7 @@ static void iser_device_try_release(struct iser_device *device)
379{ 380{
380 mutex_lock(&ig.device_list_mutex); 381 mutex_lock(&ig.device_list_mutex);
381 device->refcount--; 382 device->refcount--;
382 iser_err("device %p refcount %d\n",device,device->refcount); 383 iser_info("device %p refcount %d\n", device, device->refcount);
383 if (!device->refcount) { 384 if (!device->refcount) {
384 iser_free_device_ib_res(device); 385 iser_free_device_ib_res(device);
385 list_del(&device->ig_list); 386 list_del(&device->ig_list);
@@ -498,6 +499,7 @@ static int iser_route_handler(struct rdma_cm_id *cma_id)
498{ 499{
499 struct rdma_conn_param conn_param; 500 struct rdma_conn_param conn_param;
500 int ret; 501 int ret;
502 struct iser_cm_hdr req_hdr;
501 503
502 ret = iser_create_ib_conn_res((struct iser_conn *)cma_id->context); 504 ret = iser_create_ib_conn_res((struct iser_conn *)cma_id->context);
503 if (ret) 505 if (ret)
@@ -509,6 +511,12 @@ static int iser_route_handler(struct rdma_cm_id *cma_id)
509 conn_param.retry_count = 7; 511 conn_param.retry_count = 7;
510 conn_param.rnr_retry_count = 6; 512 conn_param.rnr_retry_count = 6;
511 513
514 memset(&req_hdr, 0, sizeof(req_hdr));
515 req_hdr.flags = (ISER_ZBVA_NOT_SUPPORTED |
516 ISER_SEND_W_INV_NOT_SUPPORTED);
517 conn_param.private_data = (void *)&req_hdr;
518 conn_param.private_data_len = sizeof(struct iser_cm_hdr);
519
512 ret = rdma_connect(cma_id, &conn_param); 520 ret = rdma_connect(cma_id, &conn_param);
513 if (ret) { 521 if (ret) {
514 iser_err("failure connecting: %d\n", ret); 522 iser_err("failure connecting: %d\n", ret);
@@ -558,8 +566,8 @@ static int iser_cma_handler(struct rdma_cm_id *cma_id, struct rdma_cm_event *eve
558{ 566{
559 int ret = 0; 567 int ret = 0;
560 568
561 iser_err("event %d status %d conn %p id %p\n", 569 iser_info("event %d status %d conn %p id %p\n",
562 event->event, event->status, cma_id->context, cma_id); 570 event->event, event->status, cma_id->context, cma_id);
563 571
564 switch (event->event) { 572 switch (event->event) {
565 case RDMA_CM_EVENT_ADDR_RESOLVED: 573 case RDMA_CM_EVENT_ADDR_RESOLVED:
@@ -619,8 +627,8 @@ int iser_connect(struct iser_conn *ib_conn,
619 /* the device is known only --after-- address resolution */ 627 /* the device is known only --after-- address resolution */
620 ib_conn->device = NULL; 628 ib_conn->device = NULL;
621 629
622 iser_err("connecting to: %pI4, port 0x%x\n", 630 iser_info("connecting to: %pI4, port 0x%x\n",
623 &dst_addr->sin_addr, dst_addr->sin_port); 631 &dst_addr->sin_addr, dst_addr->sin_port);
624 632
625 ib_conn->state = ISER_CONN_PENDING; 633 ib_conn->state = ISER_CONN_PENDING;
626 634