net/mlx5: Mkey creation command adjustments
This change updates the mlx5 interface to create mkey on the device. The updates in the command mailbox include increasing the access mode type field to 5 bits in order to support additional types such as MLX5_MKC_ACCESS_MODE_MEMIC which represents device memory access type and will be used when registering MR on allocated device memory. All the places that use the old access mode format are adjusted as well. Signed-off-by: Ariel Levkovich <lariel@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:

committed by
Jason Gunthorpe

parent
24da00164f
commit
cdbd0d2bae
@@ -99,23 +99,21 @@ int mlx5_cmd_alloc_memic(struct mlx5_memic *memic, phys_addr_t *addr,
|
||||
MLX5_SET(alloc_memic_in, in, log_memic_addr_alignment,
|
||||
mlx5_alignment);
|
||||
|
||||
do {
|
||||
while (page_idx < num_memic_hw_pages) {
|
||||
spin_lock(&memic->memic_lock);
|
||||
page_idx = bitmap_find_next_zero_area(memic->memic_alloc_pages,
|
||||
num_memic_hw_pages,
|
||||
page_idx,
|
||||
num_pages, 0);
|
||||
|
||||
if (page_idx + num_pages <= num_memic_hw_pages)
|
||||
if (page_idx < num_memic_hw_pages)
|
||||
bitmap_set(memic->memic_alloc_pages,
|
||||
page_idx, num_pages);
|
||||
else
|
||||
ret = -ENOMEM;
|
||||
|
||||
spin_unlock(&memic->memic_lock);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
if (page_idx >= num_memic_hw_pages)
|
||||
break;
|
||||
|
||||
MLX5_SET64(alloc_memic_in, in, range_start_addr,
|
||||
hw_start_addr + (page_idx * PAGE_SIZE));
|
||||
@@ -138,10 +136,10 @@ int mlx5_cmd_alloc_memic(struct mlx5_memic *memic, phys_addr_t *addr,
|
||||
*addr = pci_resource_start(dev->pdev, 0) +
|
||||
MLX5_GET64(alloc_memic_out, out, memic_start_addr);
|
||||
|
||||
return ret;
|
||||
} while (page_idx < num_memic_hw_pages);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return ret;
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
int mlx5_cmd_dealloc_memic(struct mlx5_memic *memic, u64 addr, u64 length)
|
||||
|
Reference in New Issue
Block a user