• Home
  • Raw
  • Download

Lines Matching refs:icm

79 void mlx4_free_icm(struct mlx4_dev *dev, struct mlx4_icm *icm, int coherent)  in mlx4_free_icm()  argument
83 if (!icm) in mlx4_free_icm()
86 list_for_each_entry_safe(chunk, tmp, &icm->chunk_list, list) { in mlx4_free_icm()
95 kfree(icm); in mlx4_free_icm()
135 struct mlx4_icm *icm; in mlx4_alloc_icm() local
144 icm = kmalloc_node(sizeof(*icm), in mlx4_alloc_icm()
147 if (!icm) { in mlx4_alloc_icm()
148 icm = kmalloc(sizeof(*icm), in mlx4_alloc_icm()
150 if (!icm) in mlx4_alloc_icm()
154 icm->refcount = 0; in mlx4_alloc_icm()
155 INIT_LIST_HEAD(&icm->chunk_list); in mlx4_alloc_icm()
176 list_add_tail(&chunk->list, &icm->chunk_list); in mlx4_alloc_icm()
229 return icm; in mlx4_alloc_icm()
232 mlx4_free_icm(dev, icm, coherent); in mlx4_alloc_icm()
236 static int mlx4_MAP_ICM(struct mlx4_dev *dev, struct mlx4_icm *icm, u64 virt) in mlx4_MAP_ICM() argument
238 return mlx4_map_cmd(dev, MLX4_CMD_MAP_ICM, icm, virt); in mlx4_MAP_ICM()
247 int mlx4_MAP_ICM_AUX(struct mlx4_dev *dev, struct mlx4_icm *icm) in mlx4_MAP_ICM_AUX() argument
249 return mlx4_map_cmd(dev, MLX4_CMD_MAP_ICM_AUX, icm, -1); in mlx4_MAP_ICM_AUX()
266 if (table->icm[i]) { in mlx4_table_get()
267 ++table->icm[i]->refcount; in mlx4_table_get()
271 table->icm[i] = mlx4_alloc_icm(dev, MLX4_TABLE_CHUNK_SIZE >> PAGE_SHIFT, in mlx4_table_get()
274 if (!table->icm[i]) { in mlx4_table_get()
279 if (mlx4_MAP_ICM(dev, table->icm[i], table->virt + in mlx4_table_get()
281 mlx4_free_icm(dev, table->icm[i], table->coherent); in mlx4_table_get()
282 table->icm[i] = NULL; in mlx4_table_get()
287 ++table->icm[i]->refcount; in mlx4_table_get()
303 if (--table->icm[i]->refcount == 0) { in mlx4_table_put()
307 mlx4_free_icm(dev, table->icm[i], table->coherent); in mlx4_table_put()
308 table->icm[i] = NULL; in mlx4_table_put()
320 struct mlx4_icm *icm; in mlx4_table_find() local
329 icm = table->icm[idx / MLX4_TABLE_CHUNK_SIZE]; in mlx4_table_find()
332 if (!icm) in mlx4_table_find()
335 list_for_each_entry(chunk, &icm->chunk_list, list) { in mlx4_table_find()
430 table->icm = kvcalloc(num_icm, sizeof(*table->icm), GFP_KERNEL); in mlx4_init_icm_table()
431 if (!table->icm) in mlx4_init_icm_table()
448 table->icm[i] = mlx4_alloc_icm(dev, chunk_size >> PAGE_SHIFT, in mlx4_init_icm_table()
451 if (!table->icm[i]) in mlx4_init_icm_table()
453 if (mlx4_MAP_ICM(dev, table->icm[i], virt + i * MLX4_TABLE_CHUNK_SIZE)) { in mlx4_init_icm_table()
454 mlx4_free_icm(dev, table->icm[i], use_coherent); in mlx4_init_icm_table()
455 table->icm[i] = NULL; in mlx4_init_icm_table()
463 ++table->icm[i]->refcount; in mlx4_init_icm_table()
470 if (table->icm[i]) { in mlx4_init_icm_table()
473 mlx4_free_icm(dev, table->icm[i], use_coherent); in mlx4_init_icm_table()
476 kvfree(table->icm); in mlx4_init_icm_table()
486 if (table->icm[i]) { in mlx4_cleanup_icm_table()
489 mlx4_free_icm(dev, table->icm[i], table->coherent); in mlx4_cleanup_icm_table()
492 kvfree(table->icm); in mlx4_cleanup_icm_table()