[openib-general] [PATCH] mthca: create_eq with size not a pow of 2

Michael S. Tsirkin mst at mellanox.co.il
Thu Jan 5 08:29:46 PST 2006


Fix mthca_create_eq for when the EQ size is not a power of 2.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

Index: linux-2.6.14.3-kgdb/drivers/infiniband/hw/mthca/mthca_eq.c
===================================================================
--- linux-2.6.14.3-kgdb.orig/drivers/infiniband/hw/mthca/mthca_eq.c	2006-01-05 14:10:13.000000000 +0200
+++ linux-2.6.14.3-kgdb/drivers/infiniband/hw/mthca/mthca_eq.c	2006-01-05 15:12:57.000000000 +0200
@@ -484,8 +483,7 @@ static int __devinit mthca_create_eq(str
 				     u8 intr,
 				     struct mthca_eq *eq)
 {
-	int npages = (nent * MTHCA_EQ_ENTRY_SIZE + PAGE_SIZE - 1) /
-		PAGE_SIZE;
+	int npages;
 	u64 *dma_list = NULL;
 	dma_addr_t t;
 	struct mthca_mailbox *mailbox;
@@ -496,6 +494,7 @@ static int __devinit mthca_create_eq(str
 
 	eq->dev  = dev;
 	eq->nent = roundup_pow_of_two(max(nent, 2));
+ 	npages = ALIGN(eq->nent * MTHCA_EQ_ENTRY_SIZE, PAGE_SIZE) / PAGE_SIZE;
 
 	eq->page_list = kmalloc(npages * sizeof *eq->page_list,
 				GFP_KERNEL);

-- 
MST



More information about the general mailing list