aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSagi Grimberg <sagig@mellanox.com>2016-02-24 12:24:09 -0500
committerNicholas Bellinger <nab@linux-iscsi.org>2016-03-30 23:05:15 -0400
commit572a143489a10360ce2aca98c64f8be43c8400a6 (patch)
treee1106b7bda902232b4bd68e1e24357c0e095f5f5
parentf55532a0c0b8bb6148f4e07853b876ef73bc69ca (diff)
iser-target: Use ib_drain_qp
Now the rdma core offers a QP draining service in v4.6-rc1, use it instead of our own. Signed-off-by: Sagi Grimberg <sagig@mellanox.com> Reported-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
-rw-r--r--drivers/infiniband/ulp/isert/ib_isert.c39
-rw-r--r--drivers/infiniband/ulp/isert/ib_isert.h2
2 files changed, 4 insertions, 37 deletions
diff --git a/drivers/infiniband/ulp/isert/ib_isert.c b/drivers/infiniband/ulp/isert/ib_isert.c
index 60b30d338a81..411e4464ca23 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.c
+++ b/drivers/infiniband/ulp/isert/ib_isert.c
@@ -63,7 +63,6 @@ isert_rdma_accept(struct isert_conn *isert_conn);
63struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np); 63struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np);
64 64
65static void isert_release_work(struct work_struct *work); 65static void isert_release_work(struct work_struct *work);
66static void isert_wait4flush(struct isert_conn *isert_conn);
67static void isert_recv_done(struct ib_cq *cq, struct ib_wc *wc); 66static void isert_recv_done(struct ib_cq *cq, struct ib_wc *wc);
68static void isert_send_done(struct ib_cq *cq, struct ib_wc *wc); 67static void isert_send_done(struct ib_cq *cq, struct ib_wc *wc);
69static void isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc); 68static void isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc);
@@ -141,7 +140,7 @@ isert_create_qp(struct isert_conn *isert_conn,
141 attr.qp_context = isert_conn; 140 attr.qp_context = isert_conn;
142 attr.send_cq = comp->cq; 141 attr.send_cq = comp->cq;
143 attr.recv_cq = comp->cq; 142 attr.recv_cq = comp->cq;
144 attr.cap.max_send_wr = ISERT_QP_MAX_REQ_DTOS; 143 attr.cap.max_send_wr = ISERT_QP_MAX_REQ_DTOS + 1;
145 attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS + 1; 144 attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS + 1;
146 attr.cap.max_send_sge = device->ib_device->attrs.max_sge; 145 attr.cap.max_send_sge = device->ib_device->attrs.max_sge;
147 isert_conn->max_sge = min(device->ib_device->attrs.max_sge, 146 isert_conn->max_sge = min(device->ib_device->attrs.max_sge,
@@ -887,7 +886,7 @@ isert_disconnected_handler(struct rdma_cm_id *cma_id,
887 break; 886 break;
888 case ISER_CONN_UP: 887 case ISER_CONN_UP:
889 isert_conn_terminate(isert_conn); 888 isert_conn_terminate(isert_conn);
890 isert_wait4flush(isert_conn); 889 ib_drain_qp(isert_conn->qp);
891 isert_handle_unbound_conn(isert_conn); 890 isert_handle_unbound_conn(isert_conn);
892 break; 891 break;
893 case ISER_CONN_BOUND: 892 case ISER_CONN_BOUND:
@@ -3213,36 +3212,6 @@ isert_wait4cmds(struct iscsi_conn *conn)
3213 } 3212 }
3214} 3213}
3215 3214
3216static void
3217isert_beacon_done(struct ib_cq *cq, struct ib_wc *wc)
3218{
3219 struct isert_conn *isert_conn = wc->qp->qp_context;
3220
3221 isert_print_wc(wc, "beacon");
3222
3223 isert_info("conn %p completing wait_comp_err\n", isert_conn);
3224 complete(&isert_conn->wait_comp_err);
3225}
3226
3227static void
3228isert_wait4flush(struct isert_conn *isert_conn)
3229{
3230 struct ib_recv_wr *bad_wr;
3231 static struct ib_cqe cqe = { .done = isert_beacon_done };
3232
3233 isert_info("conn %p\n", isert_conn);
3234
3235 init_completion(&isert_conn->wait_comp_err);
3236 isert_conn->beacon.wr_cqe = &cqe;
3237 /* post an indication that all flush errors were consumed */
3238 if (ib_post_recv(isert_conn->qp, &isert_conn->beacon, &bad_wr)) {
3239 isert_err("conn %p failed to post beacon", isert_conn);
3240 return;
3241 }
3242
3243 wait_for_completion(&isert_conn->wait_comp_err);
3244}
3245
3246/** 3215/**
3247 * isert_put_unsol_pending_cmds() - Drop commands waiting for 3216 * isert_put_unsol_pending_cmds() - Drop commands waiting for
3248 * unsolicitate dataout 3217 * unsolicitate dataout
@@ -3288,7 +3257,7 @@ static void isert_wait_conn(struct iscsi_conn *conn)
3288 isert_conn_terminate(isert_conn); 3257 isert_conn_terminate(isert_conn);
3289 mutex_unlock(&isert_conn->mutex); 3258 mutex_unlock(&isert_conn->mutex);
3290 3259
3291 isert_wait4flush(isert_conn); 3260 ib_drain_qp(isert_conn->qp);
3292 isert_put_unsol_pending_cmds(conn); 3261 isert_put_unsol_pending_cmds(conn);
3293 isert_wait4cmds(conn); 3262 isert_wait4cmds(conn);
3294 isert_wait4logout(isert_conn); 3263 isert_wait4logout(isert_conn);
@@ -3300,7 +3269,7 @@ static void isert_free_conn(struct iscsi_conn *conn)
3300{ 3269{
3301 struct isert_conn *isert_conn = conn->context; 3270 struct isert_conn *isert_conn = conn->context;
3302 3271
3303 isert_wait4flush(isert_conn); 3272 ib_drain_qp(isert_conn->qp);
3304 isert_put_conn(isert_conn); 3273 isert_put_conn(isert_conn);
3305} 3274}
3306 3275
diff --git a/drivers/infiniband/ulp/isert/ib_isert.h b/drivers/infiniband/ulp/isert/ib_isert.h
index 192788a4820c..147900cbb578 100644
--- a/drivers/infiniband/ulp/isert/ib_isert.h
+++ b/drivers/infiniband/ulp/isert/ib_isert.h
@@ -209,14 +209,12 @@ struct isert_conn {
209 struct ib_qp *qp; 209 struct ib_qp *qp;
210 struct isert_device *device; 210 struct isert_device *device;
211 struct mutex mutex; 211 struct mutex mutex;
212 struct completion wait_comp_err;
213 struct kref kref; 212 struct kref kref;
214 struct list_head fr_pool; 213 struct list_head fr_pool;
215 int fr_pool_size; 214 int fr_pool_size;
216 /* lock to protect fastreg pool */ 215 /* lock to protect fastreg pool */
217 spinlock_t pool_lock; 216 spinlock_t pool_lock;
218 struct work_struct release_work; 217 struct work_struct release_work;
219 struct ib_recv_wr beacon;
220 bool logout_posted; 218 bool logout_posted;
221 bool snd_w_inv; 219 bool snd_w_inv;
222}; 220};