* [PATCH] common/mlx5: fix MR range calculation
@ 2022-03-31 14:33 Dmitry Kozlyuk
2022-04-12 8:08 ` Raslan Darawsheh
0 siblings, 1 reply; 2+ messages in thread
From: Dmitry Kozlyuk @ 2022-03-31 14:33 UTC (permalink / raw)
To: dev; +Cc: stable, Matan Azrad, Viacheslav Ovsiienko
MR end for a mempool chunk may be calculated incorrectly.
For example, for chunk with addr=1.5M and len=1M with 2M page size
the range would be [0, 2M), while the proper result is [0, 4M).
Fix the calculation.
Fixes: 690b2a88c2f7 ("common/mlx5: add mempool registration facilities")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
drivers/common/mlx5/mlx5_common_mr.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/common/mlx5/mlx5_common_mr.c b/drivers/common/mlx5/mlx5_common_mr.c
index fa27bd98de..06e4c8f187 100644
--- a/drivers/common/mlx5/mlx5_common_mr.c
+++ b/drivers/common/mlx5/mlx5_common_mr.c
@@ -1289,11 +1289,12 @@ mlx5_range_from_mempool_chunk(struct rte_mempool *mp, void *opaque,
unsigned int idx)
{
struct mlx5_range *ranges = opaque, *range = &ranges[idx];
+ uintptr_t start = (uintptr_t)memhdr->addr;
uint64_t page_size = rte_mem_page_size();
RTE_SET_USED(mp);
- range->start = RTE_ALIGN_FLOOR((uintptr_t)memhdr->addr, page_size);
- range->end = RTE_ALIGN_CEIL(range->start + memhdr->len, page_size);
+ range->start = RTE_ALIGN_FLOOR(start, page_size);
+ range->end = RTE_ALIGN_CEIL(start + memhdr->len, page_size);
}
/**
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* RE: [PATCH] common/mlx5: fix MR range calculation
2022-03-31 14:33 [PATCH] common/mlx5: fix MR range calculation Dmitry Kozlyuk
@ 2022-04-12 8:08 ` Raslan Darawsheh
0 siblings, 0 replies; 2+ messages in thread
From: Raslan Darawsheh @ 2022-04-12 8:08 UTC (permalink / raw)
To: Dmitry Kozlyuk, dev; +Cc: stable, Matan Azrad, Slava Ovsiienko
Hi,
> -----Original Message-----
> From: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
> Sent: Thursday, March 31, 2022 5:33 PM
> To: dev@dpdk.org
> Cc: stable@dpdk.org; Matan Azrad <matan@nvidia.com>; Slava Ovsiienko
> <viacheslavo@nvidia.com>
> Subject: [PATCH] common/mlx5: fix MR range calculation
>
> MR end for a mempool chunk may be calculated incorrectly.
> For example, for chunk with addr=1.5M and len=1M with 2M page size the
> range would be [0, 2M), while the proper result is [0, 4M).
> Fix the calculation.
>
> Fixes: 690b2a88c2f7 ("common/mlx5: add mempool registration facilities")
> Cc: stable@dpdk.org
>
> Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
Patch applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-04-12 8:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-31 14:33 [PATCH] common/mlx5: fix MR range calculation Dmitry Kozlyuk
2022-04-12 8:08 ` Raslan Darawsheh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).