aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ehca/ehca_reqs.c
diff options
context:
space:
mode:
authorStefan Roscher <ossrosch@linux.vnet.ibm.com>2008-12-05 14:25:38 -0500
committerRoland Dreier <rolandd@cisco.com>2008-12-05 14:25:38 -0500
commit1c721940ddd6496508f1f2fde5167b1c898b419b (patch)
treed0ea3b596a617a6bdacbe0a23946808be80ba732 /drivers/infiniband/hw/ehca/ehca_reqs.c
parent75c21ae9aa75b0452318d05f737ea838672137f5 (diff)
IB/ehca: Replace modulus operations in flush error completion path
With the latest flush error completion patch we introduced modulus operation to calculate the next index within a qmap. Based on comments from other mailing lists we decided to optimize this operation by using an addition and an if-statement instead of modulus, even though this is on the error path. Signed-off-by: Stefan Roscher <stefan.roscher@de.ibm.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband/hw/ehca/ehca_reqs.c')
-rw-r--r--drivers/infiniband/hw/ehca/ehca_reqs.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/infiniband/hw/ehca/ehca_reqs.c b/drivers/infiniband/hw/ehca/ehca_reqs.c
index 00a648f4316c..c7112686782f 100644
--- a/drivers/infiniband/hw/ehca/ehca_reqs.c
+++ b/drivers/infiniband/hw/ehca/ehca_reqs.c
@@ -726,13 +726,13 @@ repoll:
726 * set left_to_poll to 0 because in error state, we will not 726 * set left_to_poll to 0 because in error state, we will not
727 * get any additional CQEs 727 * get any additional CQEs
728 */ 728 */
729 my_qp->sq_map.next_wqe_idx = (my_qp->sq_map.tail + 1) % 729 my_qp->sq_map.next_wqe_idx = next_index(my_qp->sq_map.tail,
730 my_qp->sq_map.entries; 730 my_qp->sq_map.entries);
731 my_qp->sq_map.left_to_poll = 0; 731 my_qp->sq_map.left_to_poll = 0;
732 ehca_add_to_err_list(my_qp, 1); 732 ehca_add_to_err_list(my_qp, 1);
733 733
734 my_qp->rq_map.next_wqe_idx = (my_qp->rq_map.tail + 1) % 734 my_qp->rq_map.next_wqe_idx = next_index(my_qp->rq_map.tail,
735 my_qp->rq_map.entries; 735 my_qp->rq_map.entries);
736 my_qp->rq_map.left_to_poll = 0; 736 my_qp->rq_map.left_to_poll = 0;
737 if (HAS_RQ(my_qp)) 737 if (HAS_RQ(my_qp))
738 ehca_add_to_err_list(my_qp, 0); 738 ehca_add_to_err_list(my_qp, 0);
@@ -860,9 +860,8 @@ static int generate_flush_cqes(struct ehca_qp *my_qp, struct ib_cq *cq,
860 860
861 /* mark as reported and advance next_wqe pointer */ 861 /* mark as reported and advance next_wqe pointer */
862 qmap_entry->reported = 1; 862 qmap_entry->reported = 1;
863 qmap->next_wqe_idx++; 863 qmap->next_wqe_idx = next_index(qmap->next_wqe_idx,
864 if (qmap->next_wqe_idx == qmap->entries) 864 qmap->entries);
865 qmap->next_wqe_idx = 0;
866 qmap_entry = &qmap->map[qmap->next_wqe_idx]; 865 qmap_entry = &qmap->map[qmap->next_wqe_idx];
867 866
868 wc++; nr++; 867 wc++; nr++;