aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGleb Smirnoff <glebius@FreeBSD.org>2024-11-21 00:30:42 +0000
committerGleb Smirnoff <glebius@FreeBSD.org>2024-11-21 00:30:42 +0000
commitb80c06cc0af4a913778d6014eae6ce30e1ec2c68 (patch)
tree147f0c590dd56eb42dffb11c89bfcf7e3a362cf3
parent09000cc133d82fc614d9f61d064e3acf7fa8b875 (diff)
downloadsrc-b80c06cc0af4a913778d6014eae6ce30e1ec2c68.tar.gz
src-b80c06cc0af4a913778d6014eae6ce30e1ec2c68.zip
tcp: use const argument in the TCP hostcache KPI
The hostcache can't modify tcpcb, inpcb or connection info.
-rw-r--r--sys/netinet/tcp_hostcache.c15
-rw-r--r--sys/netinet/tcp_var.h8
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 */