From nobody Thu Nov 21 00:39:11 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XtzrH3Qw4z5dxsF; Thu, 21 Nov 2024 00:39:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XtzrH2b8Pz4Gy3; Thu, 21 Nov 2024 00:39:11 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732149551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ilIiT2rBxNNVmZeKtqKdsbR/vV6h1BRFZxTCYTjlOJQ=; b=ts/mSp1d7nO0BTBLpQ8CY+lMaZcK7zfHOZKM7XqljOEBTChRKbmv2G+3vsQ4UoJnrA2cpA 8VK9LaHJWVXtwexXLWetGp+76DFnBP02KS8GCoU+W6WJwcw1cVhtbe2wg7JvxkGZt/olzr MiXyvBXB0LwfcpN6EUtSKVMFzWgYZPIU+hh7g7C5hsUSpny4lEVEavB5WKHuY/2u49RkhB yaIW6l+uifSoivEjalA2/X/B3sfh/jS4NO6TICcj4gFARJ5rWL3Qq6Yt0V7BOMyKKCTf4W LFhN6K91BJbdZbuElIrSQx1nws3yfta56rqMJ7ADpBjnqTRGOTLQLHv0+MHHlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1732149551; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ilIiT2rBxNNVmZeKtqKdsbR/vV6h1BRFZxTCYTjlOJQ=; b=wqYFWyb01zCkNy2Y3X7AsPu2VvN+VV+PHYBdV4CP8j8TRVwjypXUD4WKL7L1IgQ63Loofn u3u8FSeAdiyR3yRsh3ZVAme8c4OP+aYuYDwkS9zDG3tt/1bbqVutWNrODsB8xU9NPXhn6f wbyO1ECYn/ffbETcfBrH1dYId1KqrI3pmsMLO6vQl2HTNPMC6v5JlST92n0SsNf8lhZQDl m/NeP8pnkfD3D3tvIorS8q8jO4GNx58P0u1Ol5iA5szL5wzp3nG51KpbB26m3ZfXdrILf9 EapQXjpmDq5yLvAZmItrZ9QtZGPCh90CXlTRTbLjuDhrfRF3J7z3oft94Qb+XQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1732149551; a=rsa-sha256; cv=none; b=YXeXw89Z5XvjmFn+QNuBXXkKbXdfIA1yG+UP5KxtxHBqNwvxwo/ZvjR3DRIi5KasAtD2nM OSl2NlfCIi2kX8lOnMb6hRoA5jTxjttmhCfLQjIlhS4hrHqhQ/rTma7Y312wnFA1K6sLPw 3U43v+Rm2gsFoMx38pGKID2s8oalT5mZCTud+bRH303/87y5HGZJlTf/0jFBSBu7TLWZ5J WhErZox8JfLwtVCTuJgOUrkowwUrW9uyBr5PbrB8ROiu0t3MvlqOssDCzvnz6v2srW1xLb NFTyKjAQATpgpZaNZgIwRUGtW/gpWE10hyfzlI7TkPc88W5lR6Ih5n3SEEuy4A== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XtzrH2BRszH4W; Thu, 21 Nov 2024 00:39:11 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AL0dBVi044365; Thu, 21 Nov 2024 00:39:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AL0dBh5044360; Thu, 21 Nov 2024 00:39:11 GMT (envelope-from git) Date: Thu, 21 Nov 2024 00:39:11 GMT Message-Id: <202411210039.4AL0dBh5044360@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: b80c06cc0af4 - main - tcp: use const argument in the TCP hostcache KPI List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b80c06cc0af4a913778d6014eae6ce30e1ec2c68 Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=b80c06cc0af4a913778d6014eae6ce30e1ec2c68 commit b80c06cc0af4a913778d6014eae6ce30e1ec2c68 Author: Gleb Smirnoff AuthorDate: 2024-11-21 00:30:42 +0000 Commit: Gleb Smirnoff CommitDate: 2024-11-21 00:30:42 +0000 tcp: use const argument in the TCP hostcache KPI The hostcache can't modify tcpcb, inpcb or connection info. --- sys/netinet/tcp_hostcache.c | 15 ++++++++------- sys/netinet/tcp_var.h | 8 ++++---- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/sys/netinet/tcp_hostcache.c b/sys/netinet/tcp_hostcache.c index 900c70b5cd14..dbc966acc56b 100644 --- a/sys/netinet/tcp_hostcache.c +++ b/sys/netinet/tcp_hostcache.c @@ -146,7 +146,7 @@ VNET_DEFINE_STATIC(struct tcp_hostcache, tcp_hostcache); VNET_DEFINE_STATIC(struct callout, tcp_hc_callout); #define V_tcp_hc_callout VNET(tcp_hc_callout) -static struct hc_metrics *tcp_hc_lookup(struct in_conninfo *); +static struct hc_metrics *tcp_hc_lookup(const struct in_conninfo *); static int sysctl_tcp_hc_list(SYSCTL_HANDLER_ARGS); static int sysctl_tcp_hc_histo(SYSCTL_HANDLER_ARGS); static int sysctl_tcp_hc_purgenow(SYSCTL_HANDLER_ARGS); @@ -312,7 +312,7 @@ tcp_hc_destroy(void) * Internal function: compare cache entry to a connection. */ static bool -tcp_hc_cmp(struct hc_metrics *hc_entry, struct in_conninfo *inc) +tcp_hc_cmp(struct hc_metrics *hc_entry, const struct in_conninfo *inc) { if (inc->inc_flags & INC_ISIPV6) { @@ -334,7 +334,7 @@ tcp_hc_cmp(struct hc_metrics *hc_entry, struct in_conninfo *inc) * On success returns in SMR section. */ static struct hc_metrics * -tcp_hc_lookup(struct in_conninfo *inc) +tcp_hc_lookup(const struct in_conninfo *inc) { struct hc_head *hc_head; struct hc_metrics *hc_entry; @@ -371,7 +371,8 @@ tcp_hc_lookup(struct in_conninfo *inc) * a value is not set. */ void -tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) +tcp_hc_get(const struct in_conninfo *inc, + struct hc_metrics_lite *hc_metrics_lite) { struct hc_metrics *hc_entry; @@ -410,7 +411,7 @@ tcp_hc_get(struct in_conninfo *inc, struct hc_metrics_lite *hc_metrics_lite) * set. */ uint32_t -tcp_hc_getmtu(struct in_conninfo *inc) +tcp_hc_getmtu(const struct in_conninfo *inc) { struct hc_metrics *hc_entry; uint32_t mtu; @@ -434,7 +435,7 @@ tcp_hc_getmtu(struct in_conninfo *inc) * Creates a new entry if none was found. */ void -tcp_hc_updatemtu(struct in_conninfo *inc, uint32_t mtu) +tcp_hc_updatemtu(const struct in_conninfo *inc, uint32_t mtu) { struct hc_metrics_lite hcml = { .hc_mtu = mtu }; @@ -446,7 +447,7 @@ tcp_hc_updatemtu(struct in_conninfo *inc, uint32_t mtu) * Creates a new entry if none was found. */ void -tcp_hc_update(struct in_conninfo *inc, struct hc_metrics_lite *hcml) +tcp_hc_update(const struct in_conninfo *inc, struct hc_metrics_lite *hcml) { struct hc_head *hc_head; struct hc_metrics *hc_entry, *hc_prev; diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index 17c39bd93287..466b263854b7 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1486,10 +1486,10 @@ void tcp_hc_init(void); #ifdef VIMAGE void tcp_hc_destroy(void); #endif -void tcp_hc_get(struct in_conninfo *, struct hc_metrics_lite *); -uint32_t tcp_hc_getmtu(struct in_conninfo *); -void tcp_hc_updatemtu(struct in_conninfo *, uint32_t); -void tcp_hc_update(struct in_conninfo *, struct hc_metrics_lite *); +void tcp_hc_get(const struct in_conninfo *, struct hc_metrics_lite *); +uint32_t tcp_hc_getmtu(const struct in_conninfo *); +void tcp_hc_updatemtu(const struct in_conninfo *, uint32_t); +void tcp_hc_update(const struct in_conninfo *, struct hc_metrics_lite *); void cc_after_idle(struct tcpcb *tp); extern struct protosw tcp_protosw; /* shared for TOE */