Skip to content

Commit ba5d8f7

Browse files
paravmellanoxSaeed Mahameed
authored andcommitted
net/mlx5: Fix setting ec_function bit in MANAGE_PAGES
When ECPF is a page supplier, reclaim pages missed to honor the ec_function bit provided by the firmware. It always used the ec_function to true during driver unload flow for ECPF. This is incorrect. Honor the ec_function bit provided by device during page allocation request event. Fixes: d694524 ("net/mlx5: Hold pages RB tree per VF") Signed-off-by: Parav Pandit <[email protected]> Signed-off-by: Daniel Jurgens <[email protected]> Signed-off-by: Saeed Mahameed <[email protected]>
1 parent 9a92fe1 commit ba5d8f7

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,16 @@ static u16 func_id_to_type(struct mlx5_core_dev *dev, u16 func_id, bool ec_funct
8282
return func_id <= mlx5_core_max_vfs(dev) ? MLX5_VF : MLX5_SF;
8383
}
8484

85+
static u32 mlx5_get_ec_function(u32 function)
86+
{
87+
return function >> 16;
88+
}
89+
90+
static u32 mlx5_get_func_id(u32 function)
91+
{
92+
return function & 0xffff;
93+
}
94+
8595
static struct rb_root *page_root_per_function(struct mlx5_core_dev *dev, u32 function)
8696
{
8797
struct rb_root *root;
@@ -665,20 +675,22 @@ static int optimal_reclaimed_pages(void)
665675
}
666676

667677
static int mlx5_reclaim_root_pages(struct mlx5_core_dev *dev,
668-
struct rb_root *root, u16 func_id)
678+
struct rb_root *root, u32 function)
669679
{
670680
u64 recl_pages_to_jiffies = msecs_to_jiffies(mlx5_tout_ms(dev, RECLAIM_PAGES));
671681
unsigned long end = jiffies + recl_pages_to_jiffies;
672682

673683
while (!RB_EMPTY_ROOT(root)) {
684+
u32 ec_function = mlx5_get_ec_function(function);
685+
u32 function_id = mlx5_get_func_id(function);
674686
int nclaimed;
675687
int err;
676688

677-
err = reclaim_pages(dev, func_id, optimal_reclaimed_pages(),
678-
&nclaimed, false, mlx5_core_is_ecpf(dev));
689+
err = reclaim_pages(dev, function_id, optimal_reclaimed_pages(),
690+
&nclaimed, false, ec_function);
679691
if (err) {
680-
mlx5_core_warn(dev, "failed reclaiming pages (%d) for func id 0x%x\n",
681-
err, func_id);
692+
mlx5_core_warn(dev, "reclaim_pages err (%d) func_id=0x%x ec_func=0x%x\n",
693+
err, function_id, ec_function);
682694
return err;
683695
}
684696

0 commit comments

Comments
 (0)