Lines Matching refs:bmap

63 			struct qed_bmap *bmap, u32 max_count, char *name)  in qed_rdma_bmap_alloc()  argument
67 bmap->max_count = max_count; in qed_rdma_bmap_alloc()
69 bmap->bitmap = kcalloc(BITS_TO_LONGS(max_count), sizeof(long), in qed_rdma_bmap_alloc()
71 if (!bmap->bitmap) in qed_rdma_bmap_alloc()
74 snprintf(bmap->name, QED_RDMA_MAX_BMAP_NAME, "%s", name); in qed_rdma_bmap_alloc()
81 struct qed_bmap *bmap, u32 *id_num) in qed_rdma_bmap_alloc_id() argument
83 *id_num = find_first_zero_bit(bmap->bitmap, bmap->max_count); in qed_rdma_bmap_alloc_id()
84 if (*id_num >= bmap->max_count) in qed_rdma_bmap_alloc_id()
87 __set_bit(*id_num, bmap->bitmap); in qed_rdma_bmap_alloc_id()
90 bmap->name, *id_num); in qed_rdma_bmap_alloc_id()
96 struct qed_bmap *bmap, u32 id_num) in qed_bmap_set_id() argument
98 if (id_num >= bmap->max_count) in qed_bmap_set_id()
101 __set_bit(id_num, bmap->bitmap); in qed_bmap_set_id()
105 struct qed_bmap *bmap, u32 id_num) in qed_bmap_release_id() argument
109 if (id_num >= bmap->max_count) in qed_bmap_release_id()
112 b_acquired = test_and_clear_bit(id_num, bmap->bitmap); in qed_bmap_release_id()
115 bmap->name, id_num); in qed_bmap_release_id()
120 bmap->name, id_num); in qed_bmap_release_id()
124 struct qed_bmap *bmap, u32 id_num) in qed_bmap_test_id() argument
126 if (id_num >= bmap->max_count) in qed_bmap_test_id()
129 return test_bit(id_num, bmap->bitmap); in qed_bmap_test_id()
132 static bool qed_bmap_is_empty(struct qed_bmap *bmap) in qed_bmap_is_empty() argument
134 return bmap->max_count == find_first_bit(bmap->bitmap, bmap->max_count); in qed_bmap_is_empty()
318 struct qed_bmap *bmap, bool check) in qed_rdma_bmap_free() argument
320 int weight = bitmap_weight(bmap->bitmap, bmap->max_count); in qed_rdma_bmap_free()
321 int last_line = bmap->max_count / (64 * 8); in qed_rdma_bmap_free()
323 DIV_ROUND_UP(bmap->max_count % (64 * 8), 64); in qed_rdma_bmap_free()
324 u64 *pmap = (u64 *)bmap->bitmap; in qed_rdma_bmap_free()
333 bmap->name, bmap->max_count, weight); in qed_rdma_bmap_free()
350 if ((bmap->max_count % (64 * 8)) && in qed_rdma_bmap_free()
352 bmap->max_count - item * 64))) { in qed_rdma_bmap_free()
361 kfree(bmap->bitmap); in qed_rdma_bmap_free()
362 bmap->bitmap = NULL; in qed_rdma_bmap_free()
1703 struct qed_bmap *bmap; in qed_rdma_destroy_srq() local
1726 bmap = &p_hwfn->p_rdma_info->srq_map; in qed_rdma_destroy_srq()
1729 qed_bmap_release_id(p_hwfn, bmap, in_params->srq_id); in qed_rdma_destroy_srq()
1749 struct qed_bmap *bmap; in qed_rdma_create_srq() local
1753 bmap = &p_hwfn->p_rdma_info->srq_map; in qed_rdma_create_srq()
1755 rc = qed_rdma_bmap_alloc_id(p_hwfn, bmap, &returned_id); in qed_rdma_create_srq()
1803 qed_bmap_release_id(p_hwfn, bmap, returned_id); in qed_rdma_create_srq()