aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-11 18:46:08 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-06-11 18:46:08 -0400
commit99f9f3d49cbc7d944476f6fde53a77ec789ab2aa (patch)
tree9b6fdfb39ca8a500e458dbd87dc6e1985d394564 /drivers
parent22353f35c895acb7a8ca27ebdc6397c993b4213e (diff)
parenta4cd7ed86ff511aebcc97675937039f2321d6987 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland/infiniband: IB/mlx4: Make sure RQ allocation is always valid RDMA/cma: Fix initialization of next_port IB/mlx4: Fix zeroing of rnr_retry value in ib_modify_qp() mlx4_core: Don't set MTT address in dMPT entries with PA set mlx4_core: Check firmware command interface revision IB/mthca, mlx4_core: Fix typo in comment mlx4_core: Free catastrophic error MSI-X interrupt with correct dev_id mlx4_core: Initialize ctx_list and ctx_lock earlier mlx4_core: Fix CQ context layout
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/core/cma.c4
-rw-r--r--drivers/infiniband/hw/mlx4/qp.c33
-rw-r--r--drivers/infiniband/hw/mthca/mthca_cmd.c2
-rw-r--r--drivers/net/mlx4/cq.c2
-rw-r--r--drivers/net/mlx4/eq.c4
-rw-r--r--drivers/net/mlx4/fw.c27
-rw-r--r--drivers/net/mlx4/intf.c3
-rw-r--r--drivers/net/mlx4/main.c2
-rw-r--r--drivers/net/mlx4/mr.c8
9 files changed, 60 insertions, 25 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 2eb52b7a71da..32a0e66d2a23 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2773,8 +2773,8 @@ static int cma_init(void)
2773 int ret; 2773 int ret;
2774 2774
2775 get_random_bytes(&next_port, sizeof next_port); 2775 get_random_bytes(&next_port, sizeof next_port);
2776 next_port = (next_port % (sysctl_local_port_range[1] - 2776 next_port = ((unsigned int) next_port %
2777 sysctl_local_port_range[0])) + 2777 (sysctl_local_port_range[1] - sysctl_local_port_range[0])) +
2778 sysctl_local_port_range[0]; 2778 sysctl_local_port_range[0];
2779 cma_wq = create_singlethread_workqueue("rdma_cm"); 2779 cma_wq = create_singlethread_workqueue("rdma_cm");
2780 if (!cma_wq) 2780 if (!cma_wq)
diff --git a/drivers/infiniband/hw/mlx4/qp.c b/drivers/infiniband/hw/mlx4/qp.c
index dc137dec2308..5c6d05427a0f 100644
--- a/drivers/infiniband/hw/mlx4/qp.c
+++ b/drivers/infiniband/hw/mlx4/qp.c
@@ -189,18 +189,28 @@ static int send_wqe_overhead(enum ib_qp_type type)
189} 189}
190 190
191static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap, 191static int set_rq_size(struct mlx4_ib_dev *dev, struct ib_qp_cap *cap,
192 struct mlx4_ib_qp *qp) 192 int is_user, int has_srq, struct mlx4_ib_qp *qp)
193{ 193{
194 /* Sanity check RQ size before proceeding */ 194 /* Sanity check RQ size before proceeding */
195 if (cap->max_recv_wr > dev->dev->caps.max_wqes || 195 if (cap->max_recv_wr > dev->dev->caps.max_wqes ||
196 cap->max_recv_sge > dev->dev->caps.max_rq_sg) 196 cap->max_recv_sge > dev->dev->caps.max_rq_sg)
197 return -EINVAL; 197 return -EINVAL;
198 198
199 qp->rq.max = cap->max_recv_wr ? roundup_pow_of_two(cap->max_recv_wr) : 0; 199 if (has_srq) {
200 /* QPs attached to an SRQ should have no RQ */
201 if (cap->max_recv_wr)
202 return -EINVAL;
203
204 qp->rq.max = qp->rq.max_gs = 0;
205 } else {
206 /* HW requires >= 1 RQ entry with >= 1 gather entry */
207 if (is_user && (!cap->max_recv_wr || !cap->max_recv_sge))
208 return -EINVAL;
200 209
201 qp->rq.wqe_shift = ilog2(roundup_pow_of_two(cap->max_recv_sge * 210 qp->rq.max = roundup_pow_of_two(max(1, cap->max_recv_wr));
202 sizeof (struct mlx4_wqe_data_seg))); 211 qp->rq.max_gs = roundup_pow_of_two(max(1, cap->max_recv_sge));
203 qp->rq.max_gs = (1 << qp->rq.wqe_shift) / sizeof (struct mlx4_wqe_data_seg); 212 qp->rq.wqe_shift = ilog2(qp->rq.max_gs * sizeof (struct mlx4_wqe_data_seg));
213 }
204 214
205 cap->max_recv_wr = qp->rq.max; 215 cap->max_recv_wr = qp->rq.max;
206 cap->max_recv_sge = qp->rq.max_gs; 216 cap->max_recv_sge = qp->rq.max_gs;
@@ -285,7 +295,7 @@ static int create_qp_common(struct mlx4_ib_dev *dev, struct ib_pd *pd,
285 qp->sq.head = 0; 295 qp->sq.head = 0;
286 qp->sq.tail = 0; 296 qp->sq.tail = 0;
287 297
288 err = set_rq_size(dev, &init_attr->cap, qp); 298 err = set_rq_size(dev, &init_attr->cap, !!pd->uobject, !!init_attr->srq, qp);
289 if (err) 299 if (err)
290 goto err; 300 goto err;
291 301
@@ -762,11 +772,6 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
762 optpar |= MLX4_QP_OPTPAR_PKEY_INDEX; 772 optpar |= MLX4_QP_OPTPAR_PKEY_INDEX;
763 } 773 }
764 774
765 if (attr_mask & IB_QP_RNR_RETRY) {
766 context->params1 |= cpu_to_be32(attr->rnr_retry << 13);
767 optpar |= MLX4_QP_OPTPAR_RNR_RETRY;
768 }
769
770 if (attr_mask & IB_QP_AV) { 775 if (attr_mask & IB_QP_AV) {
771 if (mlx4_set_path(dev, &attr->ah_attr, &context->pri_path, 776 if (mlx4_set_path(dev, &attr->ah_attr, &context->pri_path,
772 attr_mask & IB_QP_PORT ? attr->port_num : qp->port)) { 777 attr_mask & IB_QP_PORT ? attr->port_num : qp->port)) {
@@ -802,6 +807,12 @@ static int __mlx4_ib_modify_qp(struct ib_qp *ibqp,
802 807
803 context->pd = cpu_to_be32(to_mpd(ibqp->pd)->pdn); 808 context->pd = cpu_to_be32(to_mpd(ibqp->pd)->pdn);
804 context->params1 = cpu_to_be32(MLX4_IB_ACK_REQ_FREQ << 28); 809 context->params1 = cpu_to_be32(MLX4_IB_ACK_REQ_FREQ << 28);
810
811 if (attr_mask & IB_QP_RNR_RETRY) {
812 context->params1 |= cpu_to_be32(attr->rnr_retry << 13);
813 optpar |= MLX4_QP_OPTPAR_RNR_RETRY;
814 }
815
805 if (attr_mask & IB_QP_RETRY_CNT) { 816 if (attr_mask & IB_QP_RETRY_CNT) {
806 context->params1 |= cpu_to_be32(attr->retry_cnt << 16); 817 context->params1 |= cpu_to_be32(attr->retry_cnt << 16);
807 optpar |= MLX4_QP_OPTPAR_RETRY_COUNT; 818 optpar |= MLX4_QP_OPTPAR_RETRY_COUNT;
diff --git a/drivers/infiniband/hw/mthca/mthca_cmd.c b/drivers/infiniband/hw/mthca/mthca_cmd.c
index 38102520ffb3..f40558d76475 100644
--- a/drivers/infiniband/hw/mthca/mthca_cmd.c
+++ b/drivers/infiniband/hw/mthca/mthca_cmd.c
@@ -772,7 +772,7 @@ int mthca_QUERY_FW(struct mthca_dev *dev, u8 *status)
772 772
773 MTHCA_GET(dev->fw_ver, outbox, QUERY_FW_VER_OFFSET); 773 MTHCA_GET(dev->fw_ver, outbox, QUERY_FW_VER_OFFSET);
774 /* 774 /*
775 * FW subminor version is at more signifant bits than minor 775 * FW subminor version is at more significant bits than minor
776 * version, so swap here. 776 * version, so swap here.
777 */ 777 */
778 dev->fw_ver = (dev->fw_ver & 0xffff00000000ull) | 778 dev->fw_ver = (dev->fw_ver & 0xffff00000000ull) |
diff --git a/drivers/net/mlx4/cq.c b/drivers/net/mlx4/cq.c
index 437d78ad0912..39253d0c1590 100644
--- a/drivers/net/mlx4/cq.c
+++ b/drivers/net/mlx4/cq.c
@@ -61,7 +61,7 @@ struct mlx4_cq_context {
61 __be32 solicit_producer_index; 61 __be32 solicit_producer_index;
62 __be32 consumer_index; 62 __be32 consumer_index;
63 __be32 producer_index; 63 __be32 producer_index;
64 u8 reserved6[2]; 64 u32 reserved6[2];
65 __be64 db_rec_addr; 65 __be64 db_rec_addr;
66}; 66};
67 67
diff --git a/drivers/net/mlx4/eq.c b/drivers/net/mlx4/eq.c
index 0f11adb8eb4a..27a82cecd693 100644
--- a/drivers/net/mlx4/eq.c
+++ b/drivers/net/mlx4/eq.c
@@ -490,9 +490,11 @@ static void mlx4_free_irqs(struct mlx4_dev *dev)
490 490
491 if (eq_table->have_irq) 491 if (eq_table->have_irq)
492 free_irq(dev->pdev->irq, dev); 492 free_irq(dev->pdev->irq, dev);
493 for (i = 0; i < MLX4_NUM_EQ; ++i) 493 for (i = 0; i < MLX4_EQ_CATAS; ++i)
494 if (eq_table->eq[i].have_irq) 494 if (eq_table->eq[i].have_irq)
495 free_irq(eq_table->eq[i].irq, eq_table->eq + i); 495 free_irq(eq_table->eq[i].irq, eq_table->eq + i);
496 if (eq_table->eq[MLX4_EQ_CATAS].have_irq)
497 free_irq(eq_table->eq[MLX4_EQ_CATAS].irq, dev);
496} 498}
497 499
498static int __devinit mlx4_map_clr_int(struct mlx4_dev *dev) 500static int __devinit mlx4_map_clr_int(struct mlx4_dev *dev)
diff --git a/drivers/net/mlx4/fw.c b/drivers/net/mlx4/fw.c
index cfa5cc072339..e7ca118c8dfd 100644
--- a/drivers/net/mlx4/fw.c
+++ b/drivers/net/mlx4/fw.c
@@ -37,6 +37,10 @@
37#include "fw.h" 37#include "fw.h"
38#include "icm.h" 38#include "icm.h"
39 39
40enum {
41 MLX4_COMMAND_INTERFACE_REV = 1
42};
43
40extern void __buggy_use_of_MLX4_GET(void); 44extern void __buggy_use_of_MLX4_GET(void);
41extern void __buggy_use_of_MLX4_PUT(void); 45extern void __buggy_use_of_MLX4_PUT(void);
42 46
@@ -452,10 +456,12 @@ int mlx4_QUERY_FW(struct mlx4_dev *dev)
452 u32 *outbox; 456 u32 *outbox;
453 int err = 0; 457 int err = 0;
454 u64 fw_ver; 458 u64 fw_ver;
459 u16 cmd_if_rev;
455 u8 lg; 460 u8 lg;
456 461
457#define QUERY_FW_OUT_SIZE 0x100 462#define QUERY_FW_OUT_SIZE 0x100
458#define QUERY_FW_VER_OFFSET 0x00 463#define QUERY_FW_VER_OFFSET 0x00
464#define QUERY_FW_CMD_IF_REV_OFFSET 0x0a
459#define QUERY_FW_MAX_CMD_OFFSET 0x0f 465#define QUERY_FW_MAX_CMD_OFFSET 0x0f
460#define QUERY_FW_ERR_START_OFFSET 0x30 466#define QUERY_FW_ERR_START_OFFSET 0x30
461#define QUERY_FW_ERR_SIZE_OFFSET 0x38 467#define QUERY_FW_ERR_SIZE_OFFSET 0x38
@@ -477,21 +483,36 @@ int mlx4_QUERY_FW(struct mlx4_dev *dev)
477 483
478 MLX4_GET(fw_ver, outbox, QUERY_FW_VER_OFFSET); 484 MLX4_GET(fw_ver, outbox, QUERY_FW_VER_OFFSET);
479 /* 485 /*
480 * FW subminor version is at more signifant bits than minor 486 * FW subminor version is at more significant bits than minor
481 * version, so swap here. 487 * version, so swap here.
482 */ 488 */
483 dev->caps.fw_ver = (fw_ver & 0xffff00000000ull) | 489 dev->caps.fw_ver = (fw_ver & 0xffff00000000ull) |
484 ((fw_ver & 0xffff0000ull) >> 16) | 490 ((fw_ver & 0xffff0000ull) >> 16) |
485 ((fw_ver & 0x0000ffffull) << 16); 491 ((fw_ver & 0x0000ffffull) << 16);
486 492
493 MLX4_GET(cmd_if_rev, outbox, QUERY_FW_CMD_IF_REV_OFFSET);
494 if (cmd_if_rev != MLX4_COMMAND_INTERFACE_REV) {
495 mlx4_err(dev, "Installed FW has unsupported "
496 "command interface revision %d.\n",
497 cmd_if_rev);
498 mlx4_err(dev, "(Installed FW version is %d.%d.%03d)\n",
499 (int) (dev->caps.fw_ver >> 32),
500 (int) (dev->caps.fw_ver >> 16) & 0xffff,
501 (int) dev->caps.fw_ver & 0xffff);
502 mlx4_err(dev, "This driver version supports only revision %d.\n",
503 MLX4_COMMAND_INTERFACE_REV);
504 err = -ENODEV;
505 goto out;
506 }
507
487 MLX4_GET(lg, outbox, QUERY_FW_MAX_CMD_OFFSET); 508 MLX4_GET(lg, outbox, QUERY_FW_MAX_CMD_OFFSET);
488 cmd->max_cmds = 1 << lg; 509 cmd->max_cmds = 1 << lg;
489 510
490 mlx4_dbg(dev, "FW version %d.%d.%03d, max commands %d\n", 511 mlx4_dbg(dev, "FW version %d.%d.%03d (cmd intf rev %d), max commands %d\n",
491 (int) (dev->caps.fw_ver >> 32), 512 (int) (dev->caps.fw_ver >> 32),
492 (int) (dev->caps.fw_ver >> 16) & 0xffff, 513 (int) (dev->caps.fw_ver >> 16) & 0xffff,
493 (int) dev->caps.fw_ver & 0xffff, 514 (int) dev->caps.fw_ver & 0xffff,
494 cmd->max_cmds); 515 cmd_if_rev, cmd->max_cmds);
495 516
496 MLX4_GET(fw->catas_offset, outbox, QUERY_FW_ERR_START_OFFSET); 517 MLX4_GET(fw->catas_offset, outbox, QUERY_FW_ERR_START_OFFSET);
497 MLX4_GET(fw->catas_size, outbox, QUERY_FW_ERR_SIZE_OFFSET); 518 MLX4_GET(fw->catas_size, outbox, QUERY_FW_ERR_SIZE_OFFSET);
diff --git a/drivers/net/mlx4/intf.c b/drivers/net/mlx4/intf.c
index 65854f9e9c76..9ae951bf6aa6 100644
--- a/drivers/net/mlx4/intf.c
+++ b/drivers/net/mlx4/intf.c
@@ -135,9 +135,6 @@ int mlx4_register_device(struct mlx4_dev *dev)
135 struct mlx4_priv *priv = mlx4_priv(dev); 135 struct mlx4_priv *priv = mlx4_priv(dev);
136 struct mlx4_interface *intf; 136 struct mlx4_interface *intf;
137 137
138 INIT_LIST_HEAD(&priv->ctx_list);
139 spin_lock_init(&priv->ctx_lock);
140
141 mutex_lock(&intf_mutex); 138 mutex_lock(&intf_mutex);
142 139
143 list_add_tail(&priv->dev_list, &dev_list); 140 list_add_tail(&priv->dev_list, &dev_list);
diff --git a/drivers/net/mlx4/main.c b/drivers/net/mlx4/main.c
index 20b8c0d3ced4..d4172937025b 100644
--- a/drivers/net/mlx4/main.c
+++ b/drivers/net/mlx4/main.c
@@ -787,6 +787,8 @@ static int __devinit mlx4_init_one(struct pci_dev *pdev,
787 787
788 dev = &priv->dev; 788 dev = &priv->dev;
789 dev->pdev = pdev; 789 dev->pdev = pdev;
790 INIT_LIST_HEAD(&priv->ctx_list);
791 spin_lock_init(&priv->ctx_lock);
790 792
791 /* 793 /*
792 * Now reset the HCA before we touch the PCI capabilities or 794 * Now reset the HCA before we touch the PCI capabilities or
diff --git a/drivers/net/mlx4/mr.c b/drivers/net/mlx4/mr.c
index b33864dab179..d0808fa3ec82 100644
--- a/drivers/net/mlx4/mr.c
+++ b/drivers/net/mlx4/mr.c
@@ -324,15 +324,17 @@ int mlx4_mr_enable(struct mlx4_dev *dev, struct mlx4_mr *mr)
324 MLX4_MPT_FLAG_MIO | 324 MLX4_MPT_FLAG_MIO |
325 MLX4_MPT_FLAG_REGION | 325 MLX4_MPT_FLAG_REGION |
326 mr->access); 326 mr->access);
327 if (mr->mtt.order < 0)
328 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL);
329 327
330 mpt_entry->key = cpu_to_be32(key_to_hw_index(mr->key)); 328 mpt_entry->key = cpu_to_be32(key_to_hw_index(mr->key));
331 mpt_entry->pd = cpu_to_be32(mr->pd); 329 mpt_entry->pd = cpu_to_be32(mr->pd);
332 mpt_entry->start = cpu_to_be64(mr->iova); 330 mpt_entry->start = cpu_to_be64(mr->iova);
333 mpt_entry->length = cpu_to_be64(mr->size); 331 mpt_entry->length = cpu_to_be64(mr->size);
334 mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift); 332 mpt_entry->entity_size = cpu_to_be32(mr->mtt.page_shift);
335 mpt_entry->mtt_seg = cpu_to_be64(mlx4_mtt_addr(dev, &mr->mtt)); 333 if (mr->mtt.order < 0) {
334 mpt_entry->flags |= cpu_to_be32(MLX4_MPT_FLAG_PHYSICAL);
335 mpt_entry->mtt_seg = 0;
336 } else
337 mpt_entry->mtt_seg = cpu_to_be64(mlx4_mtt_addr(dev, &mr->mtt));
336 338
337 err = mlx4_SW2HW_MPT(dev, mailbox, 339 err = mlx4_SW2HW_MPT(dev, mailbox,
338 key_to_hw_index(mr->key) & (dev->caps.num_mpts - 1)); 340 key_to_hw_index(mr->key) & (dev->caps.num_mpts - 1));