diff options
author | Roland Dreier <roland@topspin.com> | 2005-04-16 18:26:32 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:26:32 -0400 |
commit | d10ddbf6d7f6699c386d1f41bf542189de32b6be (patch) | |
tree | b2e3ab95925407472fa9c62bb6016d85f822cb68 /drivers/infiniband/hw/mthca/mthca_cq.c | |
parent | 6bd6228eed52ef188ebe46865ccff72da936c968 (diff) |
[PATCH] IB/mthca: encapsulate mem-free check into mthca_is_memfree()
Clean up mem-free mode support by introducing mthca_is_memfree() function,
which encapsulates the logic of deciding if a device is mem-free.
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/hw/mthca/mthca_cq.c')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_cq.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_cq.c b/drivers/infiniband/hw/mthca/mthca_cq.c index 0ad954e18bd7..2bf347b84c31 100644 --- a/drivers/infiniband/hw/mthca/mthca_cq.c +++ b/drivers/infiniband/hw/mthca/mthca_cq.c | |||
@@ -180,7 +180,7 @@ static inline void update_cons_index(struct mthca_dev *dev, struct mthca_cq *cq, | |||
180 | { | 180 | { |
181 | u32 doorbell[2]; | 181 | u32 doorbell[2]; |
182 | 182 | ||
183 | if (dev->hca_type == ARBEL_NATIVE) { | 183 | if (mthca_is_memfree(dev)) { |
184 | *cq->set_ci_db = cpu_to_be32(cq->cons_index); | 184 | *cq->set_ci_db = cpu_to_be32(cq->cons_index); |
185 | wmb(); | 185 | wmb(); |
186 | } else { | 186 | } else { |
@@ -760,7 +760,7 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, | |||
760 | if (cq->cqn == -1) | 760 | if (cq->cqn == -1) |
761 | return -ENOMEM; | 761 | return -ENOMEM; |
762 | 762 | ||
763 | if (dev->hca_type == ARBEL_NATIVE) { | 763 | if (mthca_is_memfree(dev)) { |
764 | cq->arm_sn = 1; | 764 | cq->arm_sn = 1; |
765 | 765 | ||
766 | err = mthca_table_get(dev, dev->cq_table.table, cq->cqn); | 766 | err = mthca_table_get(dev, dev->cq_table.table, cq->cqn); |
@@ -811,7 +811,7 @@ int mthca_init_cq(struct mthca_dev *dev, int nent, | |||
811 | cq_context->lkey = cpu_to_be32(cq->mr.ibmr.lkey); | 811 | cq_context->lkey = cpu_to_be32(cq->mr.ibmr.lkey); |
812 | cq_context->cqn = cpu_to_be32(cq->cqn); | 812 | cq_context->cqn = cpu_to_be32(cq->cqn); |
813 | 813 | ||
814 | if (dev->hca_type == ARBEL_NATIVE) { | 814 | if (mthca_is_memfree(dev)) { |
815 | cq_context->ci_db = cpu_to_be32(cq->set_ci_db_index); | 815 | cq_context->ci_db = cpu_to_be32(cq->set_ci_db_index); |
816 | cq_context->state_db = cpu_to_be32(cq->arm_db_index); | 816 | cq_context->state_db = cpu_to_be32(cq->arm_db_index); |
817 | } | 817 | } |
@@ -851,11 +851,11 @@ err_out_free_mr: | |||
851 | err_out_mailbox: | 851 | err_out_mailbox: |
852 | kfree(mailbox); | 852 | kfree(mailbox); |
853 | 853 | ||
854 | if (dev->hca_type == ARBEL_NATIVE) | 854 | if (mthca_is_memfree(dev)) |
855 | mthca_free_db(dev, MTHCA_DB_TYPE_CQ_ARM, cq->arm_db_index); | 855 | mthca_free_db(dev, MTHCA_DB_TYPE_CQ_ARM, cq->arm_db_index); |
856 | 856 | ||
857 | err_out_ci: | 857 | err_out_ci: |
858 | if (dev->hca_type == ARBEL_NATIVE) | 858 | if (mthca_is_memfree(dev)) |
859 | mthca_free_db(dev, MTHCA_DB_TYPE_CQ_SET_CI, cq->set_ci_db_index); | 859 | mthca_free_db(dev, MTHCA_DB_TYPE_CQ_SET_CI, cq->set_ci_db_index); |
860 | 860 | ||
861 | err_out_icm: | 861 | err_out_icm: |
@@ -916,7 +916,7 @@ void mthca_free_cq(struct mthca_dev *dev, | |||
916 | mthca_free_mr(dev, &cq->mr); | 916 | mthca_free_mr(dev, &cq->mr); |
917 | mthca_free_cq_buf(dev, cq); | 917 | mthca_free_cq_buf(dev, cq); |
918 | 918 | ||
919 | if (dev->hca_type == ARBEL_NATIVE) { | 919 | if (mthca_is_memfree(dev)) { |
920 | mthca_free_db(dev, MTHCA_DB_TYPE_CQ_ARM, cq->arm_db_index); | 920 | mthca_free_db(dev, MTHCA_DB_TYPE_CQ_ARM, cq->arm_db_index); |
921 | mthca_free_db(dev, MTHCA_DB_TYPE_CQ_SET_CI, cq->set_ci_db_index); | 921 | mthca_free_db(dev, MTHCA_DB_TYPE_CQ_SET_CI, cq->set_ci_db_index); |
922 | mthca_table_put(dev, dev->cq_table.table, cq->cqn); | 922 | mthca_table_put(dev, dev->cq_table.table, cq->cqn); |