Lines Matching refs:npages
69 dma_unmap_sg(&dev->pdev->dev, chunk->mem, chunk->npages, in mthca_free_icm_pages()
72 for (i = 0; i < chunk->npages; ++i) in mthca_free_icm_pages()
81 for (i = 0; i < chunk->npages; ++i) { in mthca_free_icm_coherent()
137 struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages, in mthca_alloc_icm() argument
157 while (npages > 0) { in mthca_alloc_icm()
165 chunk->npages = 0; in mthca_alloc_icm()
170 while (1 << cur_order > npages) in mthca_alloc_icm()
175 &chunk->mem[chunk->npages], in mthca_alloc_icm()
178 ret = mthca_alloc_icm_pages(&chunk->mem[chunk->npages], in mthca_alloc_icm()
182 ++chunk->npages; in mthca_alloc_icm()
186 else if (chunk->npages == MTHCA_ICM_CHUNK_LEN) { in mthca_alloc_icm()
189 chunk->npages, in mthca_alloc_icm()
196 if (chunk->npages == MTHCA_ICM_CHUNK_LEN) in mthca_alloc_icm()
199 npages -= 1 << cur_order; in mthca_alloc_icm()
209 chunk->npages, DMA_BIDIRECTIONAL); in mthca_alloc_icm()
298 for (i = 0; i < chunk->npages; ++i) { in mthca_table_find()
528 int npages; in mthca_init_user_db_tab() local
534 npages = dev->uar_table.uarc_size / MTHCA_ICM_PAGE_SIZE; in mthca_init_user_db_tab()
535 db_tab = kmalloc(struct_size(db_tab, page, npages), GFP_KERNEL); in mthca_init_user_db_tab()
540 for (i = 0; i < npages; ++i) { in mthca_init_user_db_tab()
593 start = dev->db_tab->npages - 1; in mthca_alloc_db()
716 dev->db_tab->npages = dev->uar_table.uarc_size / MTHCA_ICM_PAGE_SIZE; in mthca_init_db_tab()
718 dev->db_tab->min_group2 = dev->db_tab->npages - 1; in mthca_init_db_tab()
720 dev->db_tab->page = kmalloc_array(dev->db_tab->npages, in mthca_init_db_tab()
728 for (i = 0; i < dev->db_tab->npages; ++i) in mthca_init_db_tab()
747 for (i = 0; i < dev->db_tab->npages; ++i) { in mthca_cleanup_db_tab()