IB/mthca: fix WQE size calculation in create-srq
PATCH 1/4 IB/mthca: fix WQE size calculation in create-srq
Thinko: 64 bytes is the minimum SRQ WQE size (not the maximum).
Signed-off-by Jack Morgenstein <[email protected]>
Signed-off-by Roland Dreier <[email protected]>
---
drivers/infiniband/hw/mthca/mthca_srq.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
1d7d2f6f476cf7aa65f9f740a6c932fb75608110
drivers/infiniband/hw/mthca/mthca_srq.c +1 -1
@@ -201,7 +201,7 @@ int mthca_alloc_srq(struct mthca_dev *deif (mthca_is_memfree (dev)) srq->max =roundup_pow_of_two (srq->max +1 ); - ds =min (64UL , + ds =max (64UL ,roundup_pow_of_two (sizeof (struct mthca_next_seg ) + srq->max_gs *sizeof (struct mthca_data_seg ))); srq->wqe_shift =long_log2 (ds);
Signature · 1 line
0.99.9n
PATCH 2/4 IB/mthca: check return value in mthca_dev_lim call
Check error return on call to mthca_dev_lim for Tavor (as is done for memfree).
Signed-off-by Jack Morgenstein <[email protected]>
Signed-off-by Roland Dreier <[email protected]>
---
drivers/infiniband/hw/mthca/mthca_main.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
aa2f9367790ad81ef51d3f667124227ca3003d3b
drivers/infiniband/hw/mthca/mthca_main.c +4 -0
@@ -261,6 +261,10 @@ static int __devinit mthca_init_tavor(st } err =mthca_dev_lim (mdev, &dev_lim); +if (err) { +mthca_err (mdev,"QUERY_DEV_LIM command failed, aborting.\n" ); + goto err_disable; + } profile = default_profile; profile.num_uar = dev_lim.uar_size /PAGE_SIZE ;
Signature · 1 line
0.99.9n
PATCH 3/4 IB/mthca: check port validity in modify_qp
Modify_qp should check that the physical port number provided is a legal value.
Signed-off-by Jack Morgenstein <[email protected]>
Signed-off-by Roland Dreier <[email protected]>
---
drivers/infiniband/hw/mthca/mthca_qp.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
38d1e793471d95728219f500bbb8bd25658d73b0
drivers/infiniband/hw/mthca/mthca_qp.c +6 -0
@@ -621,6 +621,12 @@ int mthca_modify_qp(struct ib_qp *ibqp,return -EINVAL ; } +if ((attr_mask &IB_QP_PORT ) && + (attr->port_num ==0 || attr->port_num > dev->limits.num_ports)) { +mthca_dbg (dev,"Port number (%u) is invalid\n" , attr->port_num); +return -EINVAL ; + } +if (attr_mask &IB_QP_MAX_QP_RD_ATOMIC && attr->max_rd_atomic > dev->limits.max_qp_init_rdma) { mthca_dbg(dev, "Max rdma_atomic as initiator %u too large (max is %d)\n",
Signature · 1 line
0.99.9n
PATCH 4/4 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 Michael S. Tsirkin <[email protected]>
Signed-off-by Roland Dreier <[email protected]>
---
drivers/infiniband/hw/mthca/mthca_eq.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
466200562ccd80f728f7ef602d2b97b4fdedd566
drivers/infiniband/hw/mthca/mthca_eq.c +2 -2
@@ -484,8 +484,7 @@ static int __devinit mthca_create_eq(stru8 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 +495,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 );
Signature · 1 line
0.99.9n