| 893 | } |
| 894 | |
| 895 | uint32_t |
| 896 | ctf_decay_count(uint32_t count, uint32_t decay) |
| 897 | { |
| 898 | /* |
| 899 | * Given a count, decay it by a set percentage. The |
| 900 | * percentage is in thousands i.e. 100% = 1000, |
| 901 | * 19.3% = 193. |
| 902 | */ |
| 903 | uint64_t perc_count, decay_per; |
| 904 | uint32_t decayed_count; |
| 905 | if (decay > 1000) { |
| 906 | /* We don't raise it */ |
| 907 | return (count); |
| 908 | } |
| 909 | perc_count = count; |
| 910 | decay_per = decay; |
| 911 | perc_count *= decay_per; |
| 912 | perc_count /= 1000; |
| 913 | /* |
| 914 | * So now perc_count holds the |
| 915 | * count decay value. |
| 916 | */ |
| 917 | decayed_count = count - (uint32_t)perc_count; |
| 918 | return(decayed_count); |
| 919 | } |
| 920 | |
| 921 | int32_t |
| 922 | ctf_progress_timeout_check(struct tcpcb *tp, bool log) |