aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2021-04-08 21:15:42 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2021-04-09 21:06:44 +0000
commit0c25bf7e7c1877c88788f63005de525f2847b1d8 (patch)
tree0d4c34719beddaba2b0e33311834167e8bd7b13b /sys
parente8b9c508b7ae5be618ada089103468c400e465cd (diff)
downloadsrc-0c25bf7e7c1877c88788f63005de525f2847b1d8.tar.gz
src-0c25bf7e7c1877c88788f63005de525f2847b1d8.zip
Diffstat (limited to 'sys')
-rw-r--r--sys/netinet/tcp_hostcache.c35
1 files changed, 5 insertions, 30 deletions
diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c
index 7bc79b781a30..130b08425096 100644
--- a/sys/netinet/tcp_hostcache.c
+++ b/sys/netinet/tcp_hostcache.c
@@ -559,37 +559,9 @@ tcp_hc_getmtu(struct in_conninfo *inc)
void
tcp_hc_updatemtu(struct in_conninfo *inc, uint32_t mtu)
{
- struct hc_metrics *hc_entry;
-
- if (!V_tcp_use_hostcache)
- return;
-
- /*
- * Find the right bucket.
- */
- hc_entry = tcp_hc_lookup(inc, true);
-
- /*
- * If we don't have an existing object, try to insert a new one.
- */
- if (hc_entry == NULL) {
- hc_entry = tcp_hc_insert(inc);
- if (hc_entry == NULL)
- return;
- }
-
- hc_entry->rmx_mtu = mtu;
-
- /*
- * Put it upfront so we find it faster next time.
- */
- TAILQ_REMOVE(&hc_entry->rmx_head->hch_bucket, hc_entry, rmx_q);
- TAILQ_INSERT_HEAD(&hc_entry->rmx_head->hch_bucket, hc_entry, rmx_q);
+ struct hc_metrics_lite hcml = { .rmx_mtu = mtu };
- /*
- * Unlock bucket row.
- */
- THC_UNLOCK(&hc_entry->rmx_head->hch_mtx);
+ return (tcp_hc_update(inc, &hcml));
}
/*
@@ -611,6 +583,9 @@ tcp_hc_update(struct in_conninfo *inc, struct hc_metrics_lite *hcml)
return;
}
+ if (hcml->rmx_mtu != 0) {
+ hc_entry->rmx_mtu = hcml->rmx_mtu;
+ }
if (hcml->rmx_rtt != 0) {
if (hc_entry->rmx_rtt == 0)
hc_entry->rmx_rtt = hcml->rmx_rtt;