diff mbox

mlx5: Fix mlx5_ib_map_mr_sg mr length

Message ID 1492947102-3133-1-git-send-email-sagi@grimberg.me (mailing list archive)
State Accepted
Headers show

Commit Message

Sagi Grimberg April 23, 2017, 11:31 a.m. UTC
In case we got an initial sg_offset, we need to
account for it in the mr length.

Fixes: ff2ba9936591 ("IB/core: Add passing an offset into the SG to
ib_map_mr_sg")
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
---
 drivers/infiniband/hw/mlx5/mr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Max Gurtovoy April 23, 2017, 1:51 p.m. UTC | #1
On 4/23/2017 2:31 PM, Sagi Grimberg wrote:
> In case we got an initial sg_offset, we need to
> account for it in the mr length.
>
> Fixes: ff2ba9936591 ("IB/core: Add passing an offset into the SG to
> ib_map_mr_sg")
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> ---
>  drivers/infiniband/hw/mlx5/mr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> index b8f9382a8b7d..d9c6c0ea750b 100644
> --- a/drivers/infiniband/hw/mlx5/mr.c
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -1782,7 +1782,7 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr,
>  		klms[i].va = cpu_to_be64(sg_dma_address(sg) + sg_offset);
>  		klms[i].bcount = cpu_to_be32(sg_dma_len(sg) - sg_offset);
>  		klms[i].key = cpu_to_be32(lkey);
> -		mr->ibmr.length += sg_dma_len(sg);
> +		mr->ibmr.length += sg_dma_len(sg) - sg_offset;
>
>  		sg_offset = 0;
>  	}
>

Israel,
Can you please test it with our regression test suite (SRP can send 
sg_offset != 0) and send Tested-By signature ?
Also run Laurence scenario with SG_GAPS patch applied too.

thanks,
Max.
--
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
Israel Rukshin April 24, 2017, 2:51 p.m. UTC | #2
On 4/23/2017 2:31 PM, Sagi Grimberg wrote:
> In case we got an initial sg_offset, we need to
> account for it in the mr length.
>
> Fixes: ff2ba9936591 ("IB/core: Add passing an offset into the SG to
> ib_map_mr_sg")
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Tested-by: Israel Rukshin <israelr@mellanox.com>
--
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
Bart Van Assche April 24, 2017, 3:20 p.m. UTC | #3
On Sun, 2017-04-23 at 14:31 +0300, Sagi Grimberg wrote:
> In case we got an initial sg_offset, we need to
> account for it in the mr length.
> 
> Fixes: ff2ba9936591 ("IB/core: Add passing an offset into the SG to
> ib_map_mr_sg")
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
> ---
>  drivers/infiniband/hw/mlx5/mr.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
> index b8f9382a8b7d..d9c6c0ea750b 100644
> --- a/drivers/infiniband/hw/mlx5/mr.c
> +++ b/drivers/infiniband/hw/mlx5/mr.c
> @@ -1782,7 +1782,7 @@ mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr,
>  		klms[i].va = cpu_to_be64(sg_dma_address(sg) + sg_offset);
>  		klms[i].bcount = cpu_to_be32(sg_dma_len(sg) - sg_offset);
>  		klms[i].key = cpu_to_be32(lkey);
> -		mr->ibmr.length += sg_dma_len(sg);
> +		mr->ibmr.length += sg_dma_len(sg) - sg_offset;
>  
>  		sg_offset = 0;
>  	}

Hello Sagi,

Please add "Cc: <stable@vger.kernel.org>" to this patch.

Thanks,

Bart.--
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
Doug Ledford May 1, 2017, 6:58 p.m. UTC | #4
On Sun, 2017-04-23 at 14:31 +0300, Sagi Grimberg wrote:
> In case we got an initial sg_offset, we need to
> account for it in the mr length.
> 
> Fixes: ff2ba9936591 ("IB/core: Add passing an offset into the SG to
> ib_map_mr_sg")
> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>

Cc: stable added and applied, thanks.
diff mbox

Patch

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index b8f9382a8b7d..d9c6c0ea750b 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -1782,7 +1782,7 @@  mlx5_ib_sg_to_klms(struct mlx5_ib_mr *mr,
 		klms[i].va = cpu_to_be64(sg_dma_address(sg) + sg_offset);
 		klms[i].bcount = cpu_to_be32(sg_dma_len(sg) - sg_offset);
 		klms[i].key = cpu_to_be32(lkey);
-		mr->ibmr.length += sg_dma_len(sg);
+		mr->ibmr.length += sg_dma_len(sg) - sg_offset;
 
 		sg_offset = 0;
 	}