diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2015-03-29 08:52:05 -0400 |
---|---|---|
committer | Nicholas Bellinger <nab@linux-iscsi.org> | 2015-04-08 02:27:49 -0400 |
commit | 67cb39492571433b95eb2952edca46f024ddf16c (patch) | |
tree | 90f883b53bee25ccf6a76cee4c0dc452d9d9a769 | |
parent | 4a579da2586bd3b79b025947ea24ede2bbfede62 (diff) |
iser-target: Use a single DMA MR and PD per device
This is to favor the HCA cache hit rate using less MRs
and PDs. This commit partially reverts commit:
"eb6ab13 IB/isert: separate connection protection domains and dma MRs"
At the time I thought this would be needed.
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.c | 99 | ||||
-rw-r--r-- | drivers/infiniband/ulp/isert/ib_isert.h | 4 |
2 files changed, 55 insertions, 48 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c index 147029adb885..506c2eb60808 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.c +++ b/drivers/infiniband/ulp/isert/ib_isert.c | |||
@@ -149,7 +149,7 @@ isert_conn_setup_qp(struct isert_conn *isert_conn, struct rdma_cm_id *cma_id) | |||
149 | if (device->pi_capable) | 149 | if (device->pi_capable) |
150 | attr.create_flags |= IB_QP_CREATE_SIGNATURE_EN; | 150 | attr.create_flags |= IB_QP_CREATE_SIGNATURE_EN; |
151 | 151 | ||
152 | ret = rdma_create_qp(cma_id, isert_conn->conn_pd, &attr); | 152 | ret = rdma_create_qp(cma_id, device->pd, &attr); |
153 | if (ret) { | 153 | if (ret) { |
154 | isert_err("rdma_create_qp failed for cma_id %d\n", ret); | 154 | isert_err("rdma_create_qp failed for cma_id %d\n", ret); |
155 | goto err; | 155 | goto err; |
@@ -174,7 +174,8 @@ isert_cq_event_callback(struct ib_event *e, void *context) | |||
174 | static int | 174 | static int |
175 | isert_alloc_rx_descriptors(struct isert_conn *isert_conn) | 175 | isert_alloc_rx_descriptors(struct isert_conn *isert_conn) |
176 | { | 176 | { |
177 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 177 | struct isert_device *device = isert_conn->conn_device; |
178 | struct ib_device *ib_dev = device->ib_device; | ||
178 | struct iser_rx_desc *rx_desc; | 179 | struct iser_rx_desc *rx_desc; |
179 | struct ib_sge *rx_sg; | 180 | struct ib_sge *rx_sg; |
180 | u64 dma_addr; | 181 | u64 dma_addr; |
@@ -198,7 +199,7 @@ isert_alloc_rx_descriptors(struct isert_conn *isert_conn) | |||
198 | rx_sg = &rx_desc->rx_sg; | 199 | rx_sg = &rx_desc->rx_sg; |
199 | rx_sg->addr = rx_desc->dma_addr; | 200 | rx_sg->addr = rx_desc->dma_addr; |
200 | rx_sg->length = ISER_RX_PAYLOAD_SIZE; | 201 | rx_sg->length = ISER_RX_PAYLOAD_SIZE; |
201 | rx_sg->lkey = isert_conn->conn_mr->lkey; | 202 | rx_sg->lkey = device->mr->lkey; |
202 | } | 203 | } |
203 | 204 | ||
204 | isert_conn->conn_rx_desc_head = 0; | 205 | isert_conn->conn_rx_desc_head = 0; |
@@ -309,8 +310,27 @@ isert_create_device_ib_res(struct isert_device *device) | |||
309 | goto out_cq; | 310 | goto out_cq; |
310 | } | 311 | } |
311 | 312 | ||
313 | device->pd = ib_alloc_pd(device->ib_device); | ||
314 | if (IS_ERR(device->pd)) { | ||
315 | ret = PTR_ERR(device->pd); | ||
316 | isert_err("failed to allocate pd, device %p, ret=%d\n", | ||
317 | device, ret); | ||
318 | goto out_cq; | ||
319 | } | ||
320 | |||
321 | device->mr = ib_get_dma_mr(device->pd, IB_ACCESS_LOCAL_WRITE); | ||
322 | if (IS_ERR(device->mr)) { | ||
323 | ret = PTR_ERR(device->mr); | ||
324 | isert_err("failed to create dma mr, device %p, ret=%d\n", | ||
325 | device, ret); | ||
326 | goto out_mr; | ||
327 | } | ||
328 | |||
329 | |||
312 | return 0; | 330 | return 0; |
313 | 331 | ||
332 | out_mr: | ||
333 | ib_dealloc_pd(device->pd); | ||
314 | out_cq: | 334 | out_cq: |
315 | for (i = 0; i < device->comps_used; i++) { | 335 | for (i = 0; i < device->comps_used; i++) { |
316 | struct isert_comp *comp = &device->comps[i]; | 336 | struct isert_comp *comp = &device->comps[i]; |
@@ -332,6 +352,8 @@ isert_free_device_ib_res(struct isert_device *device) | |||
332 | 352 | ||
333 | isert_info("device %p\n", device); | 353 | isert_info("device %p\n", device); |
334 | 354 | ||
355 | ib_dereg_mr(device->mr); | ||
356 | ib_dealloc_pd(device->pd); | ||
335 | for (i = 0; i < device->comps_used; i++) { | 357 | for (i = 0; i < device->comps_used; i++) { |
336 | struct isert_comp *comp = &device->comps[i]; | 358 | struct isert_comp *comp = &device->comps[i]; |
337 | 359 | ||
@@ -547,7 +569,7 @@ isert_conn_create_fastreg_pool(struct isert_conn *isert_conn) | |||
547 | } | 569 | } |
548 | 570 | ||
549 | ret = isert_create_fr_desc(device->ib_device, | 571 | ret = isert_create_fr_desc(device->ib_device, |
550 | isert_conn->conn_pd, fr_desc); | 572 | device->pd, fr_desc); |
551 | if (ret) { | 573 | if (ret) { |
552 | isert_err("Failed to create fastreg descriptor err=%d\n", | 574 | isert_err("Failed to create fastreg descriptor err=%d\n", |
553 | ret); | 575 | ret); |
@@ -659,22 +681,6 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
659 | isert_dbg("Using initiator_depth: %u\n", isert_conn->initiator_depth); | 681 | isert_dbg("Using initiator_depth: %u\n", isert_conn->initiator_depth); |
660 | 682 | ||
661 | isert_conn->conn_device = device; | 683 | isert_conn->conn_device = device; |
662 | isert_conn->conn_pd = ib_alloc_pd(isert_conn->conn_device->ib_device); | ||
663 | if (IS_ERR(isert_conn->conn_pd)) { | ||
664 | ret = PTR_ERR(isert_conn->conn_pd); | ||
665 | isert_err("ib_alloc_pd failed for conn %p: ret=%d\n", | ||
666 | isert_conn, ret); | ||
667 | goto out_pd; | ||
668 | } | ||
669 | |||
670 | isert_conn->conn_mr = ib_get_dma_mr(isert_conn->conn_pd, | ||
671 | IB_ACCESS_LOCAL_WRITE); | ||
672 | if (IS_ERR(isert_conn->conn_mr)) { | ||
673 | ret = PTR_ERR(isert_conn->conn_mr); | ||
674 | isert_err("ib_get_dma_mr failed for conn %p: ret=%d\n", | ||
675 | isert_conn, ret); | ||
676 | goto out_mr; | ||
677 | } | ||
678 | 684 | ||
679 | ret = isert_conn_setup_qp(isert_conn, cma_id); | 685 | ret = isert_conn_setup_qp(isert_conn, cma_id); |
680 | if (ret) | 686 | if (ret) |
@@ -697,10 +703,6 @@ isert_connect_request(struct rdma_cm_id *cma_id, struct rdma_cm_event *event) | |||
697 | return 0; | 703 | return 0; |
698 | 704 | ||
699 | out_conn_dev: | 705 | out_conn_dev: |
700 | ib_dereg_mr(isert_conn->conn_mr); | ||
701 | out_mr: | ||
702 | ib_dealloc_pd(isert_conn->conn_pd); | ||
703 | out_pd: | ||
704 | isert_device_try_release(device); | 706 | isert_device_try_release(device); |
705 | out_rsp_dma_map: | 707 | out_rsp_dma_map: |
706 | ib_dma_unmap_single(ib_dev, isert_conn->login_rsp_dma, | 708 | ib_dma_unmap_single(ib_dev, isert_conn->login_rsp_dma, |
@@ -742,9 +744,6 @@ isert_connect_release(struct isert_conn *isert_conn) | |||
742 | ib_destroy_qp(isert_conn->conn_qp); | 744 | ib_destroy_qp(isert_conn->conn_qp); |
743 | } | 745 | } |
744 | 746 | ||
745 | ib_dereg_mr(isert_conn->conn_mr); | ||
746 | ib_dealloc_pd(isert_conn->conn_pd); | ||
747 | |||
748 | if (isert_conn->login_buf) { | 747 | if (isert_conn->login_buf) { |
749 | ib_dma_unmap_single(ib_dev, isert_conn->login_rsp_dma, | 748 | ib_dma_unmap_single(ib_dev, isert_conn->login_rsp_dma, |
750 | ISER_RX_LOGIN_SIZE, DMA_TO_DEVICE); | 749 | ISER_RX_LOGIN_SIZE, DMA_TO_DEVICE); |
@@ -988,7 +987,8 @@ isert_create_send_desc(struct isert_conn *isert_conn, | |||
988 | struct isert_cmd *isert_cmd, | 987 | struct isert_cmd *isert_cmd, |
989 | struct iser_tx_desc *tx_desc) | 988 | struct iser_tx_desc *tx_desc) |
990 | { | 989 | { |
991 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 990 | struct isert_device *device = isert_conn->conn_device; |
991 | struct ib_device *ib_dev = device->ib_device; | ||
992 | 992 | ||
993 | ib_dma_sync_single_for_cpu(ib_dev, tx_desc->dma_addr, | 993 | ib_dma_sync_single_for_cpu(ib_dev, tx_desc->dma_addr, |
994 | ISER_HEADERS_LEN, DMA_TO_DEVICE); | 994 | ISER_HEADERS_LEN, DMA_TO_DEVICE); |
@@ -999,8 +999,8 @@ isert_create_send_desc(struct isert_conn *isert_conn, | |||
999 | tx_desc->num_sge = 1; | 999 | tx_desc->num_sge = 1; |
1000 | tx_desc->isert_cmd = isert_cmd; | 1000 | tx_desc->isert_cmd = isert_cmd; |
1001 | 1001 | ||
1002 | if (tx_desc->tx_sg[0].lkey != isert_conn->conn_mr->lkey) { | 1002 | if (tx_desc->tx_sg[0].lkey != device->mr->lkey) { |
1003 | tx_desc->tx_sg[0].lkey = isert_conn->conn_mr->lkey; | 1003 | tx_desc->tx_sg[0].lkey = device->mr->lkey; |
1004 | isert_dbg("tx_desc %p lkey mismatch, fixing\n", tx_desc); | 1004 | isert_dbg("tx_desc %p lkey mismatch, fixing\n", tx_desc); |
1005 | } | 1005 | } |
1006 | } | 1006 | } |
@@ -1009,7 +1009,8 @@ static int | |||
1009 | isert_init_tx_hdrs(struct isert_conn *isert_conn, | 1009 | isert_init_tx_hdrs(struct isert_conn *isert_conn, |
1010 | struct iser_tx_desc *tx_desc) | 1010 | struct iser_tx_desc *tx_desc) |
1011 | { | 1011 | { |
1012 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 1012 | struct isert_device *device = isert_conn->conn_device; |
1013 | struct ib_device *ib_dev = device->ib_device; | ||
1013 | u64 dma_addr; | 1014 | u64 dma_addr; |
1014 | 1015 | ||
1015 | dma_addr = ib_dma_map_single(ib_dev, (void *)tx_desc, | 1016 | dma_addr = ib_dma_map_single(ib_dev, (void *)tx_desc, |
@@ -1022,7 +1023,7 @@ isert_init_tx_hdrs(struct isert_conn *isert_conn, | |||
1022 | tx_desc->dma_addr = dma_addr; | 1023 | tx_desc->dma_addr = dma_addr; |
1023 | tx_desc->tx_sg[0].addr = tx_desc->dma_addr; | 1024 | tx_desc->tx_sg[0].addr = tx_desc->dma_addr; |
1024 | tx_desc->tx_sg[0].length = ISER_HEADERS_LEN; | 1025 | tx_desc->tx_sg[0].length = ISER_HEADERS_LEN; |
1025 | tx_desc->tx_sg[0].lkey = isert_conn->conn_mr->lkey; | 1026 | tx_desc->tx_sg[0].lkey = device->mr->lkey; |
1026 | 1027 | ||
1027 | isert_dbg("Setup tx_sg[0].addr: 0x%llx length: %u lkey: 0x%x\n", | 1028 | isert_dbg("Setup tx_sg[0].addr: 0x%llx length: %u lkey: 0x%x\n", |
1028 | tx_desc->tx_sg[0].addr, tx_desc->tx_sg[0].length, | 1029 | tx_desc->tx_sg[0].addr, tx_desc->tx_sg[0].length, |
@@ -1055,7 +1056,7 @@ isert_rdma_post_recvl(struct isert_conn *isert_conn) | |||
1055 | memset(&sge, 0, sizeof(struct ib_sge)); | 1056 | memset(&sge, 0, sizeof(struct ib_sge)); |
1056 | sge.addr = isert_conn->login_req_dma; | 1057 | sge.addr = isert_conn->login_req_dma; |
1057 | sge.length = ISER_RX_LOGIN_SIZE; | 1058 | sge.length = ISER_RX_LOGIN_SIZE; |
1058 | sge.lkey = isert_conn->conn_mr->lkey; | 1059 | sge.lkey = isert_conn->conn_device->mr->lkey; |
1059 | 1060 | ||
1060 | isert_dbg("Setup sge: addr: %llx length: %d 0x%08x\n", | 1061 | isert_dbg("Setup sge: addr: %llx length: %d 0x%08x\n", |
1061 | sge.addr, sge.length, sge.lkey); | 1062 | sge.addr, sge.length, sge.lkey); |
@@ -1080,7 +1081,8 @@ isert_put_login_tx(struct iscsi_conn *conn, struct iscsi_login *login, | |||
1080 | u32 length) | 1081 | u32 length) |
1081 | { | 1082 | { |
1082 | struct isert_conn *isert_conn = conn->context; | 1083 | struct isert_conn *isert_conn = conn->context; |
1083 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 1084 | struct isert_device *device = isert_conn->conn_device; |
1085 | struct ib_device *ib_dev = device->ib_device; | ||
1084 | struct iser_tx_desc *tx_desc = &isert_conn->conn_login_tx_desc; | 1086 | struct iser_tx_desc *tx_desc = &isert_conn->conn_login_tx_desc; |
1085 | int ret; | 1087 | int ret; |
1086 | 1088 | ||
@@ -1104,7 +1106,7 @@ isert_put_login_tx(struct iscsi_conn *conn, struct iscsi_login *login, | |||
1104 | 1106 | ||
1105 | tx_dsg->addr = isert_conn->login_rsp_dma; | 1107 | tx_dsg->addr = isert_conn->login_rsp_dma; |
1106 | tx_dsg->length = length; | 1108 | tx_dsg->length = length; |
1107 | tx_dsg->lkey = isert_conn->conn_mr->lkey; | 1109 | tx_dsg->lkey = isert_conn->conn_device->mr->lkey; |
1108 | tx_desc->num_sge = 2; | 1110 | tx_desc->num_sge = 2; |
1109 | } | 1111 | } |
1110 | if (!login->login_failed) { | 1112 | if (!login->login_failed) { |
@@ -2103,7 +2105,8 @@ isert_put_response(struct iscsi_conn *conn, struct iscsi_cmd *cmd) | |||
2103 | if (cmd->se_cmd.sense_buffer && | 2105 | if (cmd->se_cmd.sense_buffer && |
2104 | ((cmd->se_cmd.se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) || | 2106 | ((cmd->se_cmd.se_cmd_flags & SCF_TRANSPORT_TASK_SENSE) || |
2105 | (cmd->se_cmd.se_cmd_flags & SCF_EMULATED_TASK_SENSE))) { | 2107 | (cmd->se_cmd.se_cmd_flags & SCF_EMULATED_TASK_SENSE))) { |
2106 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 2108 | struct isert_device *device = isert_conn->conn_device; |
2109 | struct ib_device *ib_dev = device->ib_device; | ||
2107 | struct ib_sge *tx_dsg = &isert_cmd->tx_desc.tx_sg[1]; | 2110 | struct ib_sge *tx_dsg = &isert_cmd->tx_desc.tx_sg[1]; |
2108 | u32 padding, pdu_len; | 2111 | u32 padding, pdu_len; |
2109 | 2112 | ||
@@ -2122,7 +2125,7 @@ isert_put_response(struct iscsi_conn *conn, struct iscsi_cmd *cmd) | |||
2122 | isert_cmd->pdu_buf_len = pdu_len; | 2125 | isert_cmd->pdu_buf_len = pdu_len; |
2123 | tx_dsg->addr = isert_cmd->pdu_buf_dma; | 2126 | tx_dsg->addr = isert_cmd->pdu_buf_dma; |
2124 | tx_dsg->length = pdu_len; | 2127 | tx_dsg->length = pdu_len; |
2125 | tx_dsg->lkey = isert_conn->conn_mr->lkey; | 2128 | tx_dsg->lkey = device->mr->lkey; |
2126 | isert_cmd->tx_desc.num_sge = 2; | 2129 | isert_cmd->tx_desc.num_sge = 2; |
2127 | } | 2130 | } |
2128 | 2131 | ||
@@ -2233,7 +2236,8 @@ isert_put_reject(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
2233 | struct isert_cmd *isert_cmd = iscsit_priv_cmd(cmd); | 2236 | struct isert_cmd *isert_cmd = iscsit_priv_cmd(cmd); |
2234 | struct isert_conn *isert_conn = (struct isert_conn *)conn->context; | 2237 | struct isert_conn *isert_conn = (struct isert_conn *)conn->context; |
2235 | struct ib_send_wr *send_wr = &isert_cmd->tx_desc.send_wr; | 2238 | struct ib_send_wr *send_wr = &isert_cmd->tx_desc.send_wr; |
2236 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 2239 | struct isert_device *device = isert_conn->conn_device; |
2240 | struct ib_device *ib_dev = device->ib_device; | ||
2237 | struct ib_sge *tx_dsg = &isert_cmd->tx_desc.tx_sg[1]; | 2241 | struct ib_sge *tx_dsg = &isert_cmd->tx_desc.tx_sg[1]; |
2238 | struct iscsi_reject *hdr = | 2242 | struct iscsi_reject *hdr = |
2239 | (struct iscsi_reject *)&isert_cmd->tx_desc.iscsi_header; | 2243 | (struct iscsi_reject *)&isert_cmd->tx_desc.iscsi_header; |
@@ -2249,7 +2253,7 @@ isert_put_reject(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
2249 | isert_cmd->pdu_buf_len = ISCSI_HDR_LEN; | 2253 | isert_cmd->pdu_buf_len = ISCSI_HDR_LEN; |
2250 | tx_dsg->addr = isert_cmd->pdu_buf_dma; | 2254 | tx_dsg->addr = isert_cmd->pdu_buf_dma; |
2251 | tx_dsg->length = ISCSI_HDR_LEN; | 2255 | tx_dsg->length = ISCSI_HDR_LEN; |
2252 | tx_dsg->lkey = isert_conn->conn_mr->lkey; | 2256 | tx_dsg->lkey = device->mr->lkey; |
2253 | isert_cmd->tx_desc.num_sge = 2; | 2257 | isert_cmd->tx_desc.num_sge = 2; |
2254 | 2258 | ||
2255 | isert_init_send_wr(isert_conn, isert_cmd, send_wr); | 2259 | isert_init_send_wr(isert_conn, isert_cmd, send_wr); |
@@ -2279,7 +2283,8 @@ isert_put_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
2279 | isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); | 2283 | isert_init_tx_hdrs(isert_conn, &isert_cmd->tx_desc); |
2280 | 2284 | ||
2281 | if (txt_rsp_len) { | 2285 | if (txt_rsp_len) { |
2282 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 2286 | struct isert_device *device = isert_conn->conn_device; |
2287 | struct ib_device *ib_dev = device->ib_device; | ||
2283 | struct ib_sge *tx_dsg = &isert_cmd->tx_desc.tx_sg[1]; | 2288 | struct ib_sge *tx_dsg = &isert_cmd->tx_desc.tx_sg[1]; |
2284 | void *txt_rsp_buf = cmd->buf_ptr; | 2289 | void *txt_rsp_buf = cmd->buf_ptr; |
2285 | 2290 | ||
@@ -2289,7 +2294,7 @@ isert_put_text_rsp(struct iscsi_cmd *cmd, struct iscsi_conn *conn) | |||
2289 | isert_cmd->pdu_buf_len = txt_rsp_len; | 2294 | isert_cmd->pdu_buf_len = txt_rsp_len; |
2290 | tx_dsg->addr = isert_cmd->pdu_buf_dma; | 2295 | tx_dsg->addr = isert_cmd->pdu_buf_dma; |
2291 | tx_dsg->length = txt_rsp_len; | 2296 | tx_dsg->length = txt_rsp_len; |
2292 | tx_dsg->lkey = isert_conn->conn_mr->lkey; | 2297 | tx_dsg->lkey = device->mr->lkey; |
2293 | isert_cmd->tx_desc.num_sge = 2; | 2298 | isert_cmd->tx_desc.num_sge = 2; |
2294 | } | 2299 | } |
2295 | isert_init_send_wr(isert_conn, isert_cmd, send_wr); | 2300 | isert_init_send_wr(isert_conn, isert_cmd, send_wr); |
@@ -2306,7 +2311,8 @@ isert_build_rdma_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd, | |||
2306 | { | 2311 | { |
2307 | struct iscsi_cmd *cmd = isert_cmd->iscsi_cmd; | 2312 | struct iscsi_cmd *cmd = isert_cmd->iscsi_cmd; |
2308 | struct scatterlist *sg_start, *tmp_sg; | 2313 | struct scatterlist *sg_start, *tmp_sg; |
2309 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 2314 | struct isert_device *device = isert_conn->conn_device; |
2315 | struct ib_device *ib_dev = device->ib_device; | ||
2310 | u32 sg_off, page_off; | 2316 | u32 sg_off, page_off; |
2311 | int i = 0, sg_nents; | 2317 | int i = 0, sg_nents; |
2312 | 2318 | ||
@@ -2330,7 +2336,7 @@ isert_build_rdma_wr(struct isert_conn *isert_conn, struct isert_cmd *isert_cmd, | |||
2330 | ib_sge->addr = ib_sg_dma_address(ib_dev, tmp_sg) + page_off; | 2336 | ib_sge->addr = ib_sg_dma_address(ib_dev, tmp_sg) + page_off; |
2331 | ib_sge->length = min_t(u32, data_left, | 2337 | ib_sge->length = min_t(u32, data_left, |
2332 | ib_sg_dma_len(ib_dev, tmp_sg) - page_off); | 2338 | ib_sg_dma_len(ib_dev, tmp_sg) - page_off); |
2333 | ib_sge->lkey = isert_conn->conn_mr->lkey; | 2339 | ib_sge->lkey = device->mr->lkey; |
2334 | 2340 | ||
2335 | isert_dbg("RDMA ib_sge: addr: 0x%llx length: %u lkey: %x\n", | 2341 | isert_dbg("RDMA ib_sge: addr: 0x%llx length: %u lkey: %x\n", |
2336 | ib_sge->addr, ib_sge->length, ib_sge->lkey); | 2342 | ib_sge->addr, ib_sge->length, ib_sge->lkey); |
@@ -2491,7 +2497,8 @@ isert_fast_reg_mr(struct isert_conn *isert_conn, | |||
2491 | enum isert_indicator ind, | 2497 | enum isert_indicator ind, |
2492 | struct ib_sge *sge) | 2498 | struct ib_sge *sge) |
2493 | { | 2499 | { |
2494 | struct ib_device *ib_dev = isert_conn->conn_cm_id->device; | 2500 | struct isert_device *device = isert_conn->conn_device; |
2501 | struct ib_device *ib_dev = device->ib_device; | ||
2495 | struct ib_mr *mr; | 2502 | struct ib_mr *mr; |
2496 | struct ib_fast_reg_page_list *frpl; | 2503 | struct ib_fast_reg_page_list *frpl; |
2497 | struct ib_send_wr fr_wr, inv_wr; | 2504 | struct ib_send_wr fr_wr, inv_wr; |
@@ -2500,7 +2507,7 @@ isert_fast_reg_mr(struct isert_conn *isert_conn, | |||
2500 | u32 page_off; | 2507 | u32 page_off; |
2501 | 2508 | ||
2502 | if (mem->dma_nents == 1) { | 2509 | if (mem->dma_nents == 1) { |
2503 | sge->lkey = isert_conn->conn_mr->lkey; | 2510 | sge->lkey = device->mr->lkey; |
2504 | sge->addr = ib_sg_dma_address(ib_dev, &mem->sg[0]); | 2511 | sge->addr = ib_sg_dma_address(ib_dev, &mem->sg[0]); |
2505 | sge->length = ib_sg_dma_len(ib_dev, &mem->sg[0]); | 2512 | sge->length = ib_sg_dma_len(ib_dev, &mem->sg[0]); |
2506 | isert_dbg("sge: addr: 0x%llx length: %u lkey: %x\n", | 2513 | isert_dbg("sge: addr: 0x%llx length: %u lkey: %x\n", |
@@ -2698,7 +2705,7 @@ isert_handle_prot_cmd(struct isert_conn *isert_conn, | |||
2698 | if (!wr->fr_desc->pi_ctx) { | 2705 | if (!wr->fr_desc->pi_ctx) { |
2699 | ret = isert_create_pi_ctx(wr->fr_desc, | 2706 | ret = isert_create_pi_ctx(wr->fr_desc, |
2700 | device->ib_device, | 2707 | device->ib_device, |
2701 | isert_conn->conn_pd); | 2708 | device->pd); |
2702 | if (ret) { | 2709 | if (ret) { |
2703 | isert_err("conn %p failed to allocate pi_ctx\n", | 2710 | isert_err("conn %p failed to allocate pi_ctx\n", |
2704 | isert_conn); | 2711 | isert_conn); |
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h index 8dc8415d152d..e386092a3274 100644 --- a/drivers/infiniband/ulp/isert/ib_isert.h +++ b/drivers/infiniband/ulp/isert/ib_isert.h | |||
@@ -169,8 +169,6 @@ struct isert_conn { | |||
169 | struct completion login_req_comp; | 169 | struct completion login_req_comp; |
170 | struct iser_tx_desc conn_login_tx_desc; | 170 | struct iser_tx_desc conn_login_tx_desc; |
171 | struct rdma_cm_id *conn_cm_id; | 171 | struct rdma_cm_id *conn_cm_id; |
172 | struct ib_pd *conn_pd; | ||
173 | struct ib_mr *conn_mr; | ||
174 | struct ib_qp *conn_qp; | 172 | struct ib_qp *conn_qp; |
175 | struct isert_device *conn_device; | 173 | struct isert_device *conn_device; |
176 | struct mutex conn_mutex; | 174 | struct mutex conn_mutex; |
@@ -211,6 +209,8 @@ struct isert_device { | |||
211 | bool pi_capable; | 209 | bool pi_capable; |
212 | int refcount; | 210 | int refcount; |
213 | struct ib_device *ib_device; | 211 | struct ib_device *ib_device; |
212 | struct ib_pd *pd; | ||
213 | struct ib_mr *mr; | ||
214 | struct isert_comp *comps; | 214 | struct isert_comp *comps; |
215 | int comps_used; | 215 | int comps_used; |
216 | struct list_head dev_node; | 216 | struct list_head dev_node; |