Re: [PATCH v5 20/20] RDMA, core and ULPs: Declare ib_post_send() and ib_post_recv() arguments const

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> On Jul 18, 2018, at 12:25 PM, Bart Van Assche <Bart.VanAssche@xxxxxxx> wrote:
> 
> Since neither ib_post_send() nor ib_post_recv() modify the data structure
> their second argument points at, declare that argument const. This change
> makes it necessary to declare the 'bad_wr' argument const too and also
> to modify all ULPs that call ib_post_send(), ib_post_recv() or
> ib_post_srq_recv(). This patch does not change any functionality but
> makes it possible for the compiler to verify whether the
> ib_post_(send|recv|srq_recv) really do not modify the posted work request.
> 
> To make this possible, only one cast had to be introduce that casts away
> constness, namely in rpcrdma_post_recvs(). The only way I can think of
> to avoid that cast is to introduce an additional loop in that function
> or to change the data type of bad_wr from struct ib_recv_wr ** into int
> (an index that refers to an element in the work request list). However,
> both approaches would require even more extensive changes than this
> patch.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@xxxxxxx>
> Cc: Ariel Elior <Ariel.Elior@xxxxxxxxxx>
> Cc: Dennis Dalessandro <dennis.dalessandro@xxxxxxxxx>
> Cc: Devesh Sharma <devesh.sharma@xxxxxxxxxxxx>
> Cc: Faisal Latif <faisal.latif@xxxxxxxxx>
> Cc: Leon Romanovsky <leonro@xxxxxxxxxxxx>
> Cc: Lijun Ou <oulijun@xxxxxxxxxx>
> Cc: Michal Kalderon <Michal.Kalderon@xxxxxxxxxx>
> Cc: Mike Marciniszyn <mike.marciniszyn@xxxxxxxxx>
> Cc: Moni Shoua <monis@xxxxxxxxxxxx>
> Cc: Parav Pandit <parav@xxxxxxxxxxxx>
> Cc: Selvin Xavier <selvin.xavier@xxxxxxxxxxxx>
> Cc: Somnath Kotur <somnath.kotur@xxxxxxxxxxxx>
> Cc: Sriharsha Basavapatna <sriharsha.basavapatna@xxxxxxxxxxxx>
> Cc: Steve Wise <swise@xxxxxxxxxxx>
> Cc: Wei Hu(Xavier) <xavier.huwei@xxxxxxxxxx>
> Cc: Yishai Hadas <yishaih@xxxxxxxxxxxx>
> Cc: Sagi Grimberg <sagi@xxxxxxxxxxx>
> Cc: Chuck Lever <chuck.lever@xxxxxxxxxx>
> Cc: J. Bruce Fields <bfields@xxxxxxxxxx>

Reviewed-by: Chuck Lever <chuck.lever@xxxxxxxxxx>

The NFS client pieces of this patch and the other I reviewed (ie,
frwr_ops.c and fmr_ops.c) also need an Ack from Anna Schumaker.

So, please Cc: Anna on this patch, and Cc: Anna and Bruce Fields
on the other patch. Thanks.


> ---
> drivers/infiniband/core/uverbs_cmd.c          |  9 ++++--
> drivers/infiniband/hw/bnxt_re/ib_verbs.c      | 16 +++++-----
> drivers/infiniband/hw/bnxt_re/ib_verbs.h      | 12 ++++----
> drivers/infiniband/hw/cxgb3/iwch_provider.h   |  8 ++---
> drivers/infiniband/hw/cxgb3/iwch_qp.c         | 12 ++++----
> drivers/infiniband/hw/cxgb4/iw_cxgb4.h        |  8 ++---
> drivers/infiniband/hw/cxgb4/qp.c              | 21 +++++++------
> drivers/infiniband/hw/hns/hns_roce_device.h   |  8 ++---
> drivers/infiniband/hw/hns/hns_roce_hw_v1.c    | 13 ++++----
> drivers/infiniband/hw/hns/hns_roce_hw_v2.c    | 12 ++++----
> drivers/infiniband/hw/i40iw/i40iw_verbs.c     |  9 +++---
> drivers/infiniband/hw/mlx4/mad.c              |  7 +++--
> drivers/infiniband/hw/mlx4/mlx4_ib.h          | 12 ++++----
> drivers/infiniband/hw/mlx4/qp.c               | 21 ++++++-------
> drivers/infiniband/hw/mlx4/srq.c              |  4 +--
> drivers/infiniband/hw/mlx5/gsi.c              |  8 ++---
> drivers/infiniband/hw/mlx5/mlx5_ib.h          | 20 ++++++-------
> drivers/infiniband/hw/mlx5/mr.c               |  2 +-
> drivers/infiniband/hw/mlx5/qp.c               | 21 ++++++-------
> drivers/infiniband/hw/mlx5/srq.c              |  4 +--
> drivers/infiniband/hw/mthca/mthca_dev.h       | 24 +++++++--------
> drivers/infiniband/hw/mthca/mthca_qp.c        | 16 +++++-----
> drivers/infiniband/hw/mthca/mthca_srq.c       |  8 ++---
> drivers/infiniband/hw/nes/nes_verbs.c         |  8 ++---
> drivers/infiniband/hw/ocrdma/ocrdma_verbs.c   | 16 +++++-----
> drivers/infiniband/hw/ocrdma/ocrdma_verbs.h   | 12 ++++----
> drivers/infiniband/hw/qedr/qedr_roce_cm.c     |  8 ++---
> drivers/infiniband/hw/qedr/qedr_roce_cm.h     |  8 ++---
> drivers/infiniband/hw/qedr/verbs.c            | 26 ++++++++--------
> drivers/infiniband/hw/qedr/verbs.h            |  8 ++---
> drivers/infiniband/hw/usnic/usnic_ib_verbs.c  |  8 ++---
> drivers/infiniband/hw/usnic/usnic_ib_verbs.h  |  8 ++---
> drivers/infiniband/hw/vmw_pvrdma/pvrdma_qp.c  |  8 ++---
> drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c |  4 +--
> .../infiniband/hw/vmw_pvrdma/pvrdma_verbs.h   | 12 ++++----
> drivers/infiniband/sw/rdmavt/qp.c             | 12 ++++----
> drivers/infiniband/sw/rdmavt/qp.h             | 12 ++++----
> drivers/infiniband/sw/rxe/rxe_verbs.c         | 18 +++++------
> include/rdma/ib_verbs.h                       | 30 +++++++++----------
> net/rds/ib_send.c                             |  6 ++--
> net/sunrpc/xprtrdma/frwr_ops.c                |  3 +-
> net/sunrpc/xprtrdma/svc_rdma_rw.c             |  3 +-
> net/sunrpc/xprtrdma/verbs.c                   |  3 +-
> 43 files changed, 252 insertions(+), 236 deletions(-)

[ ... snipped ... ]

> diff --git a/net/sunrpc/xprtrdma/frwr_ops.c b/net/sunrpc/xprtrdma/frwr_ops.c
> index a167eebf63d5..1bb00dd6ccdb 100644
> --- a/net/sunrpc/xprtrdma/frwr_ops.c
> +++ b/net/sunrpc/xprtrdma/frwr_ops.c
> @@ -517,7 +517,8 @@ frwr_op_reminv(struct rpcrdma_rep *rep, struct list_head *mrs)
> static void
> frwr_op_unmap_sync(struct rpcrdma_xprt *r_xprt, struct list_head *mrs)
> {
> -	struct ib_send_wr *first, **prev, *last, *bad_wr;
> +	struct ib_send_wr *first, **prev, *last;
> +	const struct ib_send_wr *bad_wr;
> 	struct rpcrdma_ia *ia = &r_xprt->rx_ia;
> 	struct rpcrdma_frwr *frwr;
> 	struct rpcrdma_mr *mr;
> diff --git a/net/sunrpc/xprtrdma/svc_rdma_rw.c b/net/sunrpc/xprtrdma/svc_rdma_rw.c
> index 80975427f523..18eaed53bb19 100644
> --- a/net/sunrpc/xprtrdma/svc_rdma_rw.c
> +++ b/net/sunrpc/xprtrdma/svc_rdma_rw.c
> @@ -307,7 +307,8 @@ static int svc_rdma_post_chunk_ctxt(struct svc_rdma_chunk_ctxt *cc)
> {
> 	struct svcxprt_rdma *rdma = cc->cc_rdma;
> 	struct svc_xprt *xprt = &rdma->sc_xprt;
> -	struct ib_send_wr *first_wr, *bad_wr;
> +	struct ib_send_wr *first_wr;
> +	const struct ib_send_wr *bad_wr;
> 	struct list_head *tmp;
> 	struct ib_cqe *cqe;
> 	int ret;
> diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c
> index 112a15abc4a4..5efeba08918b 100644
> --- a/net/sunrpc/xprtrdma/verbs.c
> +++ b/net/sunrpc/xprtrdma/verbs.c
> @@ -1559,7 +1559,8 @@ rpcrdma_post_recvs(struct rpcrdma_xprt *r_xprt, bool temp)
> 	if (!count)
> 		return;
> 
> -	rc = ib_post_recv(r_xprt->rx_ia.ri_id->qp, wr, &bad_wr);
> +	rc = ib_post_recv(r_xprt->rx_ia.ri_id->qp, wr,
> +			  (const struct ib_recv_wr **)&bad_wr);
> 	if (rc) {
> 		for (wr = bad_wr; wr; wr = wr->next) {
> 			struct rpcrdma_rep *rep;

--
Chuck Lever



--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux