Skip to content

Commit e6f8c2b

Browse files
mmarcinidledford
authored andcommitted
staging/rdma/hfi1: use new timer routines
Use the new timer routines. Reviewed-by: Jubin John <[email protected]> Signed-off-by: Mike Marciniszyn <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent 9171bfd commit e6f8c2b

File tree

1 file changed

+10
-29
lines changed
  • drivers/staging/rdma/hfi1

1 file changed

+10
-29
lines changed

drivers/staging/rdma/hfi1/rc.c

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,6 @@ static u32 restart_sge(struct rvt_sge_state *ss, struct rvt_swqe *wqe,
183183
return wqe->length - len;
184184
}
185185

186-
static void start_timer(struct rvt_qp *qp)
187-
{
188-
qp->s_flags |= RVT_S_TIMER;
189-
qp->s_timer.function = rc_timeout;
190-
/* 4.096 usec. * (1 << qp->timeout) */
191-
qp->s_timer.expires = jiffies + qp->timeout_jiffies;
192-
add_timer(&qp->s_timer);
193-
}
194-
195186
/**
196187
* make_rc_ack - construct a response packet (ACK, NAK, or RDMA read)
197188
* @dev: the device for this QP
@@ -1054,11 +1045,8 @@ void hfi1_rc_rnr_retry(unsigned long arg)
10541045
unsigned long flags;
10551046

10561047
spin_lock_irqsave(&qp->s_lock, flags);
1057-
if (qp->s_flags & RVT_S_WAIT_RNR) {
1058-
qp->s_flags &= ~RVT_S_WAIT_RNR;
1059-
del_timer(&qp->s_timer);
1060-
hfi1_schedule_send(qp);
1061-
}
1048+
hfi1_stop_rnr_timer(qp);
1049+
hfi1_schedule_send(qp);
10621050
spin_unlock_irqrestore(&qp->s_lock, flags);
10631051
}
10641052

@@ -1128,7 +1116,7 @@ void hfi1_rc_send_complete(struct rvt_qp *qp, struct hfi1_ib_header *hdr)
11281116
!(qp->s_flags &
11291117
(RVT_S_TIMER | RVT_S_WAIT_RNR | RVT_S_WAIT_PSN)) &&
11301118
(ib_rvt_state_ops[qp->state] & RVT_PROCESS_RECV_OK))
1131-
start_timer(qp);
1119+
hfi1_add_retry_timer(qp);
11321120

11331121
while (qp->s_last != qp->s_acked) {
11341122
wqe = rvt_get_swqe_ptr(qp, qp->s_last);
@@ -1276,12 +1264,10 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
12761264
int ret = 0;
12771265
u32 ack_psn;
12781266
int diff;
1267+
unsigned long to;
12791268

12801269
/* Remove QP from retry timer */
1281-
if (qp->s_flags & (RVT_S_TIMER | RVT_S_WAIT_RNR)) {
1282-
qp->s_flags &= ~(RVT_S_TIMER | RVT_S_WAIT_RNR);
1283-
del_timer(&qp->s_timer);
1284-
}
1270+
hfi1_stop_rc_timers(qp);
12851271

12861272
/*
12871273
* Note that NAKs implicitly ACK outstanding SEND and RDMA write
@@ -1378,7 +1364,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
13781364
* We are expecting more ACKs so
13791365
* reset the re-transmit timer.
13801366
*/
1381-
start_timer(qp);
1367+
hfi1_add_retry_timer(qp);
13821368
/*
13831369
* We can stop re-sending the earlier packets and
13841370
* continue with the next packet the receiver wants.
@@ -1421,12 +1407,10 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
14211407
reset_psn(qp, psn);
14221408

14231409
qp->s_flags &= ~(RVT_S_WAIT_SSN_CREDIT | RVT_S_WAIT_ACK);
1424-
qp->s_flags |= RVT_S_WAIT_RNR;
1425-
qp->s_timer.function = hfi1_rc_rnr_retry;
1426-
qp->s_timer.expires = jiffies + usecs_to_jiffies(
1410+
to =
14271411
ib_hfi1_rnr_table[(aeth >> HFI1_AETH_CREDIT_SHIFT) &
1428-
HFI1_AETH_CREDIT_MASK]);
1429-
add_timer(&qp->s_timer);
1412+
HFI1_AETH_CREDIT_MASK];
1413+
hfi1_add_rnr_timer(qp, to);
14301414
goto bail;
14311415

14321416
case 3: /* NAK */
@@ -1496,10 +1480,7 @@ static void rdma_seq_err(struct rvt_qp *qp, struct hfi1_ibport *ibp, u32 psn,
14961480
struct rvt_swqe *wqe;
14971481

14981482
/* Remove QP from retry timer */
1499-
if (qp->s_flags & (RVT_S_TIMER | RVT_S_WAIT_RNR)) {
1500-
qp->s_flags &= ~(RVT_S_TIMER | RVT_S_WAIT_RNR);
1501-
del_timer(&qp->s_timer);
1502-
}
1483+
hfi1_stop_rc_timers(qp);
15031484

15041485
wqe = rvt_get_swqe_ptr(qp, qp->s_acked);
15051486

0 commit comments

Comments
 (0)