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

Function bbr_calc_time

freebsd/netinet/tcp_stacks/bbr.c:1108–1131  ·  view source on GitHub ↗

* Considers the two time values now (cts) and earlier. * If cts is smaller than earlier, we could have * had a sequence wrap (our counter wraps every * 70 min or so) or it could be just clock skew * getting us two differnt time values. Clock skew * will show up within 10ms or so. So in such * a case (where cts is behind earlier time by * less than 10ms) we return 0. Otherwise we * return t

Source from the content-addressed store, hash-verified

1106 * return the true difference between them.
1107 */
1108static inline uint32_t
1109bbr_calc_time(uint32_t cts, uint32_t earlier_time) {
1110 /*
1111 * Given two timestamps, the current time stamp cts, and some other
1112 * time-stamp taken in theory earlier return the difference. The
1113 * trick is here sometimes locking will get the other timestamp
1114 * after the cts. If this occurs we need to return 0.
1115 */
1116 if (TSTMP_GEQ(cts, earlier_time))
1117 return (cts - earlier_time);
1118 /*
1119 * cts is behind earlier_time if its less than 10ms consider it 0.
1120 * If its more than 10ms difference then we had a time wrap. Else
1121 * its just the normal locking foo. I wonder if we should not go to
1122 * 64bit TS and get rid of this issue.
1123 */
1124 if (TSTMP_GEQ((cts + 10000), earlier_time))
1125 return (0);
1126 /*
1127 * Ok the time must have wrapped. So we need to answer a large
1128 * amount of time, which the normal subtraction should do.
1129 */
1130 return (cts - earlier_time);
1131}
1132
1133static int
1134sysctl_bbr_clear_lost(SYSCTL_HANDLER_ARGS)

Callers 6

bbr_set_pktepochFunction · 0.85
bbr_exit_persistFunction · 0.85
bbr_state_startupFunction · 0.85
bbr_state_changeFunction · 0.85
bbr.cFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected