Skip to contentSkip to conversation

IB/mthca: fix WQE size calculation in create-srq

PATCH New Roland Dreier 1 participant 4 messages Jan 6, 2006 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/4 IB/mthca: fix WQE size calculation in create-srq

Thinko: 64 bytes is the minimum SRQ WQE size (not the maximum).

---

 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
index f7d2342..e7e153d 100644
@@ -201,7 +201,7 @@ int mthca_alloc_srq(struct mthca_dev *de
 	if (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
#1 lore raw

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).

---

 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
index 6f94b25..8b00d9a 100644
@@ -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
#2 lore raw

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.

---

 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
index d786ef4..ea45fa4 100644
@@ -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
#3 lore raw

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.

---

 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
index 34d68e5..e8a948f 100644
@@ -484,8 +484,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 +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