tree 6111aeb823e4735611ea6aa47f730b91b655307d
parent 3b64d3241b104104a94712b409cc05503ccbd836
author Roland Dreier <[EMAIL PROTECTED]> Tue Apr 12 08:27:00 2005
committer Linus Torvalds <[EMAIL PROTECTED]> Tue Apr 12 08:27:00 2005

[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 <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 mthca_dev.h  |    1 +
 mthca_main.c |   18 ++++++++++++++++--
 mthca_qp.c   |   13 ++++++++++++-
 3 files changed, 29 insertions(+), 3 deletions(-)

Index: drivers/infiniband/hw/mthca/mthca_dev.h
===================================================================
--- 
9ac497e5d6ec9557bf7c65cf5f189eaa57f1336f/drivers/infiniband/hw/mthca/mthca_dev.h
  (mode:100644 sha1:1807e84664cd7b661f0a918333e2e37cf855a463)
+++ 
6111aeb823e4735611ea6aa47f730b91b655307d/drivers/infiniband/hw/mthca/mthca_dev.h
  (mode:100644 sha1:ea213479155ac0e86640c3da04797fcde333730c)
@@ -222,6 +222,7 @@
        struct mthca_array      qp;
        struct mthca_icm_table *qp_table;
        struct mthca_icm_table *eqp_table;
+       struct mthca_icm_table *rdb_table;
 };
 
 struct mthca_av_table {
Index: drivers/infiniband/hw/mthca/mthca_main.c
===================================================================
--- 
9ac497e5d6ec9557bf7c65cf5f189eaa57f1336f/drivers/infiniband/hw/mthca/mthca_main.c
  (mode:100644 sha1:520f88230f643880dba70cbc274f5ae904548893)
+++ 
6111aeb823e4735611ea6aa47f730b91b655307d/drivers/infiniband/hw/mthca/mthca_main.c
  (mode:100644 sha1:4522d58563f30c1583e1b1a8571eaf8fb1ea0977)
@@ -430,14 +430,25 @@
                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,
                                                     mdev->limits.num_cqs,
                                                     mdev->limits.reserved_cqs, 
0);
        if (!mdev->cq_table.table) {
                mthca_err(mdev, "Failed to map CQ context memory, aborting.\n");
                err = -ENOMEM;
-               goto err_unmap_eqp;
+               goto err_unmap_rdb;
        }
 
        /*
@@ -463,6 +474,9 @@
 err_unmap_cq:
        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:
        mthca_free_icm_table(mdev, mdev->qp_table.eqp_table);
 
Index: drivers/infiniband/hw/mthca/mthca_qp.c
===================================================================
--- 
9ac497e5d6ec9557bf7c65cf5f189eaa57f1336f/drivers/infiniband/hw/mthca/mthca_qp.c 
 (mode:100644 sha1:2a6ec2b67732961ffaa4cbd14ae4cc9de2523d4a)
+++ 
6111aeb823e4735611ea6aa47f730b91b655307d/drivers/infiniband/hw/mthca/mthca_qp.c 
 (mode:100644 sha1:9735d9a413083cf472a9786c525abd76615d3462)
@@ -1029,11 +1029,16 @@
                if (ret)
                        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->qpn, &qp->rq.db);
                if (qp->rq.db_index < 0) {
                        ret = -ENOMEM;
-                       goto err_eqpc;
+                       goto err_rdb;
                }
 
                qp->sq.db_index = mthca_alloc_db(dev, MTHCA_DB_TYPE_SQ,
@@ -1049,6 +1054,10 @@
 err_rq_db:
        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:
        mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn);
 
@@ -1064,6 +1073,8 @@
        if (mthca_is_memfree(dev)) {
                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_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.qp_table, qp->qpn);
        }
-
To unsubscribe from this list: send the line "unsubscribe bk-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to