Skip to content

Commit 402cba0

Browse files
committed
usnic: fix wraparound sequence number issue
Sequence numbers will wrap around; it is not sufficient to check for (seq-1) -- must use the SEQ_DIFF macro to properly handle the wraparound. This bug wasn't serious; it just meant we might retransmit one or two extra times when retransmits were triggerd and the sequence numbers wrapped around their sliding windows. (cherry picked from commit open-mpi/ompi@d624e0d)
1 parent ef6928d commit 402cba0

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

opal/mca/btl/usnic/btl_usnic_ack.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013-2015 Cisco Systems, Inc. All rights reserved.
2+
* Copyright (c) 2013-2016 Cisco Systems, Inc. All rights reserved.
33
* $COPYRIGHT$
44
*
55
* Additional copyrights may follow
@@ -207,8 +207,7 @@ opal_btl_usnic_ack_send(
207207
/* send the seq of the lowest item in the window that
208208
we've received */
209209
ack->ss_base.us_btl_header->ack_seq =
210-
endpoint->endpoint_next_contig_seq_to_recv - 1;
211-
210+
SEQ_DIFF(endpoint->endpoint_next_contig_seq_to_recv, 1);
212211
ack->ss_len = sizeof(opal_btl_usnic_btl_header_t);
213212

214213
#if MSGDEBUG1

opal/mca/btl/usnic/btl_usnic_ack.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013-2015 Cisco Systems, Inc. All rights reserved.
2+
* Copyright (c) 2013-2016 Cisco Systems, Inc. All rights reserved.
33
* $COPYRIGHT$
44
*
55
* Additional copyrights may follow
@@ -92,7 +92,7 @@ opal_btl_usnic_piggyback_ack(
9292
if (endpoint->endpoint_ack_needed) {
9393
opal_btl_usnic_remove_from_endpoints_needing_ack(endpoint);
9494
sseg->ss_base.us_btl_header->ack_seq =
95-
endpoint->endpoint_next_contig_seq_to_recv - 1;
95+
SEQ_DIFF(endpoint->endpoint_next_contig_seq_to_recv, 1);
9696
sseg->ss_base.us_btl_header->ack_present = 1;
9797
#if MSGDEBUG1
9898
opal_output(0, "Piggy-backing ACK for sequence %"UDSEQ"\n",

opal/mca/btl/usnic/btl_usnic_stats.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013-2015 Cisco Systems, Inc. All rights reserved.
2+
* Copyright (c) 2013-2016 Cisco Systems, Inc. All rights reserved.
33
* $COPYRIGHT$
44
*
55
* Additional copyrights may follow
@@ -145,8 +145,9 @@ void opal_btl_usnic_print_stats(
145145
/* Number of un-acked sends (i.e., sends for which we're
146146
still waiting for ACK) */
147147
send_unacked =
148-
endpoint->endpoint_next_seq_to_send -
149-
endpoint->endpoint_ack_seq_rcvd - 1;
148+
SEQ_DIFF(endpoint->endpoint_next_seq_to_send,
149+
SEQ_DIFF(endpoint->endpoint_ack_seq_rcvd, 1));
150+
150151
if (send_unacked > su_max) su_max = send_unacked;
151152
if (send_unacked < su_min) su_min = send_unacked;
152153

0 commit comments

Comments
 (0)