aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2005-11-04 19:31:54 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-04 19:31:54 -0500
commitba77df570c6710c9c19b31e0e48e4bcdf31cefe8 (patch)
tree997c210135b5578982df256dd5a0140e04d972d1 /drivers/infiniband/hw
parent602d4a7e2f4b843d1a67375d4d7104073495b758 (diff)
parentd09e32764176b61c4afee9fd5e7fe04713bfa56f (diff)
Merge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband
Diffstat (limited to 'drivers/infiniband/hw')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cq.c31
-rw-r--r--drivers/infiniband/hw/mthca/mthca_dev.h4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_eq.c4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_main.c2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_mr.c4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_profile.c4
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c2
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c7
-rw-r--r--drivers/infiniband/hw/mthca/mthca_srq.c13
9 files changed, 54 insertions, 17 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c
index 8600b6c3e0c2..f98e23555826 100644
--- a/drivers/infiniband/hw/mthca/mthca_cq.c
+++ b/drivers/infiniband/hw/mthca/mthca_cq.c
@@ -208,7 +208,7 @@ static inline void update_cons_index(struct mthca_dev *dev, struct mthca_cq *cq,
208 } 208 }
209} 209}
210 210
211void mthca_cq_event(struct mthca_dev *dev, u32 cqn) 211void mthca_cq_completion(struct mthca_dev *dev, u32 cqn)
212{ 212{
213 struct mthca_cq *cq; 213 struct mthca_cq *cq;
214 214
@@ -224,6 +224,35 @@ void mthca_cq_event(struct mthca_dev *dev, u32 cqn)
224 cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context); 224 cq->ibcq.comp_handler(&cq->ibcq, cq->ibcq.cq_context);
225} 225}
226 226
227void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
228 enum ib_event_type event_type)
229{
230 struct mthca_cq *cq;
231 struct ib_event event;
232
233 spin_lock(&dev->cq_table.lock);
234
235 cq = mthca_array_get(&dev->cq_table.cq, cqn & (dev->limits.num_cqs - 1));
236
237 if (cq)
238 atomic_inc(&cq->refcount);
239 spin_unlock(&dev->cq_table.lock);
240
241 if (!cq) {
242 mthca_warn(dev, "Async event for bogus CQ %08x\n", cqn);
243 return;
244 }
245
246 event.device = &dev->ib_dev;
247 event.event = event_type;
248 event.element.cq = &cq->ibcq;
249 if (cq->ibcq.event_handler)
250 cq->ibcq.event_handler(&event, cq->ibcq.cq_context);
251
252 if (atomic_dec_and_test(&cq->refcount))
253 wake_up(&cq->wait);
254}
255
227void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, 256void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn,
228 struct mthca_srq *srq) 257 struct mthca_srq *srq)
229{ 258{
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h
index 7e68bd4a3780..e7e5d3b4f004 100644
--- a/drivers/infiniband/hw/mthca/mthca_dev.h
+++ b/drivers/infiniband/hw/mthca/mthca_dev.h
@@ -460,7 +460,9 @@ int mthca_init_cq(struct mthca_dev *dev, int nent,
460 struct mthca_cq *cq); 460 struct mthca_cq *cq);
461void mthca_free_cq(struct mthca_dev *dev, 461void mthca_free_cq(struct mthca_dev *dev,
462 struct mthca_cq *cq); 462 struct mthca_cq *cq);
463void mthca_cq_event(struct mthca_dev *dev, u32 cqn); 463void mthca_cq_completion(struct mthca_dev *dev, u32 cqn);
464void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
465 enum ib_event_type event_type);
464void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn, 466void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn,
465 struct mthca_srq *srq); 467 struct mthca_srq *srq);
466 468
diff --git a/drivers/infiniband/hw/mthca/mthca_eq.c b/drivers/infiniband/hw/mthca/mthca_eq.c
index e5a047a6dbeb..34d68e5a72d8 100644
--- a/drivers/infiniband/hw/mthca/mthca_eq.c
+++ b/drivers/infiniband/hw/mthca/mthca_eq.c
@@ -292,7 +292,7 @@ static int mthca_eq_int(struct mthca_dev *dev, struct mthca_eq *eq)
292 case MTHCA_EVENT_TYPE_COMP: 292 case MTHCA_EVENT_TYPE_COMP:
293 disarm_cqn = be32_to_cpu(eqe->event.comp.cqn) & 0xffffff; 293 disarm_cqn = be32_to_cpu(eqe->event.comp.cqn) & 0xffffff;
294 disarm_cq(dev, eq->eqn, disarm_cqn); 294 disarm_cq(dev, eq->eqn, disarm_cqn);
295 mthca_cq_event(dev, disarm_cqn); 295 mthca_cq_completion(dev, disarm_cqn);
296 break; 296 break;
297 297
298 case MTHCA_EVENT_TYPE_PATH_MIG: 298 case MTHCA_EVENT_TYPE_PATH_MIG:
@@ -364,6 +364,8 @@ static int mthca_eq_int(struct mthca_dev *dev, struct mthca_eq *eq)
364 eqe->event.cq_err.syndrome == 1 ? 364 eqe->event.cq_err.syndrome == 1 ?
365 "overrun" : "access violation", 365 "overrun" : "access violation",
366 be32_to_cpu(eqe->event.cq_err.cqn) & 0xffffff); 366 be32_to_cpu(eqe->event.cq_err.cqn) & 0xffffff);
367 mthca_cq_event(dev, be32_to_cpu(eqe->event.cq_err.cqn),
368 IB_EVENT_CQ_ERR);
367 break; 369 break;
368 370
369 case MTHCA_EVENT_TYPE_EQ_OVERFLOW: 371 case MTHCA_EVENT_TYPE_EQ_OVERFLOW:
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c
index 883d1e5a79bc..45c6328e780c 100644
--- a/drivers/infiniband/hw/mthca/mthca_main.c
+++ b/drivers/infiniband/hw/mthca/mthca_main.c
@@ -1057,7 +1057,7 @@ static int __devinit mthca_init_one(struct pci_dev *pdev,
1057 goto err_cmd; 1057 goto err_cmd;
1058 1058
1059 if (mdev->fw_ver < mthca_hca_table[id->driver_data].latest_fw) { 1059 if (mdev->fw_ver < mthca_hca_table[id->driver_data].latest_fw) {
1060 mthca_warn(mdev, "HCA FW version %x.%x.%x is old (%x.%x.%x is current).\n", 1060 mthca_warn(mdev, "HCA FW version %d.%d.%d is old (%d.%d.%d is current).\n",
1061 (int) (mdev->fw_ver >> 32), (int) (mdev->fw_ver >> 16) & 0xffff, 1061 (int) (mdev->fw_ver >> 32), (int) (mdev->fw_ver >> 16) & 0xffff,
1062 (int) (mdev->fw_ver & 0xffff), 1062 (int) (mdev->fw_ver & 0xffff),
1063 (int) (mthca_hca_table[id->driver_data].latest_fw >> 32), 1063 (int) (mthca_hca_table[id->driver_data].latest_fw >> 32),
diff --git a/drivers/infiniband/hw/mthca/mthca_mr.c b/drivers/infiniband/hw/mthca/mthca_mr.c
index 1f97a44477f5..e995e2aa016d 100644
--- a/drivers/infiniband/hw/mthca/mthca_mr.c
+++ b/drivers/infiniband/hw/mthca/mthca_mr.c
@@ -140,13 +140,11 @@ static int __devinit mthca_buddy_init(struct mthca_buddy *buddy, int max_order)
140 buddy->max_order = max_order; 140 buddy->max_order = max_order;
141 spin_lock_init(&buddy->lock); 141 spin_lock_init(&buddy->lock);
142 142
143 buddy->bits = kmalloc((buddy->max_order + 1) * sizeof (long *), 143 buddy->bits = kzalloc((buddy->max_order + 1) * sizeof (long *),
144 GFP_KERNEL); 144 GFP_KERNEL);
145 if (!buddy->bits) 145 if (!buddy->bits)
146 goto err_out; 146 goto err_out;
147 147
148 memset(buddy->bits, 0, (buddy->max_order + 1) * sizeof (long *));
149
150 for (i = 0; i <= buddy->max_order; ++i) { 148 for (i = 0; i <= buddy->max_order; ++i) {
151 s = BITS_TO_LONGS(1 << (buddy->max_order - i)); 149 s = BITS_TO_LONGS(1 << (buddy->max_order - i));
152 buddy->bits[i] = kmalloc(s * sizeof (long), GFP_KERNEL); 150 buddy->bits[i] = kmalloc(s * sizeof (long), GFP_KERNEL);
diff --git a/drivers/infiniband/hw/mthca/mthca_profile.c b/drivers/infiniband/hw/mthca/mthca_profile.c
index bd1338682074..08a909371b0a 100644
--- a/drivers/infiniband/hw/mthca/mthca_profile.c
+++ b/drivers/infiniband/hw/mthca/mthca_profile.c
@@ -82,12 +82,10 @@ u64 mthca_make_profile(struct mthca_dev *dev,
82 struct mthca_resource tmp; 82 struct mthca_resource tmp;
83 int i, j; 83 int i, j;
84 84
85 profile = kmalloc(MTHCA_RES_NUM * sizeof *profile, GFP_KERNEL); 85 profile = kzalloc(MTHCA_RES_NUM * sizeof *profile, GFP_KERNEL);
86 if (!profile) 86 if (!profile)
87 return -ENOMEM; 87 return -ENOMEM;
88 88
89 memset(profile, 0, MTHCA_RES_NUM * sizeof *profile);
90
91 profile[MTHCA_RES_QP].size = dev_lim->qpc_entry_sz; 89 profile[MTHCA_RES_QP].size = dev_lim->qpc_entry_sz;
92 profile[MTHCA_RES_EEC].size = dev_lim->eec_entry_sz; 90 profile[MTHCA_RES_EEC].size = dev_lim->eec_entry_sz;
93 profile[MTHCA_RES_SRQ].size = dev_lim->srq_entry_sz; 91 profile[MTHCA_RES_SRQ].size = dev_lim->srq_entry_sz;
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 1b9477edbd7b..6b0166668269 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -1028,7 +1028,7 @@ static ssize_t show_rev(struct class_device *cdev, char *buf)
1028static ssize_t show_fw_ver(struct class_device *cdev, char *buf) 1028static ssize_t show_fw_ver(struct class_device *cdev, char *buf)
1029{ 1029{
1030 struct mthca_dev *dev = container_of(cdev, struct mthca_dev, ib_dev.class_dev); 1030 struct mthca_dev *dev = container_of(cdev, struct mthca_dev, ib_dev.class_dev);
1031 return sprintf(buf, "%x.%x.%x\n", (int) (dev->fw_ver >> 32), 1031 return sprintf(buf, "%d.%d.%d\n", (int) (dev->fw_ver >> 32),
1032 (int) (dev->fw_ver >> 16) & 0xffff, 1032 (int) (dev->fw_ver >> 16) & 0xffff,
1033 (int) dev->fw_ver & 0xffff); 1033 (int) dev->fw_ver & 0xffff);
1034} 1034}
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index 7c9afde5ace5..8852ea477c21 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -584,6 +584,13 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask)
584 return -EINVAL; 584 return -EINVAL;
585 } 585 }
586 586
587 if ((attr_mask & IB_QP_PKEY_INDEX) &&
588 attr->pkey_index >= dev->limits.pkey_table_len) {
589 mthca_dbg(dev, "PKey index (%u) too large. max is %d\n",
590 attr->pkey_index,dev->limits.pkey_table_len-1);
591 return -EINVAL;
592 }
593
587 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); 594 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
588 if (IS_ERR(mailbox)) 595 if (IS_ERR(mailbox))
589 return PTR_ERR(mailbox); 596 return PTR_ERR(mailbox);
diff --git a/drivers/infiniband/hw/mthca/mthca_srq.c b/drivers/infiniband/hw/mthca/mthca_srq.c
index 64f70aa1b3c0..292f55be8cbd 100644
--- a/drivers/infiniband/hw/mthca/mthca_srq.c
+++ b/drivers/infiniband/hw/mthca/mthca_srq.c
@@ -75,15 +75,16 @@ static void *get_wqe(struct mthca_srq *srq, int n)
75 75
76/* 76/*
77 * Return a pointer to the location within a WQE that we're using as a 77 * Return a pointer to the location within a WQE that we're using as a
78 * link when the WQE is in the free list. We use an offset of 4 78 * link when the WQE is in the free list. We use the imm field
79 * because in the Tavor case, posting a WQE may overwrite the first 79 * because in the Tavor case, posting a WQE may overwrite the next
80 * four bytes of the previous WQE. The offset avoids corrupting our 80 * segment of the previous WQE, but a receive WQE will never touch the
81 * free list if the WQE has already completed and been put on the free 81 * imm field. This avoids corrupting our free list if the previous
82 * list when we post the next WQE. 82 * WQE has already completed and been put on the free list when we
83 * post the next WQE.
83 */ 84 */
84static inline int *wqe_to_link(void *wqe) 85static inline int *wqe_to_link(void *wqe)
85{ 86{
86 return (int *) (wqe + 4); 87 return (int *) (wqe + offsetof(struct mthca_next_seg, imm));
87} 88}
88 89
89static void mthca_tavor_init_srq_context(struct mthca_dev *dev, 90static void mthca_tavor_init_srq_context(struct mthca_dev *dev,