Commit db523b8d authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Roland Dreier

IB/iser: Suppress completions for fast registration work requests

In case iSER uses fast registration method, it should not request for
successful completions on fast registration nor local invalidate
requests.  We color wr_id with ISER_FRWR_LI_WRID in order to correctly
consume error completions.
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent cfbf8d48
...@@ -138,6 +138,8 @@ ...@@ -138,6 +138,8 @@
#define ISER_WSV 0x08 #define ISER_WSV 0x08
#define ISER_RSV 0x04 #define ISER_RSV 0x04
#define ISER_FRWR_LI_WRID 0xffffffffffffffffULL
struct iser_hdr { struct iser_hdr {
u8 flags; u8 flags;
u8 rsvd[3]; u8 rsvd[3];
......
...@@ -457,8 +457,8 @@ static int iser_fast_reg_mr(struct fast_reg_descriptor *desc, ...@@ -457,8 +457,8 @@ static int iser_fast_reg_mr(struct fast_reg_descriptor *desc,
if (!desc->valid) { if (!desc->valid) {
memset(&inv_wr, 0, sizeof(inv_wr)); memset(&inv_wr, 0, sizeof(inv_wr));
inv_wr.wr_id = ISER_FRWR_LI_WRID;
inv_wr.opcode = IB_WR_LOCAL_INV; inv_wr.opcode = IB_WR_LOCAL_INV;
inv_wr.send_flags = IB_SEND_SIGNALED;
inv_wr.ex.invalidate_rkey = desc->data_mr->rkey; inv_wr.ex.invalidate_rkey = desc->data_mr->rkey;
wr = &inv_wr; wr = &inv_wr;
/* Bump the key */ /* Bump the key */
...@@ -468,8 +468,8 @@ static int iser_fast_reg_mr(struct fast_reg_descriptor *desc, ...@@ -468,8 +468,8 @@ static int iser_fast_reg_mr(struct fast_reg_descriptor *desc,
/* Prepare FASTREG WR */ /* Prepare FASTREG WR */
memset(&fastreg_wr, 0, sizeof(fastreg_wr)); memset(&fastreg_wr, 0, sizeof(fastreg_wr));
fastreg_wr.wr_id = ISER_FRWR_LI_WRID;
fastreg_wr.opcode = IB_WR_FAST_REG_MR; fastreg_wr.opcode = IB_WR_FAST_REG_MR;
fastreg_wr.send_flags = IB_SEND_SIGNALED;
fastreg_wr.wr.fast_reg.iova_start = desc->data_frpl->page_list[0] + offset; fastreg_wr.wr.fast_reg.iova_start = desc->data_frpl->page_list[0] + offset;
fastreg_wr.wr.fast_reg.page_list = desc->data_frpl; fastreg_wr.wr.fast_reg.page_list = desc->data_frpl;
fastreg_wr.wr.fast_reg.page_list_len = page_list_len; fastreg_wr.wr.fast_reg.page_list_len = page_list_len;
...@@ -480,20 +480,13 @@ static int iser_fast_reg_mr(struct fast_reg_descriptor *desc, ...@@ -480,20 +480,13 @@ static int iser_fast_reg_mr(struct fast_reg_descriptor *desc,
IB_ACCESS_REMOTE_WRITE | IB_ACCESS_REMOTE_WRITE |
IB_ACCESS_REMOTE_READ); IB_ACCESS_REMOTE_READ);
if (!wr) { if (!wr)
wr = &fastreg_wr; wr = &fastreg_wr;
atomic_inc(&ib_conn->post_send_buf_count); else
} else {
wr->next = &fastreg_wr; wr->next = &fastreg_wr;
atomic_add(2, &ib_conn->post_send_buf_count);
}
ret = ib_post_send(ib_conn->qp, wr, &bad_wr); ret = ib_post_send(ib_conn->qp, wr, &bad_wr);
if (ret) { if (ret) {
if (bad_wr->next)
atomic_sub(2, &ib_conn->post_send_buf_count);
else
atomic_dec(&ib_conn->post_send_buf_count);
iser_err("fast registration failed, ret:%d\n", ret); iser_err("fast registration failed, ret:%d\n", ret);
return ret; return ret;
} }
......
...@@ -993,18 +993,16 @@ static int iser_drain_tx_cq(struct iser_device *device, int cq_index) ...@@ -993,18 +993,16 @@ static int iser_drain_tx_cq(struct iser_device *device, int cq_index)
if (wc.status == IB_WC_SUCCESS) { if (wc.status == IB_WC_SUCCESS) {
if (wc.opcode == IB_WC_SEND) if (wc.opcode == IB_WC_SEND)
iser_snd_completion(tx_desc, ib_conn); iser_snd_completion(tx_desc, ib_conn);
else if (wc.opcode == IB_WC_LOCAL_INV || else
wc.opcode == IB_WC_FAST_REG_MR) {
atomic_dec(&ib_conn->post_send_buf_count);
continue;
} else
iser_err("expected opcode %d got %d\n", iser_err("expected opcode %d got %d\n",
IB_WC_SEND, wc.opcode); IB_WC_SEND, wc.opcode);
} else { } else {
iser_err("tx id %llx status %d vend_err %x\n", iser_err("tx id %llx status %d vend_err %x\n",
wc.wr_id, wc.status, wc.vendor_err); wc.wr_id, wc.status, wc.vendor_err);
atomic_dec(&ib_conn->post_send_buf_count); if (wc.wr_id != ISER_FRWR_LI_WRID) {
iser_handle_comp_error(tx_desc, ib_conn); atomic_dec(&ib_conn->post_send_buf_count);
iser_handle_comp_error(tx_desc, ib_conn);
}
} }
completed_tx++; completed_tx++;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment