MCPcopy Create free account
hub / github.com/F-Stack/f-stack / rack_do_decay

Function rack_do_decay

freebsd/netinet/tcp_stacks/rack.c:7398–7453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7396}
7397
7398static void
7399rack_do_decay(struct tcp_rack *rack)
7400{
7401 struct timeval res;
7402
7403#define timersub(tvp, uvp, vvp) \
7404 do { \
7405 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
7406 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
7407 if ((vvp)->tv_usec < 0) { \
7408 (vvp)->tv_sec--; \
7409 (vvp)->tv_usec += 1000000; \
7410 } \
7411 } while (0)
7412
7413 timersub(&rack->r_ctl.act_rcv_time, &rack->r_ctl.rc_last_time_decay, &res);
7414#undef timersub
7415
7416 rack->r_ctl.input_pkt++;
7417 if ((rack->rc_in_persist) ||
7418 (res.tv_sec >= 1) ||
7419 (rack->rc_tp->snd_max == rack->rc_tp->snd_una)) {
7420 /*
7421 * Check for decay of non-SAD,
7422 * we want all SAD detection metrics to
7423 * decay 1/4 per second (or more) passed.
7424 */
7425 uint32_t pkt_delta;
7426
7427 pkt_delta = rack->r_ctl.input_pkt - rack->r_ctl.saved_input_pkt;
7428 /* Update our saved tracking values */
7429 rack->r_ctl.saved_input_pkt = rack->r_ctl.input_pkt;
7430 rack->r_ctl.rc_last_time_decay = rack->r_ctl.act_rcv_time;
7431 /* Now do we escape without decay? */
7432#ifdef NETFLIX_EXP_DETECTION
7433 if (rack->rc_in_persist ||
7434 (rack->rc_tp->snd_max == rack->rc_tp->snd_una) ||
7435 (pkt_delta < tcp_sad_low_pps)){
7436 /*
7437 * We don't decay idle connections
7438 * or ones that have a low input pps.
7439 */
7440 return;
7441 }
7442 /* Decay the counters */
7443 rack->r_ctl.ack_count = ctf_decay_count(rack->r_ctl.ack_count,
7444 tcp_sad_decay_val);
7445 rack->r_ctl.sack_count = ctf_decay_count(rack->r_ctl.sack_count,
7446 tcp_sad_decay_val);
7447 rack->r_ctl.sack_moved_extra = ctf_decay_count(rack->r_ctl.sack_moved_extra,
7448 tcp_sad_decay_val);
7449 rack->r_ctl.sack_noextra_move = ctf_decay_count(rack->r_ctl.sack_noextra_move,
7450 tcp_sad_decay_val);
7451#endif
7452 }
7453}
7454
7455static void

Callers 1

rack_log_ackFunction · 0.85

Calls 1

ctf_decay_countFunction · 0.85

Tested by

no test coverage detected