Skip to content

Commit

Permalink
added rto counter, fast-recovery counter and packet retransmit counter
Browse files Browse the repository at this point in the history
  • Loading branch information
jthomas43 committed Jun 6, 2024
1 parent 30f67cf commit 3187b97
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
11 changes: 10 additions & 1 deletion examples/udxperf.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@

static bool is_server;
static bool is_client;
static bool extra_wanted;
char *addr_string;
static struct sockaddr_in laddr;
static struct sockaddr_in raddr;
Expand Down Expand Up @@ -273,7 +274,11 @@ print_interval (udxperf_client_t *client, uint64_t bytes, uint64_t start, uint64
byte_snprintf(bps_buf, sizeof bps_buf, bytes / time_sec, 'a');
bps_buf[19] = '\0';

printf("[%3d] %6.4f-%6.4f sec %s %s/sec\n", stream->local_id, (start - client->start_time) / 1000.0, (end - client->start_time) / 1000.0, bytes_buf, bps_buf);
printf("[%3d] %6.4f-%6.4f sec %s %s/sec", stream->local_id, (start - client->start_time) / 1000.0, (end - client->start_time) / 1000.0, bytes_buf, bps_buf, stream->cwnd);
if (is_client && extra_wanted) {
printf(" cwnd=%d ssthresh=%d fast_recovery_count=%d rto_count=%d rtx_count=%d", stream->cwnd, stream->ssthresh, stream->fast_recovery_count, stream->rto_count, stream->retransmit_count);
}
printf("\n");
}

static void
Expand Down Expand Up @@ -520,6 +525,7 @@ typedef enum {
SW_T,
SW_I,
SW_P,
SW_X,
} switch_type_t;

int
Expand Down Expand Up @@ -547,6 +553,9 @@ main (int argc, char **argv) {
is_server = true;
time_ms = -1L;
break;
case 'x':
extra_wanted = true;
break;
default:
printf("unrecognized switch '%s'\n", argv[i]);
usage();
Expand Down
3 changes: 3 additions & 0 deletions include/udx.h
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ struct udx_stream_s {
uint8_t ca_state;
uint32_t high_seq; // seq at time of congestion, marks end of recovery
bool hit_high_watermark;
uint16_t rto_count;
uint16_t fast_recovery_count;
uint16_t retransmit_count;
size_t writes_queued_bytes;

bool reordering_seen;
Expand Down
13 changes: 10 additions & 3 deletions src/udx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,9 +1015,10 @@ udx__confirm_packet (udx_packet_t *pkt) {
debug_printf("tlp: sent seq=%u %s\n", stream->tlp_end_seq, stream->tlp_is_retrans ? " retransmission" : "");
}

// if (pkt->transmits > 1) {
// debug_printf("retransmit: seq=%u tmit=%d\n", pkt->seq, pkt->transmits);
// }
if (pkt->transmits > 1) {
debug_printf("retransmit: seq=%u tmit=%d\n", pkt->seq, pkt->transmits);
stream->retransmit_count++;
}

udx__cirbuf_set(&stream->outgoing, (udx_cirbuf_val_t *) pkt);

Expand Down Expand Up @@ -1237,6 +1238,8 @@ rack_detect_loss (udx_stream_t *stream) {
debug_printf("rack: rid=%u lost=%d mtu_probe_lost=%d\n", stream->remote_id, resending, mtu_probes_lost);
// debug_print_outgoing(stream);

stream->fast_recovery_count++;

// recover until the full window is acked
stream->ca_state = UDX_CA_RECOVERY;
stream->high_seq = stream->seq;
Expand Down Expand Up @@ -1274,6 +1277,7 @@ udx_rto_timeout (uv_timer_t *timer) {

// exit fast recovery if we are in it
stream->high_seq = stream->seq;
stream->rto_count++;
stream->ca_state = UDX_CA_LOSS;

// rack 7.1 TLP_init
Expand Down Expand Up @@ -2163,6 +2167,9 @@ udx_stream_init (udx_t *udx, udx_stream_t *stream, uint32_t local_id, udx_stream
stream->udx = udx;

stream->reordering_seen = false;
stream->rto_count = 0;
stream->fast_recovery_count = 0;
stream->retransmit_count = 0;

stream->hit_high_watermark = false;
stream->writes_queued_bytes = 0;
Expand Down

0 comments on commit 3187b97

Please sign in to comment.