aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
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/infiniband
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/infiniband')
-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
3 files changed, 25 insertions, 14 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) |