Commit 1d2bb5ad authored by Eran Ben Elisha's avatar Eran Ben Elisha Committed by Jakub Kicinski

net/mlx5: Fix wrong address reclaim when command interface is down

When command interface is down, driver to reclaim all 4K page chucks that
were hold by the Firmeware. Fix a bug for 64K page size systems, where
driver repeatedly released only the first chunk of the page.

Define helper function to fill 4K chunks for a given Firmware pages.
Iterate over all unreleased Firmware pages and call the hepler per each.

Fixes: 5adff6a0 ("net/mlx5: Fix incorrect page count when in internal error")
Signed-off-by: default avatarEran Ben Elisha <eranbe@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 9608fa65
...@@ -422,6 +422,24 @@ static void release_all_pages(struct mlx5_core_dev *dev, u32 func_id, ...@@ -422,6 +422,24 @@ static void release_all_pages(struct mlx5_core_dev *dev, u32 func_id,
npages, ec_function, func_id); npages, ec_function, func_id);
} }
static u32 fwp_fill_manage_pages_out(struct fw_page *fwp, u32 *out, u32 index,
u32 npages)
{
u32 pages_set = 0;
unsigned int n;
for_each_clear_bit(n, &fwp->bitmask, MLX5_NUM_4K_IN_PAGE) {
MLX5_ARRAY_SET64(manage_pages_out, out, pas, index + pages_set,
fwp->addr + (n * MLX5_ADAPTER_PAGE_SIZE));
pages_set++;
if (!--npages)
break;
}
return pages_set;
}
static int reclaim_pages_cmd(struct mlx5_core_dev *dev, static int reclaim_pages_cmd(struct mlx5_core_dev *dev,
u32 *in, int in_size, u32 *out, int out_size) u32 *in, int in_size, u32 *out, int out_size)
{ {
...@@ -448,8 +466,7 @@ static int reclaim_pages_cmd(struct mlx5_core_dev *dev, ...@@ -448,8 +466,7 @@ static int reclaim_pages_cmd(struct mlx5_core_dev *dev,
fwp = rb_entry(p, struct fw_page, rb_node); fwp = rb_entry(p, struct fw_page, rb_node);
p = rb_next(p); p = rb_next(p);
MLX5_ARRAY_SET64(manage_pages_out, out, pas, i, fwp->addr); i += fwp_fill_manage_pages_out(fwp, out, i, npages - i);
i++;
} }
MLX5_SET(manage_pages_out, out, output_num_entries, i); MLX5_SET(manage_pages_out, out, output_num_entries, i);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment