Commit 9b32a596 authored by Bart Van Assche's avatar Bart Van Assche Committed by Jason Gunthorpe

IB/srpt: Simplify ib_post_(send|recv|srq_recv)() calls

Instead of declaring and passing a dummy 'bad_wr' pointer, pass NULL
as third argument to ib_post_(send|recv|srq_recv)().
Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: default avatarMax Gurtovoy <maxg@mellanox.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 71347b0c
...@@ -816,7 +816,7 @@ static int srpt_post_recv(struct srpt_device *sdev, struct srpt_rdma_ch *ch, ...@@ -816,7 +816,7 @@ static int srpt_post_recv(struct srpt_device *sdev, struct srpt_rdma_ch *ch,
struct srpt_recv_ioctx *ioctx) struct srpt_recv_ioctx *ioctx)
{ {
struct ib_sge list; struct ib_sge list;
struct ib_recv_wr wr, *bad_wr; struct ib_recv_wr wr;
BUG_ON(!sdev); BUG_ON(!sdev);
list.addr = ioctx->ioctx.dma; list.addr = ioctx->ioctx.dma;
...@@ -830,9 +830,9 @@ static int srpt_post_recv(struct srpt_device *sdev, struct srpt_rdma_ch *ch, ...@@ -830,9 +830,9 @@ static int srpt_post_recv(struct srpt_device *sdev, struct srpt_rdma_ch *ch,
wr.num_sge = 1; wr.num_sge = 1;
if (sdev->use_srq) if (sdev->use_srq)
return ib_post_srq_recv(sdev->srq, &wr, &bad_wr); return ib_post_srq_recv(sdev->srq, &wr, NULL);
else else
return ib_post_recv(ch->qp, &wr, &bad_wr); return ib_post_recv(ch->qp, &wr, NULL);
} }
/** /**
...@@ -846,7 +846,6 @@ static int srpt_post_recv(struct srpt_device *sdev, struct srpt_rdma_ch *ch, ...@@ -846,7 +846,6 @@ static int srpt_post_recv(struct srpt_device *sdev, struct srpt_rdma_ch *ch,
*/ */
static int srpt_zerolength_write(struct srpt_rdma_ch *ch) static int srpt_zerolength_write(struct srpt_rdma_ch *ch)
{ {
struct ib_send_wr *bad_wr;
struct ib_rdma_wr wr = { struct ib_rdma_wr wr = {
.wr = { .wr = {
.next = NULL, .next = NULL,
...@@ -859,7 +858,7 @@ static int srpt_zerolength_write(struct srpt_rdma_ch *ch) ...@@ -859,7 +858,7 @@ static int srpt_zerolength_write(struct srpt_rdma_ch *ch)
pr_debug("%s-%d: queued zerolength write\n", ch->sess_name, pr_debug("%s-%d: queued zerolength write\n", ch->sess_name,
ch->qp->qp_num); ch->qp->qp_num);
return ib_post_send(ch->qp, &wr.wr, &bad_wr); return ib_post_send(ch->qp, &wr.wr, NULL);
} }
static void srpt_zerolength_write_done(struct ib_cq *cq, struct ib_wc *wc) static void srpt_zerolength_write_done(struct ib_cq *cq, struct ib_wc *wc)
...@@ -2624,7 +2623,7 @@ static int srpt_write_pending(struct se_cmd *se_cmd) ...@@ -2624,7 +2623,7 @@ static int srpt_write_pending(struct se_cmd *se_cmd)
struct srpt_send_ioctx *ioctx = struct srpt_send_ioctx *ioctx =
container_of(se_cmd, struct srpt_send_ioctx, cmd); container_of(se_cmd, struct srpt_send_ioctx, cmd);
struct srpt_rdma_ch *ch = ioctx->ch; struct srpt_rdma_ch *ch = ioctx->ch;
struct ib_send_wr *first_wr = NULL, *bad_wr; struct ib_send_wr *first_wr = NULL;
struct ib_cqe *cqe = &ioctx->rdma_cqe; struct ib_cqe *cqe = &ioctx->rdma_cqe;
enum srpt_command_state new_state; enum srpt_command_state new_state;
int ret, i; int ret, i;
...@@ -2648,7 +2647,7 @@ static int srpt_write_pending(struct se_cmd *se_cmd) ...@@ -2648,7 +2647,7 @@ static int srpt_write_pending(struct se_cmd *se_cmd)
cqe = NULL; cqe = NULL;
} }
ret = ib_post_send(ch->qp, first_wr, &bad_wr); ret = ib_post_send(ch->qp, first_wr, NULL);
if (ret) { if (ret) {
pr_err("%s: ib_post_send() returned %d for %d (avail: %d)\n", pr_err("%s: ib_post_send() returned %d for %d (avail: %d)\n",
__func__, ret, ioctx->n_rdma, __func__, ret, ioctx->n_rdma,
...@@ -2686,7 +2685,7 @@ static void srpt_queue_response(struct se_cmd *cmd) ...@@ -2686,7 +2685,7 @@ static void srpt_queue_response(struct se_cmd *cmd)
container_of(cmd, struct srpt_send_ioctx, cmd); container_of(cmd, struct srpt_send_ioctx, cmd);
struct srpt_rdma_ch *ch = ioctx->ch; struct srpt_rdma_ch *ch = ioctx->ch;
struct srpt_device *sdev = ch->sport->sdev; struct srpt_device *sdev = ch->sport->sdev;
struct ib_send_wr send_wr, *first_wr = &send_wr, *bad_wr; struct ib_send_wr send_wr, *first_wr = &send_wr;
struct ib_sge sge; struct ib_sge sge;
enum srpt_command_state state; enum srpt_command_state state;
int resp_len, ret, i; int resp_len, ret, i;
...@@ -2759,7 +2758,7 @@ static void srpt_queue_response(struct se_cmd *cmd) ...@@ -2759,7 +2758,7 @@ static void srpt_queue_response(struct se_cmd *cmd)
send_wr.opcode = IB_WR_SEND; send_wr.opcode = IB_WR_SEND;
send_wr.send_flags = IB_SEND_SIGNALED; send_wr.send_flags = IB_SEND_SIGNALED;
ret = ib_post_send(ch->qp, first_wr, &bad_wr); ret = ib_post_send(ch->qp, first_wr, NULL);
if (ret < 0) { if (ret < 0) {
pr_err("%s: sending cmd response failed for tag %llu (%d)\n", pr_err("%s: sending cmd response failed for tag %llu (%d)\n",
__func__, ioctx->cmd.tag, ret); __func__, ioctx->cmd.tag, ret);
......
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