Commit 08aeb14e authored by Roland Dreier's avatar Roland Dreier Committed by Linus Torvalds

[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: default avatarRoland Dreier <roland@topspin.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ddf841f0
...@@ -222,6 +222,7 @@ struct mthca_qp_table { ...@@ -222,6 +222,7 @@ struct mthca_qp_table {
struct mthca_array qp; struct mthca_array qp;
struct mthca_icm_table *qp_table; struct mthca_icm_table *qp_table;
struct mthca_icm_table *eqp_table; struct mthca_icm_table *eqp_table;
struct mthca_icm_table *rdb_table;
}; };
struct mthca_av_table { struct mthca_av_table {
......
...@@ -430,14 +430,25 @@ static int __devinit mthca_init_icm(struct mthca_dev *mdev, ...@@ -430,14 +430,25 @@ static int __devinit mthca_init_icm(struct mthca_dev *mdev,
goto err_unmap_qp; goto err_unmap_qp;
} }
mdev->cq_table.table = mthca_alloc_icm_table(mdev, init_hca->cqc_base, mdev->qp_table.rdb_table = mthca_alloc_icm_table(mdev, init_hca->rdb_base,
MTHCA_RDB_ENTRY_SIZE,
mdev->limits.num_qps <<
mdev->qp_table.rdb_shift,
0, 0);
if (!mdev->qp_table.rdb_table) {
mthca_err(mdev, "Failed to map RDB context memory, aborting\n");
err = -ENOMEM;
goto err_unmap_eqp;
}
mdev->cq_table.table = mthca_alloc_icm_table(mdev, init_hca->cqc_base,
dev_lim->cqc_entry_sz, dev_lim->cqc_entry_sz,
mdev->limits.num_cqs, mdev->limits.num_cqs,
mdev->limits.reserved_cqs, 0); mdev->limits.reserved_cqs, 0);
if (!mdev->cq_table.table) { if (!mdev->cq_table.table) {
mthca_err(mdev, "Failed to map CQ context memory, aborting.\n"); mthca_err(mdev, "Failed to map CQ context memory, aborting.\n");
err = -ENOMEM; err = -ENOMEM;
goto err_unmap_eqp; goto err_unmap_rdb;
} }
/* /*
...@@ -463,6 +474,9 @@ static int __devinit mthca_init_icm(struct mthca_dev *mdev, ...@@ -463,6 +474,9 @@ static int __devinit mthca_init_icm(struct mthca_dev *mdev,
err_unmap_cq: err_unmap_cq:
mthca_free_icm_table(mdev, mdev->cq_table.table); mthca_free_icm_table(mdev, mdev->cq_table.table);
err_unmap_rdb:
mthca_free_icm_table(mdev, mdev->qp_table.rdb_table);
err_unmap_eqp: err_unmap_eqp:
mthca_free_icm_table(mdev, mdev->qp_table.eqp_table); mthca_free_icm_table(mdev, mdev->qp_table.eqp_table);
......
...@@ -1029,11 +1029,16 @@ static int mthca_alloc_memfree(struct mthca_dev *dev, ...@@ -1029,11 +1029,16 @@ static int mthca_alloc_memfree(struct mthca_dev *dev,
if (ret) if (ret)
goto err_qpc; goto err_qpc;
ret = mthca_table_get(dev, dev->qp_table.rdb_table,
qp->qpn << dev->qp_table.rdb_shift);
if (ret)
goto err_eqpc;
qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_RQ,
qp->qpn, &qp->rq.db); qp->qpn, &qp->rq.db);
if (qp->rq.db_index < 0) { if (qp->rq.db_index < 0) {
ret = -ENOMEM; ret = -ENOMEM;
goto err_eqpc; goto err_rdb;
} }
qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ, 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,6 +1054,10 @@ static int mthca_alloc_memfree(struct mthca_dev *dev,
err_rq_db: err_rq_db:
mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index);
err_rdb:
mthca_table_put(dev, dev->qp_table.rdb_table,
qp->qpn << dev->qp_table.rdb_shift);
err_eqpc: err_eqpc:
mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn); mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn);
...@@ -1064,6 +1073,8 @@ static void mthca_free_memfree(struct mthca_dev *dev, ...@@ -1064,6 +1073,8 @@ static void mthca_free_memfree(struct mthca_dev *dev,
if (mthca_is_memfree(dev)) { if (mthca_is_memfree(dev)) {
mthca_free_db(dev, MTHCA_DB_TYPE_SQ, qp->sq.db_index); mthca_free_db(dev, MTHCA_DB_TYPE_SQ, qp->sq.db_index);
mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index);
mthca_table_put(dev, dev->qp_table.rdb_table,
qp->qpn << dev->qp_table.rdb_shift);
mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn); mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn);
mthca_table_put(dev, dev->qp_table.qp_table, qp->qpn); mthca_table_put(dev, dev->qp_table.qp_table, qp->qpn);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment