aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_qp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_qp.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_qp.c49
1 files changed, 15 insertions, 34 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c
index a34c9d38e822..9601049e14d0 100644
--- a/drivers/infiniband/hw/mthca/mthca_qp.c
+++ b/drivers/infiniband/hw/mthca/mthca_qp.c
@@ -308,7 +308,6 @@ static void store_attrs(struct mthca_sqp *sqp, const struct ib_qp_attr *attr,
308static void init_port(struct mthca_dev *dev, int port) 308static void init_port(struct mthca_dev *dev, int port)
309{ 309{
310 int err; 310 int err;
311 u8 status;
312 struct mthca_init_ib_param param; 311 struct mthca_init_ib_param param;
313 312
314 memset(&param, 0, sizeof param); 313 memset(&param, 0, sizeof param);
@@ -319,11 +318,9 @@ static void init_port(struct mthca_dev *dev, int port)
319 param.gid_cap = dev->limits.gid_table_len; 318 param.gid_cap = dev->limits.gid_table_len;
320 param.pkey_cap = dev->limits.pkey_table_len; 319 param.pkey_cap = dev->limits.pkey_table_len;
321 320
322 err = mthca_INIT_IB(dev, &param, port, &status); 321 err = mthca_INIT_IB(dev, &param, port);
323 if (err) 322 if (err)
324 mthca_warn(dev, "INIT_IB failed, return code %d.\n", err); 323 mthca_warn(dev, "INIT_IB failed, return code %d.\n", err);
325 if (status)
326 mthca_warn(dev, "INIT_IB returned status %02x.\n", status);
327} 324}
328 325
329static __be32 get_hw_access_flags(struct mthca_qp *qp, const struct ib_qp_attr *attr, 326static __be32 get_hw_access_flags(struct mthca_qp *qp, const struct ib_qp_attr *attr,
@@ -433,7 +430,6 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m
433 struct mthca_qp_param *qp_param; 430 struct mthca_qp_param *qp_param;
434 struct mthca_qp_context *context; 431 struct mthca_qp_context *context;
435 int mthca_state; 432 int mthca_state;
436 u8 status;
437 433
438 mutex_lock(&qp->mutex); 434 mutex_lock(&qp->mutex);
439 435
@@ -448,12 +444,9 @@ int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_m
448 goto out; 444 goto out;
449 } 445 }
450 446
451 err = mthca_QUERY_QP(dev, qp->qpn, 0, mailbox, &status); 447 err = mthca_QUERY_QP(dev, qp->qpn, 0, mailbox);
452 if (err) 448 if (err) {
453 goto out_mailbox; 449 mthca_warn(dev, "QUERY_QP failed (%d)\n", err);
454 if (status) {
455 mthca_warn(dev, "QUERY_QP returned status %02x\n", status);
456 err = -EINVAL;
457 goto out_mailbox; 450 goto out_mailbox;
458 } 451 }
459 452
@@ -555,7 +548,6 @@ static int __mthca_modify_qp(struct ib_qp *ibqp,
555 struct mthca_qp_param *qp_param; 548 struct mthca_qp_param *qp_param;
556 struct mthca_qp_context *qp_context; 549 struct mthca_qp_context *qp_context;
557 u32 sqd_event = 0; 550 u32 sqd_event = 0;
558 u8 status;
559 int err = -EINVAL; 551 int err = -EINVAL;
560 552
561 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL); 553 mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
@@ -781,13 +773,10 @@ static int __mthca_modify_qp(struct ib_qp *ibqp,
781 sqd_event = 1 << 31; 773 sqd_event = 1 << 31;
782 774
783 err = mthca_MODIFY_QP(dev, cur_state, new_state, qp->qpn, 0, 775 err = mthca_MODIFY_QP(dev, cur_state, new_state, qp->qpn, 0,
784 mailbox, sqd_event, &status); 776 mailbox, sqd_event);
785 if (err) 777 if (err) {
786 goto out_mailbox; 778 mthca_warn(dev, "modify QP %d->%d returned %d.\n",
787 if (status) { 779 cur_state, new_state, err);
788 mthca_warn(dev, "modify QP %d->%d returned status %02x.\n",
789 cur_state, new_state, status);
790 err = -EINVAL;
791 goto out_mailbox; 780 goto out_mailbox;
792 } 781 }
793 782
@@ -817,7 +806,7 @@ static int __mthca_modify_qp(struct ib_qp *ibqp,
817 cur_state != IB_QPS_ERR && 806 cur_state != IB_QPS_ERR &&
818 (new_state == IB_QPS_RESET || 807 (new_state == IB_QPS_RESET ||
819 new_state == IB_QPS_ERR)) 808 new_state == IB_QPS_ERR))
820 mthca_CLOSE_IB(dev, qp->port, &status); 809 mthca_CLOSE_IB(dev, qp->port);
821 } 810 }
822 811
823 /* 812 /*
@@ -1429,7 +1418,6 @@ static inline int get_qp_refcount(struct mthca_dev *dev, struct mthca_qp *qp)
1429void mthca_free_qp(struct mthca_dev *dev, 1418void mthca_free_qp(struct mthca_dev *dev,
1430 struct mthca_qp *qp) 1419 struct mthca_qp *qp)
1431{ 1420{
1432 u8 status;
1433 struct mthca_cq *send_cq; 1421 struct mthca_cq *send_cq;
1434 struct mthca_cq *recv_cq; 1422 struct mthca_cq *recv_cq;
1435 1423
@@ -1454,7 +1442,7 @@ void mthca_free_qp(struct mthca_dev *dev,
1454 1442
1455 if (qp->state != IB_QPS_RESET) 1443 if (qp->state != IB_QPS_RESET)
1456 mthca_MODIFY_QP(dev, qp->state, IB_QPS_RESET, qp->qpn, 0, 1444 mthca_MODIFY_QP(dev, qp->state, IB_QPS_RESET, qp->qpn, 0,
1457 NULL, 0, &status); 1445 NULL, 0);
1458 1446
1459 /* 1447 /*
1460 * If this is a userspace QP, the buffers, MR, CQs and so on 1448 * If this is a userspace QP, the buffers, MR, CQs and so on
@@ -2263,7 +2251,6 @@ void mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
2263int mthca_init_qp_table(struct mthca_dev *dev) 2251int mthca_init_qp_table(struct mthca_dev *dev)
2264{ 2252{
2265 int err; 2253 int err;
2266 u8 status;
2267 int i; 2254 int i;
2268 2255
2269 spin_lock_init(&dev->qp_table.lock); 2256 spin_lock_init(&dev->qp_table.lock);
@@ -2290,15 +2277,10 @@ int mthca_init_qp_table(struct mthca_dev *dev)
2290 2277
2291 for (i = 0; i < 2; ++i) { 2278 for (i = 0; i < 2; ++i) {
2292 err = mthca_CONF_SPECIAL_QP(dev, i ? IB_QPT_GSI : IB_QPT_SMI, 2279 err = mthca_CONF_SPECIAL_QP(dev, i ? IB_QPT_GSI : IB_QPT_SMI,
2293 dev->qp_table.sqp_start + i * 2, 2280 dev->qp_table.sqp_start + i * 2);
2294 &status); 2281 if (err) {
2295 if (err)
2296 goto err_out;
2297 if (status) {
2298 mthca_warn(dev, "CONF_SPECIAL_QP returned " 2282 mthca_warn(dev, "CONF_SPECIAL_QP returned "
2299 "status %02x, aborting.\n", 2283 "%d, aborting.\n", err);
2300 status);
2301 err = -EINVAL;
2302 goto err_out; 2284 goto err_out;
2303 } 2285 }
2304 } 2286 }
@@ -2306,7 +2288,7 @@ int mthca_init_qp_table(struct mthca_dev *dev)
2306 2288
2307 err_out: 2289 err_out:
2308 for (i = 0; i < 2; ++i) 2290 for (i = 0; i < 2; ++i)
2309 mthca_CONF_SPECIAL_QP(dev, i, 0, &status); 2291 mthca_CONF_SPECIAL_QP(dev, i, 0);
2310 2292
2311 mthca_array_cleanup(&dev->qp_table.qp, dev->limits.num_qps); 2293 mthca_array_cleanup(&dev->qp_table.qp, dev->limits.num_qps);
2312 mthca_alloc_cleanup(&dev->qp_table.alloc); 2294 mthca_alloc_cleanup(&dev->qp_table.alloc);
@@ -2317,10 +2299,9 @@ int mthca_init_qp_table(struct mthca_dev *dev)
2317void mthca_cleanup_qp_table(struct mthca_dev *dev) 2299void mthca_cleanup_qp_table(struct mthca_dev *dev)
2318{ 2300{
2319 int i; 2301 int i;
2320 u8 status;
2321 2302
2322 for (i = 0; i < 2; ++i) 2303 for (i = 0; i < 2; ++i)
2323 mthca_CONF_SPECIAL_QP(dev, i, 0, &status); 2304 mthca_CONF_SPECIAL_QP(dev, i, 0);
2324 2305
2325 mthca_array_cleanup(&dev->qp_table.qp, dev->limits.num_qps); 2306 mthca_array_cleanup(&dev->qp_table.qp, dev->limits.num_qps);
2326 mthca_alloc_cleanup(&dev->qp_table.alloc); 2307 mthca_alloc_cleanup(&dev->qp_table.alloc);