diff mbox

[3/3] RDMA/qedr: Fix endian problems around imm_data

Message ID 20180111214307.501-4-jgg@ziepe.ca (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show

Commit Message

Jason Gunthorpe Jan. 11, 2018, 9:43 p.m. UTC
From: Jason Gunthorpe <jgg@mellanox.com>

The double swap matches what user space rdma-core does to imm_data.

wc->imm_data is not used in the kernel so this change has no practical
impact.

Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
 drivers/infiniband/hw/qedr/verbs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kalderon, Michal Jan. 15, 2018, 1:01 p.m. UTC | #1
> From: Jason Gunthorpe [mailto:jgg@ziepe.ca]
> Sent: Thursday, January 11, 2018 11:43 PM
> 
> From: Jason Gunthorpe <jgg@mellanox.com>
> 
> The double swap matches what user space rdma-core does to imm_data.
> 
> wc->imm_data is not used in the kernel so this change has no practical
> impact.
> 
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> ---
>  drivers/infiniband/hw/qedr/verbs.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/qedr/verbs.c
> b/drivers/infiniband/hw/qedr/verbs.c
> index 3b9c89848d6698..5551120ac6ea52 100644
> --- a/drivers/infiniband/hw/qedr/verbs.c
> +++ b/drivers/infiniband/hw/qedr/verbs.c
> @@ -3039,7 +3039,7 @@ static int __qedr_post_send(struct ib_qp *ibqp,
> struct ib_send_wr *wr,
>  		swqe->wqe_size = 2;
>  		swqe2 = qed_chain_produce(&qp->sq.pbl);
> 
> -		swqe->inv_key_or_imm_data = cpu_to_le32(wr-
> >ex.imm_data);
> +		swqe->inv_key_or_imm_data =
> cpu_to_le32(be32_to_cpu(wr->ex.imm_data));
>  		length = qedr_prepare_sq_send_data(dev, qp, swqe,
> swqe2,
>  						   wr, bad_wr);
>  		swqe->length = cpu_to_le32(length);
> @@ -3590,7 +3590,7 @@ static inline int qedr_set_ok_cqe_resp_wc(struct
> rdma_cqe_responder *resp,
>  	wc->byte_len = le32_to_cpu(resp->length);
> 
>  	if (resp->flags & QEDR_RESP_IMM) {
> -		wc->ex.imm_data = le32_to_cpu(resp-
> >imm_data_or_inv_r_Key);
> +		wc->ex.imm_data = cpu_to_be32(le32_to_cpu(resp-
> >imm_data_or_inv_r_Key));
>  		wc->wc_flags |= IB_WC_WITH_IMM;
> 
>  		if (resp->flags & QEDR_RESP_RDMA)
> --
> 2.15.1
Acked-by: Michal Kalderon <michal.kalderon@cavium.com>
Thanks Jason! 
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/infiniband/hw/qedr/verbs.c b/drivers/infiniband/hw/qedr/verbs.c
index 3b9c89848d6698..5551120ac6ea52 100644
--- a/drivers/infiniband/hw/qedr/verbs.c
+++ b/drivers/infiniband/hw/qedr/verbs.c
@@ -3039,7 +3039,7 @@  static int __qedr_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
 		swqe->wqe_size = 2;
 		swqe2 = qed_chain_produce(&qp->sq.pbl);
 
-		swqe->inv_key_or_imm_data = cpu_to_le32(wr->ex.imm_data);
+		swqe->inv_key_or_imm_data = cpu_to_le32(be32_to_cpu(wr->ex.imm_data));
 		length = qedr_prepare_sq_send_data(dev, qp, swqe, swqe2,
 						   wr, bad_wr);
 		swqe->length = cpu_to_le32(length);
@@ -3590,7 +3590,7 @@  static inline int qedr_set_ok_cqe_resp_wc(struct rdma_cqe_responder *resp,
 	wc->byte_len = le32_to_cpu(resp->length);
 
 	if (resp->flags & QEDR_RESP_IMM) {
-		wc->ex.imm_data = le32_to_cpu(resp->imm_data_or_inv_r_Key);
+		wc->ex.imm_data = cpu_to_be32(le32_to_cpu(resp->imm_data_or_inv_r_Key));
 		wc->wc_flags |= IB_WC_WITH_IMM;
 
 		if (resp->flags & QEDR_RESP_RDMA)