Lines Matching defs:hc_entry
315 tcp_hc_cmp(struct hc_metrics *hc_entry, const struct in_conninfo *inc)
320 if (memcmp(&inc->inc6_faddr, &hc_entry->ip6,
324 if (memcmp(&inc->inc_faddr, &hc_entry->ip4,
340 struct hc_metrics *hc_entry;
350 CK_SLIST_FOREACH(hc_entry, &hc_head->hch_bucket, hc_q)
351 if (tcp_hc_cmp(hc_entry, inc))
354 if (hc_entry != NULL) {
355 if (atomic_load_int(&hc_entry->hc_expire) !=
357 atomic_store_int(&hc_entry->hc_expire,
360 hc_entry->hc_hits++;
365 return (hc_entry);
377 struct hc_metrics *hc_entry;
387 hc_entry = tcp_hc_lookup(inc);
392 if (hc_entry == NULL) {
397 hc_metrics_lite->hc_mtu = atomic_load_32(&hc_entry->hc_mtu);
398 hc_metrics_lite->hc_ssthresh = atomic_load_32(&hc_entry->hc_ssthresh);
399 hc_metrics_lite->hc_rtt = atomic_load_32(&hc_entry->hc_rtt);
400 hc_metrics_lite->hc_rttvar = atomic_load_32(&hc_entry->hc_rttvar);
401 hc_metrics_lite->hc_cwnd = atomic_load_32(&hc_entry->hc_cwnd);
402 hc_metrics_lite->hc_sendpipe = atomic_load_32(&hc_entry->hc_sendpipe);
403 hc_metrics_lite->hc_recvpipe = atomic_load_32(&hc_entry->hc_recvpipe);
416 struct hc_metrics *hc_entry;
422 hc_entry = tcp_hc_lookup(inc);
423 if (hc_entry == NULL) {
427 mtu = atomic_load_32(&hc_entry->hc_mtu);
453 struct hc_metrics *hc_entry, *hc_prev;
464 CK_SLIST_FOREACH(hc_entry, &hc_head->hch_bucket, hc_q) {
465 if (tcp_hc_cmp(hc_entry, inc))
467 if (CK_SLIST_NEXT(hc_entry, hc_q) != NULL)
468 hc_prev = hc_entry;
471 if (hc_entry != NULL) {
472 if (atomic_load_int(&hc_entry->hc_expire) !=
474 atomic_store_int(&hc_entry->hc_expire,
477 hc_entry->hc_updates++;
495 hc_entry = CK_SLIST_NEXT(hc_prev, hc_q);
496 KASSERT(CK_SLIST_NEXT(hc_entry, hc_q) == NULL,
500 } else if ((hc_entry =
502 KASSERT(CK_SLIST_NEXT(hc_entry, hc_q) == NULL,
504 __func__, hc_entry));
518 uma_zfree_smr(V_tcp_hostcache.zone, hc_entry);
524 hc_entry = uma_zalloc_smr(V_tcp_hostcache.zone, M_NOWAIT);
525 if (hc_entry == NULL) {
533 bzero(hc_entry, sizeof(*hc_entry));
535 hc_entry->ip6 = inc->inc6_faddr;
536 hc_entry->ip6_zoneid = inc->inc6_zoneid;
538 hc_entry->ip4 = inc->inc_faddr;
539 hc_entry->hc_expire = V_tcp_hostcache.expire;
548 atomic_store_32(&hc_entry->hc_mtu, hcml->hc_mtu);
551 if (hc_entry->hc_rtt == 0)
554 v = ((uint64_t)hc_entry->hc_rtt +
556 atomic_store_32(&hc_entry->hc_rtt, v);
560 if (hc_entry->hc_rttvar == 0)
563 v = ((uint64_t)hc_entry->hc_rttvar +
565 atomic_store_32(&hc_entry->hc_rttvar, v);
569 if (hc_entry->hc_ssthresh == 0)
572 v = (hc_entry->hc_ssthresh + hcml->hc_ssthresh) / 2;
573 atomic_store_32(&hc_entry->hc_ssthresh, v);
577 if (hc_entry->hc_cwnd == 0)
580 v = ((uint64_t)hc_entry->hc_cwnd +
582 atomic_store_32(&hc_entry->hc_cwnd, v);
586 if (hc_entry->hc_sendpipe == 0)
589 v = ((uint64_t)hc_entry->hc_sendpipe +
591 atomic_store_32(&hc_entry->hc_sendpipe, v);
595 if (hc_entry->hc_recvpipe == 0)
598 v = ((uint64_t)hc_entry->hc_recvpipe +
600 atomic_store_32(&hc_entry->hc_recvpipe, v);
608 CK_SLIST_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, hc_q);
614 } else if (hc_entry != CK_SLIST_FIRST(&hc_head->hch_bucket)) {
615 KASSERT(CK_SLIST_NEXT(hc_prev, hc_q) == hc_entry,
616 ("%s: %p next is not %p", __func__, hc_prev, hc_entry));
618 CK_SLIST_INSERT_HEAD(&hc_head->hch_bucket, hc_entry, hc_q);
633 struct hc_metrics *hc_entry;
670 CK_SLIST_FOREACH(hc_entry,
678 hc_entry->ip4.s_addr ?
679 inet_ntoa_r(hc_entry->ip4, ip4buf) :
681 ip6_sprintf(ip6buf, &hc_entry->ip6),
685 hc_entry->hc_mtu,
686 hc_entry->hc_ssthresh,
687 msec((u_long)hc_entry->hc_rtt *
689 msec((u_long)hc_entry->hc_rttvar *
691 hc_entry->hc_cwnd,
692 hc_entry->hc_sendpipe,
693 hc_entry->hc_recvpipe,
695 hc_entry->hc_hits,
696 hc_entry->hc_updates,
698 hc_entry->hc_expire);
758 struct hc_metrics *hc_entry, *hc_next, *hc_prev;
765 CK_SLIST_FOREACH_SAFE(hc_entry, &head->hch_bucket, hc_q,
772 atomic_load_int(&hc_entry->hc_expire) <= 0) {
774 KASSERT(hc_entry ==
777 __func__, hc_entry, hc_prev));
780 KASSERT(hc_entry ==
783 __func__, hc_entry));
787 uma_zfree_smr(V_tcp_hostcache.zone, hc_entry);
791 atomic_subtract_int(&hc_entry->hc_expire,
793 hc_prev = hc_entry;