Skip to content

Commit 633d273

Browse files
mmarcinidledford
authored andcommitted
staging/rdma/hfi1: use mod_timer when appropriate
Use new timer API to optimize maintenance of timers during ACK processing. When we are still expecting ACKs, mod the timer to avoid a heavyweight delete/add. Otherwise, insure do_rc_ack() maintains the timer as it had. Reviewed-by: Jubin John <[email protected]> Signed-off-by: Mike Marciniszyn <[email protected]> Signed-off-by: Doug Ledford <[email protected]>
1 parent e6f8c2b commit 633d273

File tree

1 file changed

+22
-20
lines changed
  • drivers/staging/rdma/hfi1

1 file changed

+22
-20
lines changed

drivers/staging/rdma/hfi1/rc.c

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,9 +1266,6 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
12661266
int diff;
12671267
unsigned long to;
12681268

1269-
/* Remove QP from retry timer */
1270-
hfi1_stop_rc_timers(qp);
1271-
12721269
/*
12731270
* Note that NAKs implicitly ACK outstanding SEND and RDMA write
12741271
* requests and implicitly NAK RDMA read and atomic requests issued
@@ -1296,7 +1293,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
12961293
opcode == OP(RDMA_READ_RESPONSE_ONLY) &&
12971294
diff == 0) {
12981295
ret = 1;
1299-
goto bail;
1296+
goto bail_stop;
13001297
}
13011298
/*
13021299
* If this request is a RDMA read or atomic, and the ACK is
@@ -1327,7 +1324,7 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
13271324
* No need to process the ACK/NAK since we are
13281325
* restarting an earlier request.
13291326
*/
1330-
goto bail;
1327+
goto bail_stop;
13311328
}
13321329
if (wqe->wr.opcode == IB_WR_ATOMIC_CMP_AND_SWP ||
13331330
wqe->wr.opcode == IB_WR_ATOMIC_FETCH_AND_ADD) {
@@ -1362,18 +1359,22 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
13621359
if (qp->s_acked != qp->s_tail) {
13631360
/*
13641361
* We are expecting more ACKs so
1365-
* reset the re-transmit timer.
1362+
* mod the retry timer.
13661363
*/
1367-
hfi1_add_retry_timer(qp);
1364+
hfi1_mod_retry_timer(qp);
13681365
/*
13691366
* We can stop re-sending the earlier packets and
13701367
* continue with the next packet the receiver wants.
13711368
*/
13721369
if (cmp_psn(qp->s_psn, psn) <= 0)
13731370
reset_psn(qp, psn + 1);
1374-
} else if (cmp_psn(qp->s_psn, psn) <= 0) {
1375-
qp->s_state = OP(SEND_LAST);
1376-
qp->s_psn = psn + 1;
1371+
} else {
1372+
/* No more acks - kill all timers */
1373+
hfi1_stop_rc_timers(qp);
1374+
if (cmp_psn(qp->s_psn, psn) <= 0) {
1375+
qp->s_state = OP(SEND_LAST);
1376+
qp->s_psn = psn + 1;
1377+
}
13771378
}
13781379
if (qp->s_flags & RVT_S_WAIT_ACK) {
13791380
qp->s_flags &= ~RVT_S_WAIT_ACK;
@@ -1383,15 +1384,14 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
13831384
qp->s_rnr_retry = qp->s_rnr_retry_cnt;
13841385
qp->s_retry = qp->s_retry_cnt;
13851386
update_last_psn(qp, psn);
1386-
ret = 1;
1387-
goto bail;
1387+
return 1;
13881388

13891389
case 1: /* RNR NAK */
13901390
ibp->rvp.n_rnr_naks++;
13911391
if (qp->s_acked == qp->s_tail)
1392-
goto bail;
1392+
goto bail_stop;
13931393
if (qp->s_flags & RVT_S_WAIT_RNR)
1394-
goto bail;
1394+
goto bail_stop;
13951395
if (qp->s_rnr_retry == 0) {
13961396
status = IB_WC_RNR_RETRY_EXC_ERR;
13971397
goto class_b;
@@ -1407,15 +1407,16 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
14071407
reset_psn(qp, psn);
14081408

14091409
qp->s_flags &= ~(RVT_S_WAIT_SSN_CREDIT | RVT_S_WAIT_ACK);
1410+
hfi1_stop_rc_timers(qp);
14101411
to =
14111412
ib_hfi1_rnr_table[(aeth >> HFI1_AETH_CREDIT_SHIFT) &
14121413
HFI1_AETH_CREDIT_MASK];
14131414
hfi1_add_rnr_timer(qp, to);
1414-
goto bail;
1415+
return 0;
14151416

14161417
case 3: /* NAK */
14171418
if (qp->s_acked == qp->s_tail)
1418-
goto bail;
1419+
goto bail_stop;
14191420
/* The last valid PSN is the previous PSN. */
14201421
update_last_psn(qp, psn - 1);
14211422
switch ((aeth >> HFI1_AETH_CREDIT_SHIFT) &
@@ -1458,15 +1459,16 @@ static int do_rc_ack(struct rvt_qp *qp, u32 aeth, u32 psn, int opcode,
14581459
}
14591460
qp->s_retry = qp->s_retry_cnt;
14601461
qp->s_rnr_retry = qp->s_rnr_retry_cnt;
1461-
goto bail;
1462+
goto bail_stop;
14621463

14631464
default: /* 2: reserved */
14641465
reserved:
14651466
/* Ignore reserved NAK codes. */
1466-
goto bail;
1467+
goto bail_stop;
14671468
}
1468-
1469-
bail:
1469+
return ret;
1470+
bail_stop:
1471+
hfi1_stop_rc_timers(qp);
14701472
return ret;
14711473
}
14721474

0 commit comments

Comments
 (0)