Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f696bf6d authored by Bart Van Assche's avatar Bart Van Assche Committed by Jason Gunthorpe
Browse files

RDMA: Constify the argument of the work request conversion functions



When posting a send work request, the work request that is posted is not
modified by any of the RDMA drivers. Make this explicit by constifying
most ib_send_wr pointers in RDMA transport drivers.

Signed-off-by: default avatarBart Van Assche <bart.vanassche@wdc.com>
Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
Reviewed-by: default avatarSteve Wise <swise@opengridcomputing.com>
Reviewed-by: default avatarDennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
parent 3e081b77
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -1876,7 +1876,7 @@ int bnxt_re_query_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
/* Routine for sending QP1 packets for RoCE V1 an V2
 */
static int bnxt_re_build_qp1_send_v2(struct bnxt_re_qp *qp,
				     struct ib_send_wr *wr,
				     const struct ib_send_wr *wr,
				     struct bnxt_qplib_swqe *wqe,
				     int payload_size)
{
@@ -2093,7 +2093,7 @@ static int is_ud_qp(struct bnxt_re_qp *qp)
}

static int bnxt_re_build_send_wqe(struct bnxt_re_qp *qp,
				  struct ib_send_wr *wr,
				  const struct ib_send_wr *wr,
				  struct bnxt_qplib_swqe *wqe)
{
	struct bnxt_re_ah *ah = NULL;
@@ -2131,7 +2131,7 @@ static int bnxt_re_build_send_wqe(struct bnxt_re_qp *qp,
	return 0;
}

static int bnxt_re_build_rdma_wqe(struct ib_send_wr *wr,
static int bnxt_re_build_rdma_wqe(const struct ib_send_wr *wr,
				  struct bnxt_qplib_swqe *wqe)
{
	switch (wr->opcode) {
@@ -2163,7 +2163,7 @@ static int bnxt_re_build_rdma_wqe(struct ib_send_wr *wr,
	return 0;
}

static int bnxt_re_build_atomic_wqe(struct ib_send_wr *wr,
static int bnxt_re_build_atomic_wqe(const struct ib_send_wr *wr,
				    struct bnxt_qplib_swqe *wqe)
{
	switch (wr->opcode) {
@@ -2190,7 +2190,7 @@ static int bnxt_re_build_atomic_wqe(struct ib_send_wr *wr,
	return 0;
}

static int bnxt_re_build_inv_wqe(struct ib_send_wr *wr,
static int bnxt_re_build_inv_wqe(const struct ib_send_wr *wr,
				 struct bnxt_qplib_swqe *wqe)
{
	wqe->type = BNXT_QPLIB_SWQE_TYPE_LOCAL_INV;
@@ -2209,7 +2209,7 @@ static int bnxt_re_build_inv_wqe(struct ib_send_wr *wr,
	return 0;
}

static int bnxt_re_build_reg_wqe(struct ib_reg_wr *wr,
static int bnxt_re_build_reg_wqe(const struct ib_reg_wr *wr,
				 struct bnxt_qplib_swqe *wqe)
{
	struct bnxt_re_mr *mr = container_of(wr->mr, struct bnxt_re_mr, ib_mr);
@@ -2251,7 +2251,7 @@ static int bnxt_re_build_reg_wqe(struct ib_reg_wr *wr,
}

static int bnxt_re_copy_inline_data(struct bnxt_re_dev *rdev,
				    struct ib_send_wr *wr,
				    const struct ib_send_wr *wr,
				    struct bnxt_qplib_swqe *wqe)
{
	/*  Copy the inline data to the data  field */
@@ -2281,7 +2281,7 @@ static int bnxt_re_copy_inline_data(struct bnxt_re_dev *rdev,
}

static int bnxt_re_copy_wr_payload(struct bnxt_re_dev *rdev,
				   struct ib_send_wr *wr,
				   const struct ib_send_wr *wr,
				   struct bnxt_qplib_swqe *wqe)
{
	int payload_sz = 0;
@@ -2313,7 +2313,7 @@ static void bnxt_ud_qp_hw_stall_workaround(struct bnxt_re_qp *qp)

static int bnxt_re_post_send_shadow_qp(struct bnxt_re_dev *rdev,
				       struct bnxt_re_qp *qp,
				struct ib_send_wr *wr)
				       const struct ib_send_wr *wr)
{
	struct bnxt_qplib_swqe wqe;
	int rc = 0, payload_sz = 0;
+10 −10
Original line number Diff line number Diff line
@@ -39,7 +39,7 @@

#define NO_SUPPORT -1

static int build_rdma_send(union t3_wr *wqe, struct ib_send_wr *wr,
static int build_rdma_send(union t3_wr *wqe, const struct ib_send_wr *wr,
			   u8 *flit_cnt)
{
	int i;
@@ -84,7 +84,7 @@ static int build_rdma_send(union t3_wr *wqe, struct ib_send_wr *wr,
	return 0;
}

static int build_rdma_write(union t3_wr *wqe, struct ib_send_wr *wr,
static int build_rdma_write(union t3_wr *wqe, const struct ib_send_wr *wr,
			    u8 *flit_cnt)
{
	int i;
@@ -125,7 +125,7 @@ static int build_rdma_write(union t3_wr *wqe, struct ib_send_wr *wr,
	return 0;
}

static int build_rdma_read(union t3_wr *wqe, struct ib_send_wr *wr,
static int build_rdma_read(union t3_wr *wqe, const struct ib_send_wr *wr,
			   u8 *flit_cnt)
{
	if (wr->num_sge > 1)
@@ -146,7 +146,7 @@ static int build_rdma_read(union t3_wr *wqe, struct ib_send_wr *wr,
	return 0;
}

static int build_memreg(union t3_wr *wqe, struct ib_reg_wr *wr,
static int build_memreg(union t3_wr *wqe, const struct ib_reg_wr *wr,
			u8 *flit_cnt, int *wr_cnt, struct t3_wq *wq)
{
	struct iwch_mr *mhp = to_iwch_mr(wr->mr);
@@ -189,7 +189,7 @@ static int build_memreg(union t3_wr *wqe, struct ib_reg_wr *wr,
	return 0;
}

static int build_inv_stag(union t3_wr *wqe, struct ib_send_wr *wr,
static int build_inv_stag(union t3_wr *wqe, const struct ib_send_wr *wr,
			  u8 *flit_cnt)
{
	wqe->local_inv.stag = cpu_to_be32(wr->ex.invalidate_rkey);
+12 −9
Original line number Diff line number Diff line
@@ -410,7 +410,7 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4_wq *wq,
}

static int build_immd(struct t4_sq *sq, struct fw_ri_immd *immdp,
		      struct ib_send_wr *wr, int max, u32 *plenp)
		      const struct ib_send_wr *wr, int max, u32 *plenp)
{
	u8 *dstp, *srcp;
	u32 plen = 0;
@@ -480,7 +480,7 @@ static int build_isgl(__be64 *queue_start, __be64 *queue_end,
}

static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe,
			   struct ib_send_wr *wr, u8 *len16)
			   const struct ib_send_wr *wr, u8 *len16)
{
	u32 plen;
	int size;
@@ -547,7 +547,7 @@ static int build_rdma_send(struct t4_sq *sq, union t4_wr *wqe,
}

static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe,
			    struct ib_send_wr *wr, u8 *len16)
			    const struct ib_send_wr *wr, u8 *len16)
{
	u32 plen;
	int size;
@@ -589,7 +589,8 @@ static int build_rdma_write(struct t4_sq *sq, union t4_wr *wqe,
	return 0;
}

static int build_rdma_read(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16)
static int build_rdma_read(union t4_wr *wqe, const struct ib_send_wr *wr,
			   u8 *len16)
{
	if (wr->num_sge > 1)
		return -EINVAL;
@@ -648,7 +649,7 @@ static int build_srq_recv(union t4_recv_wr *wqe, struct ib_recv_wr *wr,
}

static void build_tpte_memreg(struct fw_ri_fr_nsmr_tpte_wr *fr,
			      struct ib_reg_wr *wr, struct c4iw_mr *mhp,
			      const struct ib_reg_wr *wr, struct c4iw_mr *mhp,
			      u8 *len16)
{
	__be64 *p = (__be64 *)fr->pbl;
@@ -680,8 +681,8 @@ static void build_tpte_memreg(struct fw_ri_fr_nsmr_tpte_wr *fr,
}

static int build_memreg(struct t4_sq *sq, union t4_wr *wqe,
			struct ib_reg_wr *wr, struct c4iw_mr *mhp, u8 *len16,
			bool dsgl_supported)
			const struct ib_reg_wr *wr, struct c4iw_mr *mhp,
			u8 *len16, bool dsgl_supported)
{
	struct fw_ri_immd *imdp;
	__be64 *p;
@@ -743,7 +744,8 @@ static int build_memreg(struct t4_sq *sq, union t4_wr *wqe,
	return 0;
}

static int build_inv_stag(union t4_wr *wqe, struct ib_send_wr *wr, u8 *len16)
static int build_inv_stag(union t4_wr *wqe, const struct ib_send_wr *wr,
			  u8 *len16)
{
	wqe->inv.stag_inv = cpu_to_be32(wr->ex.invalidate_rkey);
	wqe->inv.r2 = 0;
@@ -862,7 +864,8 @@ static int ib_to_fw_opcode(int ib_opcode)
	return opcode;
}

static int complete_sq_drain_wr(struct c4iw_qp *qhp, struct ib_send_wr *wr)
static int complete_sq_drain_wr(struct c4iw_qp *qhp,
				const struct ib_send_wr *wr)
{
	struct t4_cqe cqe = {};
	struct c4iw_cq *schp;
+1 −1
Original line number Diff line number Diff line
@@ -985,7 +985,7 @@ void hns_roce_qp_remove(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp);
void hns_roce_qp_free(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp);
void hns_roce_release_range_qp(struct hns_roce_dev *hr_dev, int base_qpn,
			       int cnt);
__be32 send_ieth(struct ib_send_wr *wr);
__be32 send_ieth(const struct ib_send_wr *wr);
int to_hr_qp_type(int qp_type);

struct ib_cq *hns_roce_ib_create_cq(struct ib_device *ib_dev,
+2 −2
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@ static void set_data_seg_v2(struct hns_roce_v2_wqe_data_seg *dseg,
	dseg->len  = cpu_to_le32(sg->length);
}

static void set_extend_sge(struct hns_roce_qp *qp, struct ib_send_wr *wr,
static void set_extend_sge(struct hns_roce_qp *qp, const struct ib_send_wr *wr,
			   unsigned int *sge_ind)
{
	struct hns_roce_v2_wqe_data_seg *dseg;
@@ -100,7 +100,7 @@ static void set_extend_sge(struct hns_roce_qp *qp, struct ib_send_wr *wr,
	}
}

static int set_rwqe_data_seg(struct ib_qp *ibqp, struct ib_send_wr *wr,
static int set_rwqe_data_seg(struct ib_qp *ibqp, const struct ib_send_wr *wr,
			     struct hns_roce_v2_rc_send_wqe *rc_sq_wqe,
			     void *wqe, unsigned int *sge_ind,
			     struct ib_send_wr **bad_wr)
Loading