Skip to content

Commit 7bb1faf

Browse files
KAGA-KOKOjgunthorpe
authored andcommitted
IB/mlx5, ib_post_send(), IB_WR_REG_SIG_MR: Do not modify the 'wr' argument
Since the next patch will constify the wr pointer, do not modify the data that pointer points at. Signed-off-by: Bart Van Assche <[email protected]> Reviewed-by: Sagi Grimberg <[email protected]> Cc: Saeed Mahameed <[email protected]> Acked-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent f696bf6 commit 7bb1faf

File tree

1 file changed

+18
-12
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+18
-12
lines changed

drivers/infiniband/hw/mlx5/qp.c

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4294,10 +4294,10 @@ static void dump_wqe(struct mlx5_ib_qp *qp, int idx, int size_16)
42944294
}
42954295
}
42964296

4297-
static int begin_wqe(struct mlx5_ib_qp *qp, void **seg,
4297+
static int __begin_wqe(struct mlx5_ib_qp *qp, void **seg,
42984298
struct mlx5_wqe_ctrl_seg **ctrl,
42994299
const struct ib_send_wr *wr, unsigned *idx,
4300-
int *size, int nreq)
4300+
int *size, int nreq, bool send_signaled, bool solicited)
43014301
{
43024302
if (unlikely(mlx5_wq_overflow(&qp->sq, nreq, qp->ibqp.send_cq)))
43034303
return -ENOMEM;
@@ -4308,17 +4308,25 @@ static int begin_wqe(struct mlx5_ib_qp *qp, void **seg,
43084308
*(uint32_t *)(*seg + 8) = 0;
43094309
(*ctrl)->imm = send_ieth(wr);
43104310
(*ctrl)->fm_ce_se = qp->sq_signal_bits |
4311-
(wr->send_flags & IB_SEND_SIGNALED ?
4312-
MLX5_WQE_CTRL_CQ_UPDATE : 0) |
4313-
(wr->send_flags & IB_SEND_SOLICITED ?
4314-
MLX5_WQE_CTRL_SOLICITED : 0);
4311+
(send_signaled ? MLX5_WQE_CTRL_CQ_UPDATE : 0) |
4312+
(solicited ? MLX5_WQE_CTRL_SOLICITED : 0);
43154313

43164314
*seg += sizeof(**ctrl);
43174315
*size = sizeof(**ctrl) / 16;
43184316

43194317
return 0;
43204318
}
43214319

4320+
static int begin_wqe(struct mlx5_ib_qp *qp, void **seg,
4321+
struct mlx5_wqe_ctrl_seg **ctrl,
4322+
const struct ib_send_wr *wr, unsigned *idx,
4323+
int *size, int nreq)
4324+
{
4325+
return __begin_wqe(qp, seg, ctrl, wr, idx, size, nreq,
4326+
wr->send_flags & IB_SEND_SIGNALED,
4327+
wr->send_flags & IB_SEND_SOLICITED);
4328+
}
4329+
43224330
static void finish_wqe(struct mlx5_ib_qp *qp,
43234331
struct mlx5_wqe_ctrl_seg *ctrl,
43244332
u8 size, unsigned idx, u64 wr_id,
@@ -4477,10 +4485,8 @@ static int _mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
44774485
* SET_PSV WQEs are not signaled and solicited
44784486
* on error
44794487
*/
4480-
wr->send_flags &= ~IB_SEND_SIGNALED;
4481-
wr->send_flags |= IB_SEND_SOLICITED;
4482-
err = begin_wqe(qp, &seg, &ctrl, wr,
4483-
&idx, &size, nreq);
4488+
err = __begin_wqe(qp, &seg, &ctrl, wr, &idx,
4489+
&size, nreq, false, true);
44844490
if (err) {
44854491
mlx5_ib_warn(dev, "\n");
44864492
err = -ENOMEM;
@@ -4499,8 +4505,8 @@ static int _mlx5_ib_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
44994505

45004506
finish_wqe(qp, ctrl, size, idx, wr->wr_id, nreq,
45014507
fence, MLX5_OPCODE_SET_PSV);
4502-
err = begin_wqe(qp, &seg, &ctrl, wr,
4503-
&idx, &size, nreq);
4508+
err = __begin_wqe(qp, &seg, &ctrl, wr, &idx,
4509+
&size, nreq, false, true);
45044510
if (err) {
45054511
mlx5_ib_warn(dev, "\n");
45064512
err = -ENOMEM;

0 commit comments

Comments
 (0)