MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tcp_hc_get

Function tcp_hc_get

freebsd/netinet/tcp_hostcache.c:438–475  ·  view source on GitHub ↗

* External function: look up an entry in the hostcache and fill out the * supplied TCP metrics structure. Fills in NULL when no entry was found or * a value is not set. */

Source from the content-addressed store, hash-verified

436 * a value is not set.
437 */
438void
439tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite)
440{
441 struct hc_metrics *hc_entry;
442
443 if (!V_tcp_use_hostcache) {
444 bzero(hc_metrics_lite, sizeof(*hc_metrics_lite));
445 return;
446 }
447
448 /*
449 * Find the right bucket.
450 */
451 hc_entry = tcp_hc_lookup(inc);
452
453 /*
454 * If we don't have an existing object.
455 */
456 if (hc_entry == NULL) {
457 bzero(hc_metrics_lite, sizeof(*hc_metrics_lite));
458 return;
459 }
460 hc_entry->rmx_hits++;
461 hc_entry->rmx_expire = V_tcp_hostcache.expire; /* start over again */
462
463 hc_metrics_lite->rmx_mtu = hc_entry->rmx_mtu;
464 hc_metrics_lite->rmx_ssthresh = hc_entry->rmx_ssthresh;
465 hc_metrics_lite->rmx_rtt = hc_entry->rmx_rtt;
466 hc_metrics_lite->rmx_rttvar = hc_entry->rmx_rttvar;
467 hc_metrics_lite->rmx_cwnd = hc_entry->rmx_cwnd;
468 hc_metrics_lite->rmx_sendpipe = hc_entry->rmx_sendpipe;
469 hc_metrics_lite->rmx_recvpipe = hc_entry->rmx_recvpipe;
470
471 /*
472 * Unlock bucket row.
473 */
474 THC_UNLOCK(&hc_entry->rmx_head->hch_mtx);
475}
476
477/*
478 * External function: look up an entry in the hostcache and return the

Callers 2

cc_conn_initFunction · 0.85
tcp_mss_updateFunction · 0.85

Calls 2

bzeroFunction · 0.85
tcp_hc_lookupFunction · 0.85

Tested by

no test coverage detected