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_qp.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_qp.c')
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_qp.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_qp.c b/drivers/infiniband/hw/mthca/mthca_qp.c index 997a34a2b2be..0db4c9761611 100644 --- a/drivers/infiniband/hw/mthca/mthca_qp.c +++ b/drivers/infiniband/hw/mthca/mthca_qp.c | |||
@@ -639,7 +639,7 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
639 | else if (attr_mask & IB_QP_PATH_MTU) | 639 | else if (attr_mask & IB_QP_PATH_MTU) |
640 | qp_context->mtu_msgmax = (attr->path_mtu << 5) | 31; | 640 | qp_context->mtu_msgmax = (attr->path_mtu << 5) | 31; |
641 | 641 | ||
642 | if (dev->hca_type == ARBEL_NATIVE) { | 642 | if (mthca_is_memfree(dev)) { |
643 | qp_context->rq_size_stride = | 643 | qp_context->rq_size_stride = |
644 | ((ffs(qp->rq.max) - 1) << 3) | (qp->rq.wqe_shift - 4); | 644 | ((ffs(qp->rq.max) - 1) << 3) | (qp->rq.wqe_shift - 4); |
645 | qp_context->sq_size_stride = | 645 | qp_context->sq_size_stride = |
@@ -731,7 +731,7 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
731 | qp_context->next_send_psn = cpu_to_be32(attr->sq_psn); | 731 | qp_context->next_send_psn = cpu_to_be32(attr->sq_psn); |
732 | qp_context->cqn_snd = cpu_to_be32(to_mcq(ibqp->send_cq)->cqn); | 732 | qp_context->cqn_snd = cpu_to_be32(to_mcq(ibqp->send_cq)->cqn); |
733 | 733 | ||
734 | if (dev->hca_type == ARBEL_NATIVE) { | 734 | if (mthca_is_memfree(dev)) { |
735 | qp_context->snd_wqe_base_l = cpu_to_be32(qp->send_wqe_offset); | 735 | qp_context->snd_wqe_base_l = cpu_to_be32(qp->send_wqe_offset); |
736 | qp_context->snd_db_index = cpu_to_be32(qp->sq.db_index); | 736 | qp_context->snd_db_index = cpu_to_be32(qp->sq.db_index); |
737 | } | 737 | } |
@@ -822,7 +822,7 @@ int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask) | |||
822 | 822 | ||
823 | qp_context->cqn_rcv = cpu_to_be32(to_mcq(ibqp->recv_cq)->cqn); | 823 | qp_context->cqn_rcv = cpu_to_be32(to_mcq(ibqp->recv_cq)->cqn); |
824 | 824 | ||
825 | if (dev->hca_type == ARBEL_NATIVE) | 825 | if (mthca_is_memfree(dev)) |
826 | qp_context->rcv_db_index = cpu_to_be32(qp->rq.db_index); | 826 | qp_context->rcv_db_index = cpu_to_be32(qp->rq.db_index); |
827 | 827 | ||
828 | if (attr_mask & IB_QP_QKEY) { | 828 | if (attr_mask & IB_QP_QKEY) { |
@@ -897,7 +897,7 @@ static int mthca_alloc_wqe_buf(struct mthca_dev *dev, | |||
897 | size += 2 * sizeof (struct mthca_data_seg); | 897 | size += 2 * sizeof (struct mthca_data_seg); |
898 | break; | 898 | break; |
899 | case UD: | 899 | case UD: |
900 | if (dev->hca_type == ARBEL_NATIVE) | 900 | if (mthca_is_memfree(dev)) |
901 | size += sizeof (struct mthca_arbel_ud_seg); | 901 | size += sizeof (struct mthca_arbel_ud_seg); |
902 | else | 902 | else |
903 | size += sizeof (struct mthca_tavor_ud_seg); | 903 | size += sizeof (struct mthca_tavor_ud_seg); |
@@ -1016,7 +1016,7 @@ static int mthca_alloc_memfree(struct mthca_dev *dev, | |||
1016 | { | 1016 | { |
1017 | int ret = 0; | 1017 | int ret = 0; |
1018 | 1018 | ||
1019 | if (dev->hca_type == ARBEL_NATIVE) { | 1019 | if (mthca_is_memfree(dev)) { |
1020 | ret = mthca_table_get(dev, dev->qp_table.qp_table, qp->qpn); | 1020 | ret = mthca_table_get(dev, dev->qp_table.qp_table, qp->qpn); |
1021 | if (ret) | 1021 | if (ret) |
1022 | return ret; | 1022 | return ret; |
@@ -1057,7 +1057,7 @@ err_qpc: | |||
1057 | static void mthca_free_memfree(struct mthca_dev *dev, | 1057 | static void mthca_free_memfree(struct mthca_dev *dev, |
1058 | struct mthca_qp *qp) | 1058 | struct mthca_qp *qp) |
1059 | { | 1059 | { |
1060 | if (dev->hca_type == ARBEL_NATIVE) { | 1060 | if (mthca_is_memfree(dev)) { |
1061 | mthca_free_db(dev, MTHCA_DB_TYPE_SQ, qp->sq.db_index); | 1061 | mthca_free_db(dev, MTHCA_DB_TYPE_SQ, qp->sq.db_index); |
1062 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); | 1062 | mthca_free_db(dev, MTHCA_DB_TYPE_RQ, qp->rq.db_index); |
1063 | mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn); | 1063 | mthca_table_put(dev, dev->qp_table.eqp_table, qp->qpn); |
@@ -1104,7 +1104,7 @@ static int mthca_alloc_qp_common(struct mthca_dev *dev, | |||
1104 | return ret; | 1104 | return ret; |
1105 | } | 1105 | } |
1106 | 1106 | ||
1107 | if (dev->hca_type == ARBEL_NATIVE) { | 1107 | if (mthca_is_memfree(dev)) { |
1108 | for (i = 0; i < qp->rq.max; ++i) { | 1108 | for (i = 0; i < qp->rq.max; ++i) { |
1109 | wqe = get_recv_wqe(qp, i); | 1109 | wqe = get_recv_wqe(qp, i); |
1110 | wqe->nda_op = cpu_to_be32(((i + 1) & (qp->rq.max - 1)) << | 1110 | wqe->nda_op = cpu_to_be32(((i + 1) & (qp->rq.max - 1)) << |
@@ -1127,7 +1127,7 @@ static void mthca_align_qp_size(struct mthca_dev *dev, struct mthca_qp *qp) | |||
1127 | { | 1127 | { |
1128 | int i; | 1128 | int i; |
1129 | 1129 | ||
1130 | if (dev->hca_type != ARBEL_NATIVE) | 1130 | if (!mthca_is_memfree(dev)) |
1131 | return; | 1131 | return; |
1132 | 1132 | ||
1133 | for (i = 0; 1 << i < qp->rq.max; ++i) | 1133 | for (i = 0; 1 << i < qp->rq.max; ++i) |
@@ -2011,7 +2011,7 @@ int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send, | |||
2011 | else | 2011 | else |
2012 | next = get_recv_wqe(qp, index); | 2012 | next = get_recv_wqe(qp, index); |
2013 | 2013 | ||
2014 | if (dev->hca_type == ARBEL_NATIVE) | 2014 | if (mthca_is_memfree(dev)) |
2015 | *dbd = 1; | 2015 | *dbd = 1; |
2016 | else | 2016 | else |
2017 | *dbd = !!(next->ee_nds & cpu_to_be32(MTHCA_NEXT_DBD)); | 2017 | *dbd = !!(next->ee_nds & cpu_to_be32(MTHCA_NEXT_DBD)); |