Re: [PATCH] RDMA/ionic: Replace cpu_to_be64 + le64_to_cpu with swab64
From: Jason Gunthorpe
Date: Fri Dec 12 2025 - 01:50:00 EST
On Wed, Dec 10, 2025 at 02:14:29PM +0100, Thorsten Blum wrote:
> Replace cpu_to_be64(le64_to_cpu()) with swab64() to simplify
> ionic_prep_reg(). No functional changes.
>
> Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
> ---
> drivers/infiniband/hw/ionic/ionic_datapath.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/ionic/ionic_datapath.c b/drivers/infiniband/hw/ionic/ionic_datapath.c
> index aa2944887f23..1a1cf82d1745 100644
> --- a/drivers/infiniband/hw/ionic/ionic_datapath.c
> +++ b/drivers/infiniband/hw/ionic/ionic_datapath.c
> @@ -1105,7 +1105,7 @@ static int ionic_prep_reg(struct ionic_qp *qp,
> wqe->reg_mr.length = cpu_to_be64(mr->ibmr.length);
> wqe->reg_mr.offset = ionic_pgtbl_off(&mr->buf, mr->ibmr.iova);
> dma_addr = ionic_pgtbl_dma(&mr->buf, mr->ibmr.iova);
> - wqe->reg_mr.dma_addr = cpu_to_be64(le64_to_cpu(dma_addr));
> + wqe->reg_mr.dma_addr = swab64(dma_addr);
This doesn't make any sense to me. The original code looks wrong and
would fail sparse, switching to swab just highlights how nonsense it
is, there is no way that is right on BE and LE.
Pensando guys what is the right thing to do here??
Jason