提交 46620056 编写于 作者: M Michael S. Tsirkin 提交者: Roland Dreier

IB/mthca: create_eq with size not a power of 2

Fix mthca_create_eq for when the EQ size is not a power of 2.
Signed-off-by: NMichael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: NRoland Dreier <rolandd@cisco.com>
上级 38d1e793
...@@ -484,8 +484,7 @@ static int __devinit mthca_create_eq(struct mthca_dev *dev, ...@@ -484,8 +484,7 @@ static int __devinit mthca_create_eq(struct mthca_dev *dev,
u8 intr, u8 intr,
struct mthca_eq *eq) struct mthca_eq *eq)
{ {
int npages = (nent * MTHCA_EQ_ENTRY_SIZE + PAGE_SIZE - 1) / int npages;
PAGE_SIZE;
u64 *dma_list = NULL; u64 *dma_list = NULL;
dma_addr_t t; dma_addr_t t;
struct mthca_mailbox *mailbox; struct mthca_mailbox *mailbox;
...@@ -496,6 +495,7 @@ static int __devinit mthca_create_eq(struct mthca_dev *dev, ...@@ -496,6 +495,7 @@ static int __devinit mthca_create_eq(struct mthca_dev *dev,
eq->dev = dev; eq->dev = dev;
eq->nent = roundup_pow_of_two(max(nent, 2)); 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, eq->page_list = kmalloc(npages * sizeof *eq->page_list,
GFP_KERNEL); GFP_KERNEL);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册