git: 3789810845f1 - main - tcp: avoid bcopy() in tcp_mss_update()

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Thu, 21 Nov 2024 00:39:13 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=3789810845f14102c88ca31f7dccb18621b960a0

commit 3789810845f14102c88ca31f7dccb18621b960a0
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2024-11-21 00:35:59 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2024-11-21 00:37:24 +0000

    tcp: avoid bcopy() in tcp_mss_update()
---
 sys/netinet/tcp_input.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index f9ecdf93cc47..03d493b1d7a9 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -3877,19 +3877,16 @@ tcp_mss_update(struct tcpcb *tp, int offer, int mtuoffer,
 			offer = max(offer, V_tcp_minmss);
 	}
 
-	/*
-	 * rmx information is now retrieved from tcp_hostcache.
-	 */
-	tcp_hc_get(&inp->inp_inc, &metrics);
-	if (metricptr != NULL)
-		bcopy(&metrics, metricptr, sizeof(struct hc_metrics_lite));
+	if (metricptr == NULL)
+		metricptr = &metrics;
+	tcp_hc_get(&inp->inp_inc, metricptr);
 
 	/*
 	 * If there's a discovered mtu in tcp hostcache, use it.
 	 * Else, use the link mtu.
 	 */
-	if (metrics.hc_mtu)
-		mss = min(metrics.hc_mtu, maxmtu) - min_protoh;
+	if (metricptr->hc_mtu)
+		mss = min(metricptr->hc_mtu, maxmtu) - min_protoh;
 	else {
 #ifdef INET6
 		if (isipv6) {