Date: Fri, 9 Apr 2021 21:21:06 GMT From: Gleb Smirnoff <glebius@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 0c25bf7e7c18 - main - tcp_hostcache: implement tcp_hc_updatemtu() via tcp_hc_update. Locking changes are planned here, and without this change too much copy-and-paste would be between these two functions. Message-ID: <202104092121.139LL6eb021646@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=0c25bf7e7c1877c88788f63005de525f2847b1d8 commit 0c25bf7e7c1877c88788f63005de525f2847b1d8 Author: Gleb Smirnoff <glebius@FreeBSD.org> AuthorDate: 2021-04-08 21:15:42 +0000 Commit: Gleb Smirnoff <glebius@FreeBSD.org> CommitDate: 2021-04-09 21:06:44 +0000 tcp_hostcache: implement tcp_hc_updatemtu() via tcp_hc_update. Locking changes are planned here, and without this change too much copy-and-paste would be between these two functions. Reviewed by: rscheff --- sys/netinet/tcp_hostcache.c | 35 +++++------------------------------ 1 file 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;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202104092121.139LL6eb021646>