diff options
author | Mike Marciniszyn <mike.marciniszyn@qlogic.com> | 2011-09-23 13:16:49 -0400 |
---|---|---|
committer | Roland Dreier <roland@purestorage.com> | 2011-10-21 12:38:56 -0400 |
commit | d0f2faf72d51dacf5c5e8dec7dca22d0395896e2 (patch) | |
tree | 9cdae5f02f9d17dac30c9a140123dc912d897278 /drivers | |
parent | af061a644a0e4d4778fe6cd2246479c1962e153b (diff) |
IB/qib: Precompute timeout jiffies to optimize latency
A new field is added to qib_qp called timeout_jiffies. It is
initialized upon create and modify.
The field is now used instead of a computation based on qp->timeout.
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/infiniband/hw/qib/qib_qp.c | 9 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_rc.c | 7 | ||||
-rw-r--r-- | drivers/infiniband/hw/qib/qib_verbs.h | 1 |
3 files changed, 11 insertions, 6 deletions
diff --git a/drivers/infiniband/hw/qib/qib_qp.c b/drivers/infiniband/hw/qib/qib_qp.c index 500981bce9c0..7e7e16fbee99 100644 --- a/drivers/infiniband/hw/qib/qib_qp.c +++ b/drivers/infiniband/hw/qib/qib_qp.c | |||
@@ -801,8 +801,12 @@ int qib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | |||
801 | if (attr_mask & IB_QP_MIN_RNR_TIMER) | 801 | if (attr_mask & IB_QP_MIN_RNR_TIMER) |
802 | qp->r_min_rnr_timer = attr->min_rnr_timer; | 802 | qp->r_min_rnr_timer = attr->min_rnr_timer; |
803 | 803 | ||
804 | if (attr_mask & IB_QP_TIMEOUT) | 804 | if (attr_mask & IB_QP_TIMEOUT) { |
805 | qp->timeout = attr->timeout; | 805 | qp->timeout = attr->timeout; |
806 | qp->timeout_jiffies = | ||
807 | usecs_to_jiffies((4096UL * (1UL << qp->timeout)) / | ||
808 | 1000UL); | ||
809 | } | ||
806 | 810 | ||
807 | if (attr_mask & IB_QP_QKEY) | 811 | if (attr_mask & IB_QP_QKEY) |
808 | qp->qkey = attr->qkey; | 812 | qp->qkey = attr->qkey; |
@@ -1034,6 +1038,9 @@ struct ib_qp *qib_create_qp(struct ib_pd *ibpd, | |||
1034 | goto bail_swq; | 1038 | goto bail_swq; |
1035 | } | 1039 | } |
1036 | RCU_INIT_POINTER(qp->next, NULL); | 1040 | RCU_INIT_POINTER(qp->next, NULL); |
1041 | qp->timeout_jiffies = | ||
1042 | usecs_to_jiffies((4096UL * (1UL << qp->timeout)) / | ||
1043 | 1000UL); | ||
1037 | if (init_attr->srq) | 1044 | if (init_attr->srq) |
1038 | sz = 0; | 1045 | sz = 0; |
1039 | else { | 1046 | else { |
diff --git a/drivers/infiniband/hw/qib/qib_rc.c b/drivers/infiniband/hw/qib/qib_rc.c index 5d77cb8aa052..ecfa087ad45e 100644 --- a/drivers/infiniband/hw/qib/qib_rc.c +++ b/drivers/infiniband/hw/qib/qib_rc.c | |||
@@ -59,8 +59,7 @@ static void start_timer(struct qib_qp *qp) | |||
59 | qp->s_flags |= QIB_S_TIMER; | 59 | qp->s_flags |= QIB_S_TIMER; |
60 | qp->s_timer.function = rc_timeout; | 60 | qp->s_timer.function = rc_timeout; |
61 | /* 4.096 usec. * (1 << qp->timeout) */ | 61 | /* 4.096 usec. * (1 << qp->timeout) */ |
62 | qp->s_timer.expires = jiffies + | 62 | qp->s_timer.expires = jiffies + qp->timeout_jiffies; |
63 | usecs_to_jiffies((4096UL * (1UL << qp->timeout)) / 1000UL); | ||
64 | add_timer(&qp->s_timer); | 63 | add_timer(&qp->s_timer); |
65 | } | 64 | } |
66 | 65 | ||
@@ -1519,9 +1518,7 @@ read_middle: | |||
1519 | * 4.096 usec. * (1 << qp->timeout) | 1518 | * 4.096 usec. * (1 << qp->timeout) |
1520 | */ | 1519 | */ |
1521 | qp->s_flags |= QIB_S_TIMER; | 1520 | qp->s_flags |= QIB_S_TIMER; |
1522 | mod_timer(&qp->s_timer, jiffies + | 1521 | mod_timer(&qp->s_timer, jiffies + qp->timeout_jiffies); |
1523 | usecs_to_jiffies((4096UL * (1UL << qp->timeout)) / | ||
1524 | 1000UL)); | ||
1525 | if (qp->s_flags & QIB_S_WAIT_ACK) { | 1522 | if (qp->s_flags & QIB_S_WAIT_ACK) { |
1526 | qp->s_flags &= ~QIB_S_WAIT_ACK; | 1523 | qp->s_flags &= ~QIB_S_WAIT_ACK; |
1527 | qib_schedule_send(qp); | 1524 | qib_schedule_send(qp); |
diff --git a/drivers/infiniband/hw/qib/qib_verbs.h b/drivers/infiniband/hw/qib/qib_verbs.h index d7b6109528a4..0c19ef0c4123 100644 --- a/drivers/infiniband/hw/qib/qib_verbs.h +++ b/drivers/infiniband/hw/qib/qib_verbs.h | |||
@@ -496,6 +496,7 @@ struct qib_qp { | |||
496 | u32 s_last; /* last completed entry */ | 496 | u32 s_last; /* last completed entry */ |
497 | u32 s_ssn; /* SSN of tail entry */ | 497 | u32 s_ssn; /* SSN of tail entry */ |
498 | u32 s_lsn; /* limit sequence number (credit) */ | 498 | u32 s_lsn; /* limit sequence number (credit) */ |
499 | unsigned long timeout_jiffies; /* computed from timeout */ | ||
499 | struct qib_swqe *s_wq; /* send work queue */ | 500 | struct qib_swqe *s_wq; /* send work queue */ |
500 | struct qib_swqe *s_wqe; | 501 | struct qib_swqe *s_wqe; |
501 | struct qib_rq r_rq; /* receive work queue */ | 502 | struct qib_rq r_rq; /* receive work queue */ |