Skip to content

Commit 8605933

Browse files
haggaierolandd
authored andcommitted
IB/mlx5: Add MR to radix tree in reg_mr_callback
For memory regions that are allocated using reg_umr, the suffix of mlx5_core_create_mkey isn't being called. Instead the creation is completed in a callback function (reg_mr_callback). This means that these MRs aren't being added to the MR radix tree. Add them in the callback. Signed-off-by: Haggai Eran <[email protected]> Signed-off-by: Roland Dreier <[email protected]>
1 parent 096f7e7 commit 8605933

File tree

1 file changed

+9
-0
lines changed
  • drivers/infiniband/hw/mlx5

1 file changed

+9
-0
lines changed

drivers/infiniband/hw/mlx5/mr.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@ static void reg_mr_callback(int status, void *context)
7373
struct mlx5_cache_ent *ent = &cache->ent[c];
7474
u8 key;
7575
unsigned long flags;
76+
struct mlx5_mr_table *table = &dev->mdev.priv.mr_table;
77+
int err;
7678

7779
spin_lock_irqsave(&ent->lock, flags);
7880
ent->pending--;
@@ -107,6 +109,13 @@ static void reg_mr_callback(int status, void *context)
107109
ent->cur++;
108110
ent->size++;
109111
spin_unlock_irqrestore(&ent->lock, flags);
112+
113+
write_lock_irqsave(&table->lock, flags);
114+
err = radix_tree_insert(&table->tree, mlx5_base_mkey(mr->mmr.key),
115+
&mr->mmr);
116+
if (err)
117+
pr_err("Error inserting to mr tree. 0x%x\n", -err);
118+
write_unlock_irqrestore(&table->lock, flags);
110119
}
111120

112121
static int add_keys(struct mlx5_ib_dev *dev, int c, int num)

0 commit comments

Comments
 (0)