Skip to content

Commit 40fe575

Browse files
committed
usnic: trivial updates (no code/logic changes)
- Add more explanatory comments - Trivial whitespace / style updates - Rename opal_btl_usnic_force_retrans() -> opal_btl_usnic_fast_retrans() Signed-off-by: Jeff Squyres <[email protected]>
1 parent 3593fad commit 40fe575

File tree

7 files changed

+53
-30
lines changed

7 files changed

+53
-30
lines changed

opal/mca/btl/usnic/btl_usnic_ack.c

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,24 @@
2626
#include "btl_usnic_connectivity.h"
2727

2828
/*
29-
* Force a retrans of a segment
29+
* Special case: we know exactly which segment is missing at the
30+
* receive; explicitly force retrans of that segment.
3031
*/
3132
static void
32-
opal_btl_usnic_force_retrans(
33+
opal_btl_usnic_fast_retrans(
3334
opal_btl_usnic_endpoint_t *endpoint,
3435
opal_btl_usnic_seq_t ack_seq)
3536
{
3637
opal_btl_usnic_send_segment_t *sseg;
3738
int is;
3839

39-
is = WINDOW_SIZE_MOD(ack_seq+1);
40+
is = WINDOW_SIZE_MOD(ack_seq + 1);
4041
sseg = endpoint->endpoint_sent_segs[is];
42+
43+
// If the sseg is NULL, then there's nothing to retransmit. If
44+
// the hotel room is -1, the segment has already been queued up
45+
// for retransmit and there's nothing additional we need to do
46+
// here.
4147
if (sseg == NULL || sseg->ss_hotel_room == -1) {
4248
return;
4349
}
@@ -79,12 +85,14 @@ opal_btl_usnic_handle_ack(
7985
#endif
8086
++module->stats.num_old_dup_acks;
8187
return;
88+
}
8289

83-
/* A duplicate ACK means next seg was lost */
84-
} else if (ack_seq == endpoint->endpoint_ack_seq_rcvd) {
90+
/* A duplicate ACK means the sender did not receive the next
91+
seg that we sent */
92+
else if (ack_seq == endpoint->endpoint_ack_seq_rcvd) {
8593
++module->stats.num_dup_acks;
8694

87-
opal_btl_usnic_force_retrans(endpoint, ack_seq);
95+
opal_btl_usnic_fast_retrans(endpoint, ack_seq);
8896
return;
8997
}
9098

@@ -114,12 +122,11 @@ opal_btl_usnic_handle_ack(
114122
already been evicted and queued for resend.
115123
If it's not in the hotel, don't check it out! */
116124
if (OPAL_LIKELY(sseg->ss_hotel_room != -1)) {
117-
118125
opal_hotel_checkout(&endpoint->endpoint_hotel, sseg->ss_hotel_room);
119126
sseg->ss_hotel_room = -1;
120-
127+
}
121128
/* hotel_room == -1 means queued for resend, remove it */
122-
} else {
129+
else {
123130
opal_list_remove_item((&module->pending_resend_segs),
124131
&sseg->ss_base.us_list.super);
125132
}
@@ -291,4 +298,3 @@ opal_btl_usnic_ack_timeout(
291298
/* Stats */
292299
++module->stats.num_timeout_retrans;
293300
}
294-

opal/mca/btl/usnic/btl_usnic_component.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* All rights reserved.
1313
* Copyright (c) 2006 Sandia National Laboratories. All rights
1414
* reserved.
15-
* Copyright (c) 2008-2016 Cisco Systems, Inc. All rights reserved.
15+
* Copyright (c) 2008-2017 Cisco Systems, Inc. All rights reserved.
1616
* Copyright (c) 2012-2014 Los Alamos National Security, LLC. All rights
1717
* reserved.
1818
* Copyright (c) 2014 Intel, Inc. All rights reserved.
@@ -1202,13 +1202,15 @@ static int usnic_handle_completion(
12021202
(opal_btl_usnic_ack_segment_t *)seg);
12031203
break;
12041204

1205-
/**** Send of frag segment completion ****/
1205+
/**** Send of frag segment completion (i.e., the MPI message's
1206+
one-and-only segment has completed sending) ****/
12061207
case OPAL_BTL_USNIC_SEG_FRAG:
12071208
opal_btl_usnic_frag_send_complete(module,
12081209
(opal_btl_usnic_frag_segment_t*)seg);
12091210
break;
12101211

1211-
/**** Send of chunk segment completion ****/
1212+
/**** Send of chunk segment completion (i.e., part of a large MPI
1213+
message is done sending) ****/
12121214
case OPAL_BTL_USNIC_SEG_CHUNK:
12131215
opal_btl_usnic_chunk_send_complete(module,
12141216
(opal_btl_usnic_chunk_segment_t*)seg);

opal/mca/btl/usnic/btl_usnic_endpoint.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2006 Sandia National Laboratories. All rights
1313
* reserved.
14-
* Copyright (c) 2013-2016 Cisco Systems, Inc. All rights reserved.
14+
* Copyright (c) 2013-2017 Cisco Systems, Inc. All rights reserved.
1515
* $COPYRIGHT$
1616
*
1717
* Additional copyrights may follow
@@ -160,6 +160,8 @@ typedef struct mca_btl_base_endpoint_t {
160160
opal_btl_usnic_seq_t endpoint_next_seq_to_send; /* n_t */
161161
opal_btl_usnic_seq_t endpoint_ack_seq_rcvd; /* n_a */
162162

163+
/* Table where sent segments sit while waiting for their ACKs.
164+
When a segment is ACKed, it is removed from this table. */
163165
struct opal_btl_usnic_send_segment_t *endpoint_sent_segs[WINDOW_SIZE];
164166

165167
/* Values for the current proc to receive from this endpoint on

opal/mca/btl/usnic/btl_usnic_module.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ usnic_do_resends(
987987
/* resends are always standard segments */
988988
sseg->ss_channel = USNIC_DATA_CHANNEL;
989989

990-
/* re-send the segment */
990+
/* re-send the segment (we have a send credit available) */
991991
opal_btl_usnic_post_segment(module, endpoint, sseg);
992992

993993
/* consume a send credit for this endpoint. May send us
@@ -1017,6 +1017,9 @@ usnic_do_resends(
10171017
* endpoint_send_segment() it. Takes care of subsequent frag
10181018
* cleanup/bookkeeping (dequeue, descriptor callback, etc.) if this frag was
10191019
* completed by this segment.
1020+
*
1021+
* ASSUMES THAT THE CALLER HAS ALREADY CHECKED TO SEE IF WE HAVE
1022+
* A SEND CREDIT!
10201023
*/
10211024
static void
10221025
usnic_handle_large_send(
@@ -1070,7 +1073,8 @@ usnic_handle_large_send(
10701073
/* payload length into the header*/
10711074
sseg->ss_base.us_btl_header->payload_len = payload_len;
10721075

1073-
/* do the send */
1076+
// We assume that the caller has checked to see that we have a
1077+
// send credit, so do the send.
10741078
opal_btl_usnic_endpoint_send_segment(module, sseg);
10751079

10761080
/* do fragment bookkeeping */
@@ -1182,7 +1186,7 @@ opal_btl_usnic_module_progress_sends(
11821186
sseg->ss_base.us_btl_header->tag);
11831187
#endif
11841188

1185-
/* post the send */
1189+
/* post the send (we have a send credit available) */
11861190
opal_btl_usnic_endpoint_send_segment(module, sseg);
11871191

11881192
/* don't do callback yet if this is a put */
@@ -1342,7 +1346,7 @@ usnic_send(
13421346
opal_output(0, "INLINE send, sseg=%p", (void *)sseg);
13431347
#endif
13441348

1345-
/* post the segment now */
1349+
/* post the segment now (we have a send credit available) */
13461350
opal_btl_usnic_endpoint_send_segment(module, sseg);
13471351

13481352
/* If we own the frag and callback was requested, callback now,

opal/mca/btl/usnic/btl_usnic_module.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ typedef struct opal_btl_usnic_channel_t {
7171
int chan_rd_num;
7272
int chan_sd_num;
7373

74-
int credits; /* RFXXX until libfab credits fixed */
74+
int credits;
7575
uint32_t rx_post_cnt;
7676

7777
/* fastsend enabled if num_credits_available >= fastsend_wqe_thresh */

opal/mca/btl/usnic/btl_usnic_send.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* All rights reserved.
1212
* Copyright (c) 2006 Sandia National Laboratories. All rights
1313
* reserved.
14-
* Copyright (c) 2008-2015 Cisco Systems, Inc. All rights reserved.
14+
* Copyright (c) 2008-2017 Cisco Systems, Inc. All rights reserved.
1515
* Copyright (c) 2012 Los Alamos National Security, LLC. All rights
1616
* reserved.
1717
* $COPYRIGHT$
@@ -43,8 +43,9 @@
4343

4444

4545
/*
46-
* This function is called when a send of a full-fragment segment completes
47-
* Return the WQE and also return the segment if no ACK pending
46+
* This function is called when a send of a segment completes that is
47+
* the one-and-only segment of an MPI message. Return the WQE and
48+
* also return the segment if no ACK pending.
4849
*/
4950
void
5051
opal_btl_usnic_frag_send_complete(opal_btl_usnic_module_t *module,
@@ -71,8 +72,10 @@ opal_btl_usnic_frag_send_complete(opal_btl_usnic_module_t *module,
7172
}
7273

7374
/*
74-
* This function is called when a send segment completes
75-
* Return the WQE and also return the segment if no ACK pending
75+
* This function is called when a send segment completes that is part
76+
* of a larger MPI message (ie., there may still be other chunk
77+
* segments that have not yet completed sending). Return the WQE and
78+
* also return the segment if no ACK pending.
7679
*/
7780
void
7881
opal_btl_usnic_chunk_send_complete(opal_btl_usnic_module_t *module,

opal/mca/btl/usnic/btl_usnic_send.h

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013-2016 Cisco Systems, Inc. All rights reserved.
2+
* Copyright (c) 2013-2017 Cisco Systems, Inc. All rights reserved.
33
* $COPYRIGHT$
44
*
55
* Additional copyrights may follow
@@ -52,7 +52,10 @@ opal_btl_usnic_check_rts(
5252
}
5353

5454
/*
55-
* Common point for posting a segment
55+
* Common point for posting a segment.
56+
*
57+
* ASSUMES THAT THE CALLER HAS ALREADY CHECKED TO SEE IF WE HAVE
58+
* A SEND CREDIT!
5659
*/
5760
static inline void
5861
opal_btl_usnic_post_segment(
@@ -105,6 +108,9 @@ opal_btl_usnic_post_segment(
105108

106109
/*
107110
* Common point for posting an ACK
111+
*
112+
* ASSUMES THAT THE CALLER HAS ALREADY CHECKED TO SEE IF WE HAVE
113+
* A SEND CREDIT!
108114
*/
109115
static inline void
110116
opal_btl_usnic_post_ack(
@@ -230,10 +236,10 @@ opal_btl_usnic_endpoint_send_segment(
230236
/* do the actual send */
231237
opal_btl_usnic_post_segment(module, endpoint, sseg);
232238

233-
/* Track this header by stashing in an array on the endpoint that
234-
is the same length as the sender's window (i.e., WINDOW_SIZE).
235-
To find a unique slot in this array, use (seq % WINDOW_SIZE).
236-
*/
239+
/* Stash this segment in an array on the endpoint that is the same
240+
length as the sender's window (i.e., WINDOW_SIZE) until it
241+
receives its ACK. To find a unique slot in this array, use
242+
(seq % WINDOW_SIZE). */
237243
sfi = WINDOW_SIZE_MOD(sseg->ss_base.us_btl_header->pkt_seq);
238244
endpoint->endpoint_sent_segs[sfi] = sseg;
239245
sseg->ss_ack_pending = true;

0 commit comments

Comments
 (0)