diff options
author | Roland Dreier <roland@topspin.com> | 2005-04-16 18:26:34 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:26:34 -0400 |
commit | 08aeb14e5f6c28878266b01c87cc5ce31101afa8 (patch) | |
tree | 830f591f6931ceb411f0ae97196f113db2cd766b /drivers/infiniband | |
parent | ddf841f052fa218547c86169d1074968eca8c503 (diff) |
[PATCH] IB/mthca: map context for RDMA responder in mem-free mode
Fix RDMA in mem-free mode: we need to make sure that the RDMA context memory
is mapped for the HCA.
Signed-off-by: Roland Dreier <roland@topspin.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_dev.h | 1 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_main.c | 18 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_qp.c | 13 |
3 files changed, 29 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_dev.h b/drivers/infiniband/hw/mthca/mthca_dev.h index 616a0de54b40..d014b443dc3c 100644 --- a/drivers/infiniband/hw/mthca/mthca_dev.h +++ b/drivers/infiniband/hw/mthca/mthca_dev.h | |||
@@ -222,6 +222,7 @@ struct mthca_qp_table { | |||
222 | struct mthca_array qp; | 222 | struct mthca_array qp; |
223 | struct mthca_icm_table *qp_table; | 223 | struct mthca_icm_table *qp_table; |
224 | struct mthca_icm_table *eqp_table; | 224 | struct mthca_icm_table *eqp_table; |
225 | struct mthca_icm_table *rdb_table; | ||
225 | }; | 226 | }; |
226 | 227 | ||
227 | struct mthca_av_table { | 228 | struct mthca_av_table { |
diff --git a/drivers/infiniband/hw/mthca/mthca_main.c b/drivers/infiniband/hw/mthca/mthca_main.c index c9c94686e7a9..014369626f65 100644 --- a/drivers/infiniband/hw/mthca/mthca_main.c +++ b/drivers/infiniband/hw/mthca/mthca_main.c | |||
@@ -430,14 +430,25 @@ static int __devinit mthca_init_icm(struct mthca_dev *mdev, | |||
430 | goto err_unmap_qp; | 430 | goto err_unmap_qp; |
431 | } | 431 | } |
432 | 432 | ||
433 | mdev->cq_table.table = mthca_alloc_icm_table(mdev, init_hca->cqc_base, | 433 | mdev->qp_table.rdb_table = mthca_alloc_icm_table(mdev, init_hca->rdb_base, |
434 | MTHCA_RDB_ENTRY_SIZE, | ||
435 | mdev->limits.num_qps << | ||
436 | mdev->qp_table.rdb_shift, | ||
437 | 0, 0); | ||
438 | if (!mdev->qp_table.rdb_table) { | ||
439 | mthca_err(mdev, "Failed to map RDB context memory, aborting\n"); | ||
440 | err = -ENOMEM; | ||
441 | goto err_unmap_eqp; | ||
442 | } | ||
443 | |||
444 | mdev->cq_table.table = mthca_alloc_icm_table(mdev, init_hca->cqc_base, | ||
434 | dev_lim->cqc_entry_sz, | 445 | dev_lim->cqc_entry_sz, |
435 | mdev->limits.num_cqs, | 446 | mdev->limits.num_cqs, |
436 | mdev->limits.reserved_cqs, 0); | 447 | mdev->limits.reserved_cqs, 0); |
437 | if (!mdev->cq_table.table) { | 448 | if (!mdev->cq_table.table) { |
438 | mthca_err(mdev, "Failed to map CQ context memory, aborting.\n"); | 449 | mthca_err(mdev, "Failed to map CQ context memory, aborting.\n"); |
439 | err = -ENOMEM; | 450 | err = -ENOMEM; |
440 | goto err_unmap_eqp; | 451 | goto err_unmap_rdb; |
441 | } | 452 | } |
442 | 453 | ||
443 | /* | 454 | /* |
@@ -463,6 +474,9 @@ static int __devinit mthca_init_icm(struct mthca_dev *mdev, | |||
463 | err_unmap_cq: | 474 | err_unmap_cq: |
464 | mthca_free_icm_table(mdev, mdev->cq_table.table); | 475 | mthca_free_icm_table(mdev, mdev->cq_table.table); |
465 | 476 | ||
477 | err_unmap_rdb: | ||
478 | mthca_free_icm_table(mdev, mdev->qp_table.rdb_table); | ||
479 | |||
466 | err_unmap_eqp: | 480 | err_unmap_eqp: |
467 | mthca_free_icm_table(mdev, mdev->qp_table.eqp_table); | 481 | mthca_free_icm_table(mdev, mdev->qp_table.eqp_table); |
468 | 482 | ||
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 53af7aab1991..ca73bab11a02 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -1029,11 +1029,16 @@ static int mthca_alloc_memfree(struct mthca_dev *dev, | |||
1029 | if (ret) | 1029 | if (ret) |
1030 | goto err_qpc; | 1030 | goto err_qpc; |
1031 | 1031 | ||
1032 | ret = mthca_table_get(dev, dev->qp_table.rdb_table, | ||
1033 | qp->qpn << dev->qp_table.rdb_shift); | ||
1034 | if (ret) | ||
1035 | goto err_eqpc; | ||
1036 | |||
1032 | qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, | 1037 | qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, |
1033 | qp->qpn, &qp->rq.db); | 1038 | qp->qpn, &qp->rq.db); |
1034 | if (qp->rq.db_index < 0) { | 1039 | if (qp->rq.db_index < 0) { |
1035 | ret = -ENOMEM; | 1040 | ret = -ENOMEM; |
1036 | goto err_eqpc; | 1041 | goto err_rdb; |
1037 | } | 1042 | } |
1038 | 1043 | ||
1039 | qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, | 1044 | qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, |
@@ -1049,6 +1054,10 @@ static int mthca_alloc_memfree(struct mthca_dev *dev, | |||
1049 | err_rq_db: | 1054 | err_rq_db: |
1050 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); | 1055 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); |
1051 | 1056 | ||
1057 | err_rdb: | ||
1058 | mthca_table_put(dev, dev->qp_table.rdb_table, | ||
1059 | qp->qpn << dev->qp_table.rdb_shift); | ||
1060 | |||
1052 | err_eqpc: | 1061 | err_eqpc: |
1053 | mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn); | 1062 | mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn); |
1054 | 1063 | ||
@@ -1064,6 +1073,8 @@ static void mthca_free_memfree(struct mthca_dev *dev, | |||
1064 | if (mthca_is_memfree(dev)) { | 1073 | if (mthca_is_memfree(dev)) { |
1065 | mthca_free_db(dev, MTHCA_DB_TYPE_SQ, qp->sq.db_index); | 1074 | mthca_free_db(dev, MTHCA_DB_TYPE_SQ, qp->sq.db_index); |
1066 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); | 1075 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); |
1076 | mthca_table_put(dev, dev->qp_table.rdb_table, | ||
1077 | qp->qpn << dev->qp_table.rdb_shift); | ||
1067 | mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn); | 1078 | mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn); |
1068 | mthca_table_put(dev, dev->qp_table.qp_table, qp->qpn); | 1079 | mthca_table_put(dev, dev->qp_table.qp_table, qp->qpn); |
1069 | } | 1080 | } |