The branch main has been updated by glebius:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=0c25bf7e7c1877c88788f63005de525f2847b1d8

commit 0c25bf7e7c1877c88788f63005de525f2847b1d8
Author:     Gleb Smirnoff <[email protected]>
AuthorDate: 2021-04-08 21:15:42 +0000
Commit:     Gleb Smirnoff <[email protected]>
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;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main
To unsubscribe, send any mail to "[email protected]"

Reply via email to