aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSagi Grimberg <sagig@mellanox.com>2014-01-09 11:40:50 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2014-01-18 21:22:07 -0500
commita3a5a82627492c8947d8866ddf421e9248088466 (patch)
treec00c8baeb0791fa43a584dee79e1888696a4fffc
parenteb6ab13267be87dcad3e611500b7cb404ed4479c (diff)
IB/isert: Avoid frwr notation, user fastreg
Use fast registration lingo. fast registration will also incorporate signature/DIF registration. Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/infiniband/ulp/isert/ib_isert.c84
-rw-r--r--drivers/infiniband/ulp/isert/ib_isert.h8
2 files changed, 47 insertions, 45 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 3dd24272b1cd..295d2be6874c 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -47,10 +47,10 @@ static int
47isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd, 47isert_map_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
48 struct isert_rdma_wr *wr); 48 struct isert_rdma_wr *wr);
49static void 49static void
50isert_unreg_rdma_frwr(struct isert_cmd *isert_cmd, struct isert_conn *isert_conn); 50isert_unreg_rdma(struct isert_cmd *isert_cmd, struct isert_conn *isert_conn);
51static int 51static int
52isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd, 52isert_reg_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
53 struct isert_rdma_wr *wr); 53 struct isert_rdma_wr *wr);
54 54
55static void 55static void
56isert_qp_event_callback(struct ib_event *e, void *context) 56isert_qp_event_callback(struct ib_event *e, void *context)
@@ -225,11 +225,11 @@ isert_create_device_ib_res(struct isert_device *device)
225 225
226 /* asign function handlers */ 226 /* asign function handlers */
227 if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) { 227 if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) {
228 device->use_frwr = 1; 228 device->use_fastreg = 1;
229 device->reg_rdma_mem = isert_reg_rdma_frwr; 229 device->reg_rdma_mem = isert_reg_rdma;
230 device->unreg_rdma_mem = isert_unreg_rdma_frwr; 230 device->unreg_rdma_mem = isert_unreg_rdma;
231 } else { 231 } else {
232 device->use_frwr = 0; 232 device->use_fastreg = 0;
233 device->reg_rdma_mem = isert_map_rdma; 233 device->reg_rdma_mem = isert_map_rdma;
234 device->unreg_rdma_mem = isert_unmap_cmd; 234 device->unreg_rdma_mem = isert_unmap_cmd;
235 } 235 }
@@ -237,9 +237,10 @@ isert_create_device_ib_res(struct isert_device *device)
237 device->cqs_used = min_t(int, num_online_cpus(), 237 device->cqs_used = min_t(int, num_online_cpus(),
238 device->ib_device->num_comp_vectors); 238 device->ib_device->num_comp_vectors);
239 device->cqs_used = min(ISERT_MAX_CQ, device->cqs_used); 239 device->cqs_used = min(ISERT_MAX_CQ, device->cqs_used);
240 pr_debug("Using %d CQs, device %s supports %d vectors support FRWR %d\n", 240 pr_debug("Using %d CQs, device %s supports %d vectors support "
241 "Fast registration %d\n",
241 device->cqs_used, device->ib_device->name, 242 device->cqs_used, device->ib_device->name,
242 device->ib_device->num_comp_vectors, device->use_frwr); 243 device->ib_device->num_comp_vectors, device->use_fastreg);
243 device->cq_desc = kzalloc(sizeof(struct isert_cq_desc) * 244 device->cq_desc = kzalloc(sizeof(struct isert_cq_desc) *
244 device->cqs_used, GFP_KERNEL); 245 device->cqs_used, GFP_KERNEL);
245 if (!device->cq_desc) { 246 if (!device->cq_desc) {
@@ -367,18 +368,18 @@ isert_device_find_by_ib_dev(struct rdma_cm_id *cma_id)
367} 368}
368 369
369static void 370static void
370isert_conn_free_frwr_pool(struct isert_conn *isert_conn) 371isert_conn_free_fastreg_pool(struct isert_conn *isert_conn)
371{ 372{
372 struct fast_reg_descriptor *fr_desc, *tmp; 373 struct fast_reg_descriptor *fr_desc, *tmp;
373 int i = 0; 374 int i = 0;
374 375
375 if (list_empty(&isert_conn->conn_frwr_pool)) 376 if (list_empty(&isert_conn->conn_fr_pool))
376 return; 377 return;
377 378
378 pr_debug("Freeing conn %p frwr pool", isert_conn); 379 pr_debug("Freeing conn %p fastreg pool", isert_conn);
379 380
380 list_for_each_entry_safe(fr_desc, tmp, 381 list_for_each_entry_safe(fr_desc, tmp,
381 &isert_conn->conn_frwr_pool, list) { 382 &isert_conn->conn_fr_pool, list) {
382 list_del(&fr_desc->list); 383 list_del(&fr_desc->list);
383 ib_free_fast_reg_page_list(fr_desc->data_frpl); 384 ib_free_fast_reg_page_list(fr_desc->data_frpl);
384 ib_dereg_mr(fr_desc->data_mr); 385 ib_dereg_mr(fr_desc->data_mr);
@@ -386,20 +387,20 @@ isert_conn_free_frwr_pool(struct isert_conn *isert_conn)
386 ++i; 387 ++i;
387 } 388 }
388 389
389 if (i < isert_conn->conn_frwr_pool_size) 390 if (i < isert_conn->conn_fr_pool_size)
390 pr_warn("Pool still has %d regions registered\n", 391 pr_warn("Pool still has %d regions registered\n",
391 isert_conn->conn_frwr_pool_size - i); 392 isert_conn->conn_fr_pool_size - i);
392} 393}
393 394
394static int 395static int
395isert_conn_create_frwr_pool(struct isert_conn *isert_conn) 396isert_conn_create_fastreg_pool(struct isert_conn *isert_conn)
396{ 397{
397 struct fast_reg_descriptor *fr_desc; 398 struct fast_reg_descriptor *fr_desc;
398 struct isert_device *device = isert_conn->conn_device; 399 struct isert_device *device = isert_conn->conn_device;
399 int i, ret; 400 int i, ret;
400 401
401 INIT_LIST_HEAD(&isert_conn->conn_frwr_pool); 402 INIT_LIST_HEAD(&isert_conn->conn_fr_pool);
402 isert_conn->conn_frwr_pool_size = 0; 403 isert_conn->conn_fr_pool_size = 0;
403 for (i = 0; i < ISCSI_DEF_XMIT_CMDS_MAX; i++) { 404 for (i = 0; i < ISCSI_DEF_XMIT_CMDS_MAX; i++) {
404 fr_desc = kzalloc(sizeof(*fr_desc), GFP_KERNEL); 405 fr_desc = kzalloc(sizeof(*fr_desc), GFP_KERNEL);
405 if (!fr_desc) { 406 if (!fr_desc) {
@@ -431,17 +432,17 @@ isert_conn_create_frwr_pool(struct isert_conn *isert_conn)
431 fr_desc, fr_desc->data_frpl->page_list); 432 fr_desc, fr_desc->data_frpl->page_list);
432 433
433 fr_desc->valid = true; 434 fr_desc->valid = true;
434 list_add_tail(&fr_desc->list, &isert_conn->conn_frwr_pool); 435 list_add_tail(&fr_desc->list, &isert_conn->conn_fr_pool);
435 isert_conn->conn_frwr_pool_size++; 436 isert_conn->conn_fr_pool_size++;
436 } 437 }
437 438
438 pr_debug("Creating conn %p frwr pool size=%d", 439 pr_debug("Creating conn %p fastreg pool size=%d",
439 isert_conn, isert_conn->conn_frwr_pool_size); 440 isert_conn, isert_conn->conn_fr_pool_size);
440 441
441 return 0; 442 return 0;
442 443
443err: 444err:
444 isert_conn_free_frwr_pool(isert_conn); 445 isert_conn_free_fastreg_pool(isert_conn);
445 return ret; 446 return ret;
446} 447}
447 448
@@ -544,11 +545,12 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
544 goto out_mr; 545 goto out_mr;
545 } 546 }
546 547
547 if (device->use_frwr) { 548 if (device->use_fastreg) {
548 ret = isert_conn_create_frwr_pool(isert_conn); 549 ret = isert_conn_create_fastreg_pool(isert_conn);
549 if (ret) { 550 if (ret) {
550 pr_err("Conn: %p failed to create frwr_pool\n", isert_conn); 551 pr_err("Conn: %p failed to create fastreg pool\n",
551 goto out_frwr; 552 isert_conn);
553 goto out_fastreg;
552 } 554 }
553 } 555 }
554 556
@@ -565,9 +567,9 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event)
565 return 0; 567 return 0;
566 568
567out_conn_dev: 569out_conn_dev:
568 if (device->use_frwr) 570 if (device->use_fastreg)
569 isert_conn_free_frwr_pool(isert_conn); 571 isert_conn_free_fastreg_pool(isert_conn);
570out_frwr: 572out_fastreg:
571 ib_dereg_mr(isert_conn->conn_mr); 573 ib_dereg_mr(isert_conn->conn_mr);
572out_mr: 574out_mr:
573 ib_dealloc_pd(isert_conn->conn_pd); 575 ib_dealloc_pd(isert_conn->conn_pd);
@@ -595,8 +597,8 @@ isert_connect_release(struct isert_conn *isert_conn)
595 597
596 pr_debug("Entering isert_connect_release(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n"); 598 pr_debug("Entering isert_connect_release(): >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\n");
597 599
598 if (device && device->use_frwr) 600 if (device && device->use_fastreg)
599 isert_conn_free_frwr_pool(isert_conn); 601 isert_conn_free_fastreg_pool(isert_conn);
600 602
601 if (isert_conn->conn_qp) { 603 if (isert_conn->conn_qp) {
602 cq_index = ((struct isert_cq_desc *) 604 cq_index = ((struct isert_cq_desc *)
@@ -1394,25 +1396,25 @@ isert_unmap_cmd(struct isert_cmd *isert_cmd, struct isert_conn *isert_conn)
1394} 1396}
1395 1397
1396static void 1398static void
1397isert_unreg_rdma_frwr(struct isert_cmd *isert_cmd, struct isert_conn *isert_conn) 1399isert_unreg_rdma(struct isert_cmd *isert_cmd, struct isert_conn *isert_conn)
1398{ 1400{
1399 struct isert_rdma_wr *wr = &isert_cmd->rdma_wr; 1401 struct isert_rdma_wr *wr = &isert_cmd->rdma_wr;
1400 struct ib_device *ib_dev = isert_conn->conn_cm_id->device; 1402 struct ib_device *ib_dev = isert_conn->conn_cm_id->device;
1401 LIST_HEAD(unmap_list); 1403 LIST_HEAD(unmap_list);
1402 1404
1403 pr_debug("unreg_frwr_cmd: %p\n", isert_cmd); 1405 pr_debug("unreg_fastreg_cmd: %p\n", isert_cmd);
1404 1406
1405 if (wr->fr_desc) { 1407 if (wr->fr_desc) {
1406 pr_debug("unreg_frwr_cmd: %p free fr_desc %p\n", 1408 pr_debug("unreg_fastreg_cmd: %p free fr_desc %p\n",
1407 isert_cmd, wr->fr_desc); 1409 isert_cmd, wr->fr_desc);
1408 spin_lock_bh(&isert_conn->conn_lock); 1410 spin_lock_bh(&isert_conn->conn_lock);
1409 list_add_tail(&wr->fr_desc->list, &isert_conn->conn_frwr_pool); 1411 list_add_tail(&wr->fr_desc->list, &isert_conn->conn_fr_pool);
1410 spin_unlock_bh(&isert_conn->conn_lock); 1412 spin_unlock_bh(&isert_conn->conn_lock);
1411 wr->fr_desc = NULL; 1413 wr->fr_desc = NULL;
1412 } 1414 }
1413 1415
1414 if (wr->sge) { 1416 if (wr->sge) {
1415 pr_debug("unreg_frwr_cmd: %p unmap_sg op\n", isert_cmd); 1417 pr_debug("unreg_fastreg_cmd: %p unmap_sg op\n", isert_cmd);
1416 ib_dma_unmap_sg(ib_dev, wr->sge, wr->num_sge, 1418 ib_dma_unmap_sg(ib_dev, wr->sge, wr->num_sge,
1417 (wr->iser_ib_op == ISER_IB_RDMA_WRITE) ? 1419 (wr->iser_ib_op == ISER_IB_RDMA_WRITE) ?
1418 DMA_TO_DEVICE : DMA_FROM_DEVICE); 1420 DMA_TO_DEVICE : DMA_FROM_DEVICE);
@@ -2224,8 +2226,8 @@ isert_fast_reg_mr(struct fast_reg_descriptor *fr_desc,
2224} 2226}
2225 2227
2226static int 2228static int
2227isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd, 2229isert_reg_rdma(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
2228 struct isert_rdma_wr *wr) 2230 struct isert_rdma_wr *wr)
2229{ 2231{
2230 struct se_cmd *se_cmd = &cmd->se_cmd; 2232 struct se_cmd *se_cmd = &cmd->se_cmd;
2231 struct isert_cmd *isert_cmd = iscsit_priv_cmd(cmd); 2233 struct isert_cmd *isert_cmd = iscsit_priv_cmd(cmd);
@@ -2303,7 +2305,7 @@ isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
2303 wr->fr_desc = NULL; 2305 wr->fr_desc = NULL;
2304 } else { 2306 } else {
2305 spin_lock_irqsave(&isert_conn->conn_lock, flags); 2307 spin_lock_irqsave(&isert_conn->conn_lock, flags);
2306 fr_desc = list_first_entry(&isert_conn->conn_frwr_pool, 2308 fr_desc = list_first_entry(&isert_conn->conn_fr_pool,
2307 struct fast_reg_descriptor, list); 2309 struct fast_reg_descriptor, list);
2308 list_del(&fr_desc->list); 2310 list_del(&fr_desc->list);
2309 spin_unlock_irqrestore(&isert_conn->conn_lock, flags); 2311 spin_unlock_irqrestore(&isert_conn->conn_lock, flags);
@@ -2312,7 +2314,7 @@ isert_reg_rdma_frwr(struct iscsi_conn *conn, struct iscsi_cmd *cmd,
2312 ret = isert_fast_reg_mr(fr_desc, isert_cmd, isert_conn, 2314 ret = isert_fast_reg_mr(fr_desc, isert_cmd, isert_conn,
2313 ib_sge, offset, data_len); 2315 ib_sge, offset, data_len);
2314 if (ret) { 2316 if (ret) {
2315 list_add_tail(&fr_desc->list, &isert_conn->conn_frwr_pool); 2317 list_add_tail(&fr_desc->list, &isert_conn->conn_fr_pool);
2316 goto unmap_sg; 2318 goto unmap_sg;
2317 } 2319 }
2318 } 2320 }
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h
index dec74d4c4bad..708a069002f3 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.h
+++ b/drivers/infiniband/ulp/isert/ib_isert.h
@@ -119,9 +119,9 @@ struct isert_conn {
119 wait_queue_head_t conn_wait; 119 wait_queue_head_t conn_wait;
120 wait_queue_head_t conn_wait_comp_err; 120 wait_queue_head_t conn_wait_comp_err;
121 struct kref conn_kref; 121 struct kref conn_kref;
122 struct list_head conn_frwr_pool; 122 struct list_head conn_fr_pool;
123 int conn_frwr_pool_size; 123 int conn_fr_pool_size;
124 /* lock to protect frwr_pool */ 124 /* lock to protect fastreg pool */
125 spinlock_t conn_lock; 125 spinlock_t conn_lock;
126#define ISERT_COMP_BATCH_COUNT 8 126#define ISERT_COMP_BATCH_COUNT 8
127 int conn_comp_batch; 127 int conn_comp_batch;
@@ -139,7 +139,7 @@ struct isert_cq_desc {
139}; 139};
140 140
141struct isert_device { 141struct isert_device {
142 int use_frwr; 142 int use_fastreg;
143 int cqs_used; 143 int cqs_used;
144 int refcount; 144 int refcount;
145 int cq_active_qps[ISERT_MAX_CQ]; 145 int cq_active_qps[ISERT_MAX_CQ];