Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Sagi Grimberg and committed by
Nicholas Bellinger
572a1434 f55532a0

+4 -37
+4 -35
drivers/infiniband/ulp/isert/ib_isert.c
··· 63 63 struct rdma_cm_id *isert_setup_id(struct isert_np *isert_np); 64 64 65 65 static void isert_release_work(struct work_struct *work); 66 - static void isert_wait4flush(struct isert_conn *isert_conn); 67 66 static void isert_recv_done(struct ib_cq *cq, struct ib_wc *wc); 68 67 static void isert_send_done(struct ib_cq *cq, struct ib_wc *wc); 69 68 static void isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc); ··· 140 141 attr.qp_context = isert_conn; 141 142 attr.send_cq = comp->cq; 142 143 attr.recv_cq = comp->cq; 143 - attr.cap.max_send_wr = ISERT_QP_MAX_REQ_DTOS; 144 + attr.cap.max_send_wr = ISERT_QP_MAX_REQ_DTOS + 1; 144 145 attr.cap.max_recv_wr = ISERT_QP_MAX_RECV_DTOS + 1; 145 146 attr.cap.max_send_sge = device->ib_device->attrs.max_sge; 146 147 isert_conn->max_sge = min(device->ib_device->attrs.max_sge, ··· 886 887 break; 887 888 case ISER_CONN_UP: 888 889 isert_conn_terminate(isert_conn); 889 - isert_wait4flush(isert_conn); 890 + ib_drain_qp(isert_conn->qp); 890 891 isert_handle_unbound_conn(isert_conn); 891 892 break; 892 893 case ISER_CONN_BOUND: ··· 3212 3213 } 3213 3214 } 3214 3215 3215 - static void 3216 - isert_beacon_done(struct ib_cq *cq, struct ib_wc *wc) 3217 - { 3218 - struct isert_conn *isert_conn = wc->qp->qp_context; 3219 - 3220 - isert_print_wc(wc, "beacon"); 3221 - 3222 - isert_info("conn %p completing wait_comp_err\n", isert_conn); 3223 - complete(&isert_conn->wait_comp_err); 3224 - } 3225 - 3226 - static void 3227 - isert_wait4flush(struct isert_conn *isert_conn) 3228 - { 3229 - struct ib_recv_wr *bad_wr; 3230 - static struct ib_cqe cqe = { .done = isert_beacon_done }; 3231 - 3232 - isert_info("conn %p\n", isert_conn); 3233 - 3234 - init_completion(&isert_conn->wait_comp_err); 3235 - isert_conn->beacon.wr_cqe = &cqe; 3236 - /* post an indication that all flush errors were consumed */ 3237 - if (ib_post_recv(isert_conn->qp, &isert_conn->beacon, &bad_wr)) { 3238 - isert_err("conn %p failed to post beacon", isert_conn); 3239 - return; 3240 - } 3241 - 3242 - wait_for_completion(&isert_conn->wait_comp_err); 3243 - } 3244 - 3245 3216 /** 3246 3217 * isert_put_unsol_pending_cmds() - Drop commands waiting for 3247 3218 * unsolicitate dataout ··· 3257 3288 isert_conn_terminate(isert_conn); 3258 3289 mutex_unlock(&isert_conn->mutex); 3259 3290 3260 - isert_wait4flush(isert_conn); 3291 + ib_drain_qp(isert_conn->qp); 3261 3292 isert_put_unsol_pending_cmds(conn); 3262 3293 isert_wait4cmds(conn); 3263 3294 isert_wait4logout(isert_conn); ··· 3269 3300 { 3270 3301 struct isert_conn *isert_conn = conn->context; 3271 3302 3272 - isert_wait4flush(isert_conn); 3303 + ib_drain_qp(isert_conn->qp); 3273 3304 isert_put_conn(isert_conn); 3274 3305 } 3275 3306
-2
drivers/infiniband/ulp/isert/ib_isert.h
··· 209 209 struct ib_qp *qp; 210 210 struct isert_device *device; 211 211 struct mutex mutex; 212 - struct completion wait_comp_err; 213 212 struct kref kref; 214 213 struct list_head fr_pool; 215 214 int fr_pool_size; 216 215 /* lock to protect fastreg pool */ 217 216 spinlock_t pool_lock; 218 217 struct work_struct release_work; 219 - struct ib_recv_wr beacon; 220 218 bool logout_posted; 221 219 bool snd_w_inv; 222 220 };