Lines Matching refs:tpcache

332 	struct tcp_cache *tpcache = NULL;  in tcp_getcache_with_lock()  local
344 SLIST_FOREACH(tpcache, &head->tcp_caches, list) { in tcp_getcache_with_lock()
345 if (memcmp(&tpcache->tc_key, &key, sizeof(key)) == 0) { in tcp_getcache_with_lock()
353 if ((tpcache == NULL) && create) { in tcp_getcache_with_lock()
359 SLIST_FOREACH(tpcache, &head->tcp_caches, list) { in tcp_getcache_with_lock()
360 uint32_t age = tcp_now - tpcache->tc_last_access; in tcp_getcache_with_lock()
363 oldest_cache = tpcache; in tcp_getcache_with_lock()
368 tpcache = oldest_cache; in tcp_getcache_with_lock()
371 tpcache->tc_tfo_cookie_len = 0; in tcp_getcache_with_lock()
374 tpcache = kalloc_type(struct tcp_cache, Z_NOWAIT | Z_ZERO); in tcp_getcache_with_lock()
375 if (tpcache == NULL) { in tcp_getcache_with_lock()
380 tpcache->tc_mptcp_version = (uint8_t)mptcp_preferred_version; in tcp_getcache_with_lock()
381 tpcache->tc_mptcp_next_version_try = tcp_now; in tcp_getcache_with_lock()
383 SLIST_INSERT_HEAD(&head->tcp_caches, tpcache, list); in tcp_getcache_with_lock()
386 memcpy(&tpcache->tc_key, &key, sizeof(key)); in tcp_getcache_with_lock()
389 if (tpcache == NULL) { in tcp_getcache_with_lock()
394 tpcache->tc_last_access = tcp_now; in tcp_getcache_with_lock()
397 return tpcache; in tcp_getcache_with_lock()
445 struct tcp_cache *tpcache; in tcp_cache_set_cookie_common() local
448 tpcache = tcp_getcache_with_lock(tcks, 1, &head); in tcp_cache_set_cookie_common()
449 if (tpcache == NULL) { in tcp_cache_set_cookie_common()
453 tpcache->tc_tfo_cookie_len = len > TFO_COOKIE_LEN_MAX ? in tcp_cache_set_cookie_common()
455 memcpy(tpcache->tc_tfo_cookie, cookie, tpcache->tc_tfo_cookie_len); in tcp_cache_set_cookie_common()
473 struct tcp_cache *tpcache; in tcp_cache_get_cookie_common() local
476 tpcache = tcp_getcache_with_lock(tcks, 1, &head); in tcp_cache_get_cookie_common()
477 if (tpcache == NULL) { in tcp_cache_get_cookie_common()
481 if (tpcache->tc_tfo_cookie_len == 0) { in tcp_cache_get_cookie_common()
490 VERIFY(tpcache->tc_tfo_cookie_len <= *len); in tcp_cache_get_cookie_common()
492 memcpy(cookie, tpcache->tc_tfo_cookie, tpcache->tc_tfo_cookie_len); in tcp_cache_get_cookie_common()
493 *len = tpcache->tc_tfo_cookie_len; in tcp_cache_get_cookie_common()
521 struct tcp_cache *tpcache; in tcp_cache_get_cookie_len_common() local
525 tpcache = tcp_getcache_with_lock(tcks, 1, &head); in tcp_cache_get_cookie_len_common()
526 if (tpcache == NULL) { in tcp_cache_get_cookie_len_common()
530 cookie_len = tpcache->tc_tfo_cookie_len; in tcp_cache_get_cookie_len_common()
559 struct tcp_cache *tpcache; in tcp_cache_get_mptcp_version() local
562 tpcache = tcp_getcache_with_lock(&tcks, 1, &head); in tcp_cache_get_mptcp_version()
563 if (tpcache == NULL) { in tcp_cache_get_mptcp_version()
567 version = tpcache->tc_mptcp_version; in tcp_cache_get_mptcp_version()
570 if (!tpcache->tc_mptcp_version_confirmed && in tcp_cache_get_mptcp_version()
572 TSTMP_GEQ(tcp_now, tpcache->tc_mptcp_next_version_try)) { in tcp_cache_get_mptcp_version()
587 struct tcp_cache *tpcache; in tcp_cache_update_mptcp_version() local
606 tpcache = tcp_getcache_with_lock(&tcks, 1, &head); in tcp_cache_update_mptcp_version()
607 if (tpcache == NULL) { in tcp_cache_update_mptcp_version()
612 if (tpcache->tc_mptcp_version_confirmed) { in tcp_cache_update_mptcp_version()
619 tpcache->tc_mptcp_version_confirmed = true; in tcp_cache_update_mptcp_version()
620 tpcache->tc_mptcp_version = version; in tcp_cache_update_mptcp_version()
625 if (TSTMP_GEQ(tcp_now, tpcache->tc_mptcp_next_version_try)) { in tcp_cache_update_mptcp_version()
626 tpcache->tc_mptcp_next_version_try = tcp_now + tcp_min_to_hz(mptcp_version_timeout); in tcp_cache_update_mptcp_version()
632 tpcache->tc_mptcp_version = version == MPTCP_VERSION_0 ? MPTCP_VERSION_1 : MPTCP_VERSION_0; in tcp_cache_update_mptcp_version()
637 if (TSTMP_GEQ(tcp_now, tpcache->tc_mptcp_next_version_try)) { in tcp_cache_update_mptcp_version()
638 tpcache->tc_mptcp_next_version_try = tcp_now + tcp_min_to_hz(mptcp_version_timeout); in tcp_cache_update_mptcp_version()
1530 struct tcp_cache *tpcache, *tmp; in sysctl_cleartfocache() local
1535 SLIST_FOREACH_SAFE(tpcache, &head->tcp_caches, list, tmp) { in sysctl_cleartfocache()
1536 SLIST_REMOVE(&head->tcp_caches, tpcache, tcp_cache, list); in sysctl_cleartfocache()
1537 kfree_type(struct tcp_cache, tpcache); in sysctl_cleartfocache()