Lines Matching refs:tpheur
668 struct tcp_heuristic *__single tpheur = NULL; in tcp_getheuristic_with_lock() local
680 SLIST_FOREACH(tpheur, &head->tcp_heuristics, list) { in tcp_getheuristic_with_lock()
681 if (memcmp(&tpheur->th_key, &key, sizeof(key)) == 0) { in tcp_getheuristic_with_lock()
689 if ((tpheur == NULL) && create) { in tcp_getheuristic_with_lock()
695 SLIST_FOREACH(tpheur, &head->tcp_heuristics, list) { in tcp_getheuristic_with_lock()
696 uint32_t age = tcp_now - tpheur->th_last_access; in tcp_getheuristic_with_lock()
699 oldest_heur = tpheur; in tcp_getheuristic_with_lock()
704 tpheur = oldest_heur; in tcp_getheuristic_with_lock()
707 uint8_t *ptr = (uint8_t *)(struct tcp_heuristic *__indexable)tpheur; in tcp_getheuristic_with_lock()
713 tpheur = kalloc_type(struct tcp_heuristic, Z_NOPAGEWAIT | Z_ZERO); in tcp_getheuristic_with_lock()
714 if (tpheur == NULL) { in tcp_getheuristic_with_lock()
719 SLIST_INSERT_HEAD(&head->tcp_heuristics, tpheur, list); in tcp_getheuristic_with_lock()
726 tpheur->th_ecn_backoff = tcp_now; in tcp_getheuristic_with_lock()
727 tpheur->th_tfo_backoff_until = tcp_now; in tcp_getheuristic_with_lock()
728 tpheur->th_mptcp_backoff = tcp_now; in tcp_getheuristic_with_lock()
729 tpheur->th_tfo_backoff = tcp_min_to_hz(tcp_ecn_timeout); in tcp_getheuristic_with_lock()
731 memcpy(&tpheur->th_key, &key, sizeof(key)); in tcp_getheuristic_with_lock()
734 if (tpheur == NULL) { in tcp_getheuristic_with_lock()
739 tpheur->th_last_access = tcp_now; in tcp_getheuristic_with_lock()
742 return tpheur; in tcp_getheuristic_with_lock()
753 struct tcp_heuristic *__single tpheur; in tcp_heuristic_reset_counters() local
759 tpheur = tcp_getheuristic_with_lock(tcks, 1, &head); in tcp_heuristic_reset_counters()
760 if (tpheur == NULL) { in tcp_heuristic_reset_counters()
765 if (tpheur->th_tfo_data_loss >= TFO_MAX_COOKIE_LOSS) { in tcp_heuristic_reset_counters()
767 __func__, tpheur->th_tfo_data_loss, (unsigned long)VM_KERNEL_ADDRPERM(tpheur)); in tcp_heuristic_reset_counters()
769 tpheur->th_tfo_data_loss = 0; in tcp_heuristic_reset_counters()
773 if (tpheur->th_tfo_req_loss >= TFO_MAX_COOKIE_LOSS) { in tcp_heuristic_reset_counters()
775 __func__, tpheur->th_tfo_req_loss, (unsigned long)VM_KERNEL_ADDRPERM(tpheur)); in tcp_heuristic_reset_counters()
777 tpheur->th_tfo_req_loss = 0; in tcp_heuristic_reset_counters()
781 if (tpheur->th_tfo_data_rst >= TFO_MAX_COOKIE_LOSS) { in tcp_heuristic_reset_counters()
783 __func__, tpheur->th_tfo_data_rst, (unsigned long)VM_KERNEL_ADDRPERM(tpheur)); in tcp_heuristic_reset_counters()
785 tpheur->th_tfo_data_rst = 0; in tcp_heuristic_reset_counters()
789 if (tpheur->th_tfo_req_rst >= TFO_MAX_COOKIE_LOSS) { in tcp_heuristic_reset_counters()
791 __func__, tpheur->th_tfo_req_rst, (unsigned long)VM_KERNEL_ADDRPERM(tpheur)); in tcp_heuristic_reset_counters()
793 tpheur->th_tfo_req_rst = 0; in tcp_heuristic_reset_counters()
797 tpheur->th_ecn_loss = 0; in tcp_heuristic_reset_counters()
798 tpheur->th_ecn_aggressive = 0; in tcp_heuristic_reset_counters()
799 tpheur->th_ecn_synrst = 0; in tcp_heuristic_reset_counters()
800 tpheur->th_ecn_droprst = 0; in tcp_heuristic_reset_counters()
804 tpheur->th_mptcp_loss = 0; in tcp_heuristic_reset_counters()
805 if (tpheur->th_mptcp_success < MPTCP_SUCCESS_TRIGGER) { in tcp_heuristic_reset_counters()
806 tpheur->th_mptcp_success++; in tcp_heuristic_reset_counters()
808 if (tpheur->th_mptcp_success == MPTCP_SUCCESS_TRIGGER) { in tcp_heuristic_reset_counters()
810 tpheur->th_mptcp_heuristic_disabled = 1; in tcp_heuristic_reset_counters()
812 tpheur->th_mptcp_backoff = tcp_now + tcp_min_to_hz(tcp_ecn_timeout * 12); in tcp_heuristic_reset_counters()
858 __tcp_heuristic_tfo_middlebox_common(struct tcp_heuristic *tpheur) in __tcp_heuristic_tfo_middlebox_common() argument
860 if (tpheur->th_tfo_in_backoff) { in __tcp_heuristic_tfo_middlebox_common()
864 tpheur->th_tfo_in_backoff = 1; in __tcp_heuristic_tfo_middlebox_common()
866 if (tpheur->th_tfo_enabled_time) { in __tcp_heuristic_tfo_middlebox_common()
867 uint32_t old_backoff = tpheur->th_tfo_backoff; in __tcp_heuristic_tfo_middlebox_common()
869 tpheur->th_tfo_backoff -= (tcp_now - tpheur->th_tfo_enabled_time); in __tcp_heuristic_tfo_middlebox_common()
870 if (tpheur->th_tfo_backoff > old_backoff) { in __tcp_heuristic_tfo_middlebox_common()
871 tpheur->th_tfo_backoff = tcp_min_to_hz(tcp_ecn_timeout); in __tcp_heuristic_tfo_middlebox_common()
875 tpheur->th_tfo_backoff_until = tcp_now + tpheur->th_tfo_backoff; in __tcp_heuristic_tfo_middlebox_common()
878 tpheur->th_tfo_backoff *= 2; in __tcp_heuristic_tfo_middlebox_common()
880 if (tpheur->th_tfo_backoff > tcp_min_to_hz(tcp_backoff_maximum)) { in __tcp_heuristic_tfo_middlebox_common()
881 tpheur->th_tfo_backoff = tcp_min_to_hz(tcp_ecn_timeout); in __tcp_heuristic_tfo_middlebox_common()
885 tpheur->th_tfo_backoff_until, tcp_now, (unsigned long)VM_KERNEL_ADDRPERM(tpheur)); in __tcp_heuristic_tfo_middlebox_common()
892 struct tcp_heuristic *__single tpheur; in tcp_heuristic_tfo_middlebox_common() local
894 tpheur = tcp_getheuristic_with_lock(tcks, 1, &head); in tcp_heuristic_tfo_middlebox_common()
895 if (tpheur == NULL) { in tcp_heuristic_tfo_middlebox_common()
899 __tcp_heuristic_tfo_middlebox_common(tpheur); in tcp_heuristic_tfo_middlebox_common()
909 struct tcp_heuristic *__single tpheur; in tcp_heuristic_inc_counters() local
911 tpheur = tcp_getheuristic_with_lock(tcks, 1, &head); in tcp_heuristic_inc_counters()
912 if (tpheur == NULL) { in tcp_heuristic_inc_counters()
917 if ((flags & TCPCACHE_F_TFO_DATA) && tpheur->th_tfo_data_loss < TCP_CACHE_OVERFLOW_PROTECT) { in tcp_heuristic_inc_counters()
918 tpheur->th_tfo_data_loss++; in tcp_heuristic_inc_counters()
920 if (tpheur->th_tfo_data_loss >= TFO_MAX_COOKIE_LOSS) { in tcp_heuristic_inc_counters()
921 __tcp_heuristic_tfo_middlebox_common(tpheur); in tcp_heuristic_inc_counters()
925 if ((flags & TCPCACHE_F_TFO_REQ) && tpheur->th_tfo_req_loss < TCP_CACHE_OVERFLOW_PROTECT) { in tcp_heuristic_inc_counters()
926 tpheur->th_tfo_req_loss++; in tcp_heuristic_inc_counters()
928 if (tpheur->th_tfo_req_loss >= TFO_MAX_COOKIE_LOSS) { in tcp_heuristic_inc_counters()
929 __tcp_heuristic_tfo_middlebox_common(tpheur); in tcp_heuristic_inc_counters()
933 if ((flags & TCPCACHE_F_TFO_DATA_RST) && tpheur->th_tfo_data_rst < TCP_CACHE_OVERFLOW_PROTECT) { in tcp_heuristic_inc_counters()
934 tpheur->th_tfo_data_rst++; in tcp_heuristic_inc_counters()
936 if (tpheur->th_tfo_data_rst >= TFO_MAX_COOKIE_LOSS) { in tcp_heuristic_inc_counters()
937 __tcp_heuristic_tfo_middlebox_common(tpheur); in tcp_heuristic_inc_counters()
941 if ((flags & TCPCACHE_F_TFO_REQ_RST) && tpheur->th_tfo_req_rst < TCP_CACHE_OVERFLOW_PROTECT) { in tcp_heuristic_inc_counters()
942 tpheur->th_tfo_req_rst++; in tcp_heuristic_inc_counters()
944 if (tpheur->th_tfo_req_rst >= TFO_MAX_COOKIE_LOSS) { in tcp_heuristic_inc_counters()
945 __tcp_heuristic_tfo_middlebox_common(tpheur); in tcp_heuristic_inc_counters()
950 tpheur->th_mptcp_loss < TCP_CACHE_OVERFLOW_PROTECT && in tcp_heuristic_inc_counters()
951 tpheur->th_mptcp_heuristic_disabled == 0) { in tcp_heuristic_inc_counters()
952 tpheur->th_mptcp_loss++; in tcp_heuristic_inc_counters()
953 if (tpheur->th_mptcp_loss >= MPTCP_MAX_SYN_LOSS) { in tcp_heuristic_inc_counters()
958 tpheur->th_mptcp_backoff = tcp_now + in tcp_heuristic_inc_counters()
960 (tpheur->th_mptcp_loss - MPTCP_MAX_SYN_LOSS)); in tcp_heuristic_inc_counters()
961 tpheur->th_mptcp_in_backoff = 1; in tcp_heuristic_inc_counters()
964 __func__, tpheur->th_mptcp_backoff, tcp_now, in tcp_heuristic_inc_counters()
965 (unsigned long)VM_KERNEL_ADDRPERM(tpheur)); in tcp_heuristic_inc_counters()
970 tpheur->th_ecn_loss < TCP_CACHE_OVERFLOW_PROTECT && in tcp_heuristic_inc_counters()
971 TSTMP_LEQ(tpheur->th_ecn_backoff, tcp_now)) { in tcp_heuristic_inc_counters()
972 tpheur->th_ecn_loss++; in tcp_heuristic_inc_counters()
973 if (tpheur->th_ecn_loss >= ECN_MAX_SYN_LOSS) { in tcp_heuristic_inc_counters()
976 tpheur->th_ecn_backoff = tcp_now + in tcp_heuristic_inc_counters()
978 (tpheur->th_ecn_loss - ECN_MAX_SYN_LOSS)); in tcp_heuristic_inc_counters()
983 tpheur->th_ecn_aggressive < TCP_CACHE_OVERFLOW_PROTECT && in tcp_heuristic_inc_counters()
984 TSTMP_LEQ(tpheur->th_ecn_backoff, tcp_now)) { in tcp_heuristic_inc_counters()
985 tpheur->th_ecn_aggressive++; in tcp_heuristic_inc_counters()
986 if (tpheur->th_ecn_aggressive >= ECN_MAX_CE_AGGRESSIVE) { in tcp_heuristic_inc_counters()
989 tpheur->th_ecn_backoff = tcp_now + in tcp_heuristic_inc_counters()
991 (tpheur->th_ecn_aggressive - ECN_MAX_CE_AGGRESSIVE)); in tcp_heuristic_inc_counters()
996 tpheur->th_ecn_droprst < TCP_CACHE_OVERFLOW_PROTECT && in tcp_heuristic_inc_counters()
997 TSTMP_LEQ(tpheur->th_ecn_backoff, tcp_now)) { in tcp_heuristic_inc_counters()
998 tpheur->th_ecn_droprst++; in tcp_heuristic_inc_counters()
999 if (tpheur->th_ecn_droprst >= ECN_MAX_DROPRST) { in tcp_heuristic_inc_counters()
1003 tpheur->th_ecn_backoff = tcp_now + in tcp_heuristic_inc_counters()
1005 (tpheur->th_ecn_droprst - ECN_MAX_DROPRST)); in tcp_heuristic_inc_counters()
1010 tpheur->th_ecn_synrst < TCP_CACHE_OVERFLOW_PROTECT) { in tcp_heuristic_inc_counters()
1011 tpheur->th_ecn_synrst++; in tcp_heuristic_inc_counters()
1012 if (tpheur->th_ecn_synrst >= ECN_MAX_SYNRST) { in tcp_heuristic_inc_counters()
1016 tpheur->th_ecn_backoff = tcp_now + in tcp_heuristic_inc_counters()
1018 (tpheur->th_ecn_synrst - ECN_MAX_SYNRST)); in tcp_heuristic_inc_counters()
1136 struct tcp_heuristic *__single tpheur; in tcp_heuristic_do_tfo_common() local
1143 tpheur = tcp_getheuristic_with_lock(tcks, 0, &head); in tcp_heuristic_do_tfo_common()
1144 if (tpheur == NULL) { in tcp_heuristic_do_tfo_common()
1148 if (tpheur->th_tfo_in_backoff == 0) { in tcp_heuristic_do_tfo_common()
1152 if (TSTMP_GT(tcp_now, tpheur->th_tfo_backoff_until)) { in tcp_heuristic_do_tfo_common()
1153 tpheur->th_tfo_in_backoff = 0; in tcp_heuristic_do_tfo_common()
1154 tpheur->th_tfo_enabled_time = tcp_now; in tcp_heuristic_do_tfo_common()
1190 struct tcp_heuristic *__single tpheur; in tcp_heuristic_do_mptcp() local
1201 tpheur = tcp_getheuristic_with_lock(&tcks, 0, &head); in tcp_heuristic_do_mptcp()
1202 if (tpheur == NULL) { in tcp_heuristic_do_mptcp()
1206 if (tpheur->th_mptcp_in_backoff == 0 || in tcp_heuristic_do_mptcp()
1207 tpheur->th_mptcp_heuristic_disabled == 1) { in tcp_heuristic_do_mptcp()
1211 if (TSTMP_GT(tpheur->th_mptcp_backoff, tcp_now)) { in tcp_heuristic_do_mptcp()
1215 tpheur->th_mptcp_in_backoff = 0; in tcp_heuristic_do_mptcp()
1218 if (tpheur->th_mptcp_heuristic_disabled) { in tcp_heuristic_do_mptcp()
1221 if (TSTMP_GT(tcp_now, tpheur->th_mptcp_backoff)) { in tcp_heuristic_do_mptcp()
1222 tpheur->th_mptcp_heuristic_disabled = 0; in tcp_heuristic_do_mptcp()
1223 tpheur->th_mptcp_success = 0; in tcp_heuristic_do_mptcp()
1248 struct tcp_heuristic *__single tpheur; in tcp_heuristic_do_ecn_common() local
1256 tpheur = tcp_getheuristic_with_lock(tcks, 0, &head); in tcp_heuristic_do_ecn_common()
1257 if (tpheur == NULL) { in tcp_heuristic_do_ecn_common()
1261 if (TSTMP_GT(tpheur->th_ecn_backoff, tcp_now)) { in tcp_heuristic_do_ecn_common()
1265 if (tpheur->th_ecn_droprst >= ECN_RETRY_LIMIT) { in tcp_heuristic_do_ecn_common()
1266 tpheur->th_ecn_droprst = 0; in tcp_heuristic_do_ecn_common()
1269 if (tpheur->th_ecn_synrst >= ECN_RETRY_LIMIT) { in tcp_heuristic_do_ecn_common()
1270 tpheur->th_ecn_synrst = 0; in tcp_heuristic_do_ecn_common()
1274 tpheur->th_ecn_backoff = tcp_now; in tcp_heuristic_do_ecn_common()
1497 struct tcp_heuristic *__single tpheur, *__single htmp; in sysctl_cleartfocache() local
1507 SLIST_FOREACH_SAFE(tpheur, &hhead->tcp_heuristics, list, htmp) { in sysctl_cleartfocache()
1508 SLIST_REMOVE(&hhead->tcp_heuristics, tpheur, tcp_heuristic, list); in sysctl_cleartfocache()
1509 kfree_type(struct tcp_heuristic, tpheur); in sysctl_cleartfocache()
1571 struct tcp_heuristic *tpheur; variable
1574 SLIST_FOREACH(tpheur, &head->tcp_heuristics, list) {
1594 struct tcp_heuristic *tpheur; variable
1597 SLIST_FOREACH(tpheur, &head->tcp_heuristics, list) {
1601 heur_data.th_last_access = tpheur->th_last_access;
1603 heur_data.th_key = tpheur->th_key;
1605 heur_data.th_key.thk_family = tpheur->th_key.thk_family;
1607 heur_data.th_tfo_data_loss = tpheur->th_tfo_data_loss;
1608 heur_data.th_tfo_req_loss = tpheur->th_tfo_req_loss;
1609 heur_data.th_tfo_data_rst = tpheur->th_tfo_data_rst;
1610 heur_data.th_tfo_req_rst = tpheur->th_tfo_req_rst;
1611 heur_data.th_mptcp_loss = tpheur->th_mptcp_loss;
1612 heur_data.th_mptcp_success = tpheur->th_mptcp_success;
1613 heur_data.th_ecn_droprst = tpheur->th_ecn_droprst;
1614 heur_data.th_ecn_synrst = tpheur->th_ecn_synrst;
1615 heur_data.th_tfo_enabled_time = tpheur->th_tfo_enabled_time;
1616 heur_data.th_tfo_backoff_until = tpheur->th_tfo_backoff_until;
1617 heur_data.th_tfo_backoff = tpheur->th_tfo_backoff;
1618 heur_data.th_mptcp_backoff = tpheur->th_mptcp_backoff;
1619 heur_data.th_ecn_backoff = tpheur->th_ecn_backoff;
1620 heur_data.th_tfo_in_backoff = tpheur->th_tfo_in_backoff;
1621 heur_data.th_mptcp_in_backoff = tpheur->th_mptcp_in_backoff;
1622 heur_data.th_mptcp_heuristic_disabled = tpheur->th_mptcp_heuristic_disabled;