Lines Matching refs:pgdir
48 struct mlx4_ib_db_pgdir *pgdir;
50 pgdir = kzalloc(sizeof *pgdir, GFP_KERNEL);
51 if (!pgdir)
54 bitmap_fill(pgdir->order1, MLX4_IB_DB_PER_PAGE / 2);
55 pgdir->bits[0] = pgdir->order0;
56 pgdir->bits[1] = pgdir->order1;
57 pgdir->db_page = dma_alloc_coherent(dev->ib_dev.dma_device,
58 PAGE_SIZE, &pgdir->db_dma,
60 if (!pgdir->db_page) {
61 kfree(pgdir);
65 return pgdir;
68 static int mlx4_ib_alloc_db_from_pgdir(struct mlx4_ib_db_pgdir *pgdir,
75 i = find_first_bit(pgdir->bits[o], MLX4_IB_DB_PER_PAGE >> o);
83 clear_bit(i, pgdir->bits[o]);
88 set_bit(i ^ 1, pgdir->bits[order]);
90 db->u.pgdir = pgdir;
92 db->db = pgdir->db_page + db->index;
93 db->dma = pgdir->db_dma + db->index * 4;
101 struct mlx4_ib_db_pgdir *pgdir;
106 list_for_each_entry(pgdir, &dev->pgdir_list, list)
107 if (!mlx4_ib_alloc_db_from_pgdir(pgdir, db, order))
110 pgdir = mlx4_ib_alloc_db_pgdir(dev);
111 if (!pgdir) {
116 list_add(&pgdir->list, &dev->pgdir_list);
119 WARN_ON(mlx4_ib_alloc_db_from_pgdir(pgdir, db, order));
137 if (db->order == 0 && test_bit(i ^ 1, db->u.pgdir->order0)) {
138 clear_bit(i ^ 1, db->u.pgdir->order0);
143 set_bit(i, db->u.pgdir->bits[o]);
145 if (bitmap_full(db->u.pgdir->order1, MLX4_IB_DB_PER_PAGE / 2)) {
147 db->u.pgdir->db_page, db->u.pgdir->db_dma);
148 list_del(&db->u.pgdir->list);
149 kfree(db->u.pgdir);