* 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
| 1106 | * return the true difference between them. |
| 1107 | */ |
| 1108 | static inline uint32_t |
| 1109 | bbr_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 | |
| 1133 | static int |
| 1134 | sysctl_bbr_clear_lost(SYSCTL_HANDLER_ARGS) |
no outgoing calls
no test coverage detected