Lines Matching refs:bf
172 int mlx4_bf_alloc(struct mlx4_dev *dev, struct mlx4_bf *bf, int node) in mlx4_bf_alloc() argument
221 bf->uar = uar; in mlx4_bf_alloc()
222 bf->offset = 0; in mlx4_bf_alloc()
223 bf->buf_size = dev->caps.bf_reg_size / 2; in mlx4_bf_alloc()
224 bf->reg = uar->bf_map + idx * dev->caps.bf_reg_size; in mlx4_bf_alloc()
231 bf->uar = NULL; in mlx4_bf_alloc()
246 void mlx4_bf_free(struct mlx4_dev *dev, struct mlx4_bf *bf) in mlx4_bf_free() argument
251 if (!bf->uar || !bf->uar->bf_map) in mlx4_bf_free()
255 idx = (bf->reg - bf->uar->bf_map) / dev->caps.bf_reg_size; in mlx4_bf_free()
256 bf->uar->free_bf_bmap &= ~(1 << idx); in mlx4_bf_free()
257 if (!bf->uar->free_bf_bmap) { in mlx4_bf_free()
258 if (!list_empty(&bf->uar->bf_list)) in mlx4_bf_free()
259 list_del(&bf->uar->bf_list); in mlx4_bf_free()
261 io_mapping_unmap(bf->uar->bf_map); in mlx4_bf_free()
262 iounmap(bf->uar->map); in mlx4_bf_free()
263 mlx4_uar_free(dev, bf->uar); in mlx4_bf_free()
264 kfree(bf->uar); in mlx4_bf_free()
265 } else if (list_empty(&bf->uar->bf_list)) in mlx4_bf_free()
266 list_add(&bf->uar->bf_list, &priv->bf_list); in mlx4_bf_free()