summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_timer.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/netinet/sctp_timer.c')
-rw-r--r--sys/netinet/sctp_timer.c151
1 files changed, 71 insertions, 80 deletions
diff --git a/sys/netinet/sctp_timer.c b/sys/netinet/sctp_timer.c
index b66ca43..9e17dd0 100644
--- a/sys/netinet/sctp_timer.c
+++ b/sys/netinet/sctp_timer.c
@@ -120,10 +120,10 @@ sctp_early_fr_timer(struct sctp_inpcb *inp,
continue;
}
}
-#ifdef SCTP_EARLYFR_LOGGING
- sctp_log_fr(chk->rec.data.TSN_seq, chk->snd_count,
- 4, SCTP_FR_MARKED_EARLY);
-#endif
+ if (sctp_logging_level & SCTP_EARLYFR_LOGGING_ENABLE) {
+ sctp_log_fr(chk->rec.data.TSN_seq, chk->snd_count,
+ 4, SCTP_FR_MARKED_EARLY);
+ }
SCTP_STAT_INCR(sctps_earlyfrmrkretrans);
chk->sent = SCTP_DATAGRAM_RESEND;
sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
@@ -137,11 +137,9 @@ sctp_early_fr_timer(struct sctp_inpcb *inp,
}
}
if (cnt) {
-#ifdef SCTP_CWND_MONITOR
int old_cwnd;
old_cwnd = net->cwnd;
-#endif
sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_EARLY_FR_TMR);
/*
* make a small adjustment to cwnd and force to CA.
@@ -153,9 +151,9 @@ sctp_early_fr_timer(struct sctp_inpcb *inp,
if (net->cwnd < net->ssthresh)
/* still in SS move to CA */
net->ssthresh = net->cwnd - 1;
-#ifdef SCTP_CWND_MONITOR
- sctp_log_cwnd(stcb, net, (old_cwnd - net->cwnd), SCTP_CWND_LOG_FROM_FR);
-#endif
+ if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ sctp_log_cwnd(stcb, net, (old_cwnd - net->cwnd), SCTP_CWND_LOG_FROM_FR);
+ }
} else if (cnt_resend) {
sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_EARLY_FR_TMR);
}
@@ -399,10 +397,8 @@ sctp_backoff_on_timeout(struct sctp_tcb *stcb,
}
if ((win_probe == 0) && num_marked) {
/* We don't apply penalty to window probe scenarios */
-#ifdef SCTP_CWND_MONITOR
int old_cwnd = net->cwnd;
-#endif
net->ssthresh = net->cwnd >> 1;
if (net->ssthresh < (net->mtu << 1)) {
net->ssthresh = (net->mtu << 1);
@@ -411,10 +407,9 @@ sctp_backoff_on_timeout(struct sctp_tcb *stcb,
/* floor of 1 mtu */
if (net->cwnd < net->mtu)
net->cwnd = net->mtu;
-#ifdef SCTP_CWND_MONITOR
- sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX);
-#endif
-
+ if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ sctp_log_cwnd(stcb, net, net->cwnd - old_cwnd, SCTP_CWND_LOG_FROM_RTX);
+ }
net->partial_bytes_acked = 0;
}
}
@@ -469,17 +464,17 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
/* get cur rto in micro-seconds */
cur_rtt = (((net->lastsa >> 2) + net->lastsv) >> 1);
cur_rtt *= 1000;
-#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
- sctp_log_fr(cur_rtt,
- stcb->asoc.peers_rwnd,
- window_probe,
- SCTP_FR_T3_MARK_TIME);
- sctp_log_fr(net->flight_size,
- SCTP_OS_TIMER_PENDING(&net->fr_timer.timer),
- SCTP_OS_TIMER_ACTIVE(&net->fr_timer.timer),
- SCTP_FR_CWND_REPORT);
- sctp_log_fr(net->flight_size, net->cwnd, stcb->asoc.total_flight, SCTP_FR_CWND_REPORT);
-#endif
+ if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
+ sctp_log_fr(cur_rtt,
+ stcb->asoc.peers_rwnd,
+ window_probe,
+ SCTP_FR_T3_MARK_TIME);
+ sctp_log_fr(net->flight_size,
+ SCTP_OS_TIMER_PENDING(&net->fr_timer.timer),
+ SCTP_OS_TIMER_ACTIVE(&net->fr_timer.timer),
+ SCTP_FR_CWND_REPORT);
+ sctp_log_fr(net->flight_size, net->cwnd, stcb->asoc.total_flight, SCTP_FR_CWND_REPORT);
+ }
tv.tv_sec = cur_rtt / 1000000;
tv.tv_usec = cur_rtt % 1000000;
min_wait = now;
@@ -493,10 +488,10 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
*/
min_wait.tv_sec = min_wait.tv_usec = 0;
}
-#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
- sctp_log_fr(cur_rtt, now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME);
- sctp_log_fr(0, min_wait.tv_sec, min_wait.tv_usec, SCTP_FR_T3_MARK_TIME);
-#endif
+ if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
+ sctp_log_fr(cur_rtt, now.tv_sec, now.tv_usec, SCTP_FR_T3_MARK_TIME);
+ sctp_log_fr(0, min_wait.tv_sec, min_wait.tv_usec, SCTP_FR_T3_MARK_TIME);
+ }
/*
* Our rwnd will be incorrect here since we are not adding back the
* cnt * mbuf but we will fix that down below.
@@ -529,24 +524,24 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
*/
/* validate its been outstanding long enough */
-#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
- sctp_log_fr(chk->rec.data.TSN_seq,
- chk->sent_rcv_time.tv_sec,
- chk->sent_rcv_time.tv_usec,
- SCTP_FR_T3_MARK_TIME);
-#endif
+ if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
+ sctp_log_fr(chk->rec.data.TSN_seq,
+ chk->sent_rcv_time.tv_sec,
+ chk->sent_rcv_time.tv_usec,
+ SCTP_FR_T3_MARK_TIME);
+ }
if ((chk->sent_rcv_time.tv_sec > min_wait.tv_sec) && (window_probe == 0)) {
/*
* we have reached a chunk that was sent
* some seconds past our min.. forget it we
* will find no more to send.
*/
-#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
- sctp_log_fr(0,
- chk->sent_rcv_time.tv_sec,
- chk->sent_rcv_time.tv_usec,
- SCTP_FR_T3_STOPPED);
-#endif
+ if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
+ sctp_log_fr(0,
+ chk->sent_rcv_time.tv_sec,
+ chk->sent_rcv_time.tv_usec,
+ SCTP_FR_T3_STOPPED);
+ }
continue;
} else if ((chk->sent_rcv_time.tv_sec == min_wait.tv_sec) &&
(window_probe == 0)) {
@@ -559,12 +554,12 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
* ok it was sent after our boundary
* time.
*/
-#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
- sctp_log_fr(0,
- chk->sent_rcv_time.tv_sec,
- chk->sent_rcv_time.tv_usec,
- SCTP_FR_T3_STOPPED);
-#endif
+ if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
+ sctp_log_fr(0,
+ chk->sent_rcv_time.tv_sec,
+ chk->sent_rcv_time.tv_usec,
+ SCTP_FR_T3_STOPPED);
+ }
continue;
}
}
@@ -603,11 +598,10 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
tsnfirst = chk->rec.data.TSN_seq;
}
tsnlast = chk->rec.data.TSN_seq;
-#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
- sctp_log_fr(chk->rec.data.TSN_seq, chk->snd_count,
- 0, SCTP_FR_T3_MARKED);
-
-#endif
+ if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
+ sctp_log_fr(chk->rec.data.TSN_seq, chk->snd_count,
+ 0, SCTP_FR_T3_MARKED);
+ }
if (chk->rec.data.chunk_was_revoked) {
/* deflate the cwnd */
chk->whoTo->cwnd -= chk->book_size;
@@ -615,13 +609,13 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
}
net->marked_retrans++;
stcb->asoc.marked_retrans++;
-#ifdef SCTP_FLIGHT_LOGGING
- sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND_TO,
- chk->whoTo->flight_size,
- chk->book_size,
- (uintptr_t) chk->whoTo,
- chk->rec.data.TSN_seq);
-#endif
+ if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) {
+ sctp_misc_ints(SCTP_FLIGHT_LOG_DOWN_RSND_TO,
+ chk->whoTo->flight_size,
+ chk->book_size,
+ (uintptr_t) chk->whoTo,
+ chk->rec.data.TSN_seq);
+ }
sctp_flight_size_decrease(chk);
sctp_total_flight_decrease(stcb, chk);
stcb->asoc.peers_rwnd += chk->send_size;
@@ -665,9 +659,9 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
/* we did not subtract the same things? */
audit_tf = 1;
}
-#if defined(SCTP_FR_LOGGING) || defined(SCTP_EARLYFR_LOGGING)
- sctp_log_fr(tsnfirst, tsnlast, num_mk, SCTP_FR_T3_TIMEOUT);
-#endif
+ if (sctp_logging_level & (SCTP_EARLYFR_LOGGING_ENABLE | SCTP_FR_LOGGING_ENABLE)) {
+ sctp_log_fr(tsnfirst, tsnlast, num_mk, SCTP_FR_T3_TIMEOUT);
+ }
#ifdef SCTP_DEBUG
if (num_mk) {
SCTPDBG(SCTP_DEBUG_TIMER1, "LAST TSN marked was %x\n",
@@ -725,14 +719,13 @@ sctp_mark_all_for_resend(struct sctp_tcb *stcb,
}
TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) {
if (chk->sent < SCTP_DATAGRAM_RESEND) {
-#ifdef SCTP_FLIGHT_LOGGING
- sctp_misc_ints(SCTP_FLIGHT_LOG_UP,
- chk->whoTo->flight_size,
- chk->book_size,
- (uintptr_t) chk->whoTo,
- chk->rec.data.TSN_seq);
-#endif
-
+ if (sctp_logging_level & SCTP_FLIGHT_LOGGING_ENABLE) {
+ sctp_misc_ints(SCTP_FLIGHT_LOG_UP,
+ chk->whoTo->flight_size,
+ chk->book_size,
+ (uintptr_t) chk->whoTo,
+ chk->rec.data.TSN_seq);
+ }
sctp_flight_size_increase(chk);
sctp_total_flight_increase(stcb, chk);
}
@@ -804,10 +797,10 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
struct sctp_nets *alt;
int win_probe, num_mk;
-#ifdef SCTP_FR_LOGGING
- sctp_log_fr(0, 0, 0, SCTP_FR_T3_TIMEOUT);
-#ifdef SCTP_CWND_LOGGING
- {
+ if (sctp_logging_level & SCTP_FR_LOGGING_ENABLE) {
+ sctp_log_fr(0, 0, 0, SCTP_FR_T3_TIMEOUT);
+ }
+ if (sctp_logging_level & SCTP_CWND_LOGGING_ENABLE) {
struct sctp_nets *lnet;
TAILQ_FOREACH(lnet, &stcb->asoc.nets, sctp_next) {
@@ -818,8 +811,6 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
}
}
}
-#endif
-#endif
/* Find an alternate and mark those for retransmission */
if ((stcb->asoc.peers_rwnd == 0) &&
(stcb->asoc.total_flight < net->mtu)) {
@@ -972,9 +963,9 @@ sctp_t3rxt_timer(struct sctp_inpcb *inp,
}
}
}
-#ifdef SCTP_CWND_MONITOR
- sctp_log_cwnd(stcb, net, net->cwnd, SCTP_CWND_LOG_FROM_RTX);
-#endif
+ if (sctp_logging_level & SCTP_CWND_MONITOR_ENABLE) {
+ sctp_log_cwnd(stcb, net, net->cwnd, SCTP_CWND_LOG_FROM_RTX);
+ }
return (0);
}
OpenPOWER on IntegriCloud