Skip to content

Commit 3502596

Browse files
siwliu-kernelmstsirkin
authored andcommitted
vdpa/mlx5: Fix suboptimal range on iotlb iteration
The starting iova address to iterate iotlb map entry within a range was set to an irrelevant value when passing to the itree_next() iterator, although luckily it doesn't affect the outcome of finding out the granule of the smallest iotlb map size. Fix the code to make it consistent with the following for-loop. Fixes: 94abbcc ("vdpa/mlx5: Add shared memory registration code") Signed-off-by: Si-Wei Liu <[email protected]> Signed-off-by: Dragos Tatulea <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Jason Wang <[email protected]>
1 parent 29ce8b8 commit 3502596

File tree

1 file changed

+1
-3
lines changed
  • drivers/vdpa/mlx5/core

1 file changed

+1
-3
lines changed

drivers/vdpa/mlx5/core/mr.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
368368
unsigned long lgcd = 0;
369369
int log_entity_size;
370370
unsigned long size;
371-
u64 start = 0;
372371
int err;
373372
struct page *pg;
374373
unsigned int nsg;
@@ -379,10 +378,9 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr
379378
struct device *dma = mvdev->vdev.dma_dev;
380379

381380
for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1);
382-
map; map = vhost_iotlb_itree_next(map, start, mr->end - 1)) {
381+
map; map = vhost_iotlb_itree_next(map, mr->start, mr->end - 1)) {
383382
size = maplen(map, mr);
384383
lgcd = gcd(lgcd, size);
385-
start += size;
386384
}
387385
log_entity_size = ilog2(lgcd);
388386

0 commit comments

Comments
 (0)