git: 8c6104c48ea3 - main - tcp_fill_info(): Change lock assertion on INPCB to locked only
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 22 Aug 2023 18:38:43 UTC
The branch main has been updated by marius: URL: https://cgit.FreeBSD.org/src/commit/?id=8c6104c48ea3f0ffaabeb9784b0f2327db04e7af commit 8c6104c48ea3f0ffaabeb9784b0f2327db04e7af Author: Marius Strobl <marius@FreeBSD.org> AuthorDate: 2023-08-22 17:03:42 +0000 Commit: Marius Strobl <marius@FreeBSD.org> CommitDate: 2023-08-22 18:33:49 +0000 tcp_fill_info(): Change lock assertion on INPCB to locked only This function actually only ever reads from the TCP PCB. Consequently, also make the pointer to its TCP PCB parameter const. Sponsored by: NetApp, Inc. (originally) --- sys/dev/cxgbe/tom/t4_tom.c | 4 ++-- sys/netinet/tcp_offload.c | 4 ++-- sys/netinet/tcp_offload.h | 2 +- sys/netinet/tcp_usrreq.c | 8 ++++---- sys/netinet/toecore.c | 2 +- sys/netinet/toecore.h | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/sys/dev/cxgbe/tom/t4_tom.c b/sys/dev/cxgbe/tom/t4_tom.c index cb2131a4c0c2..c5a7e9290666 100644 --- a/sys/dev/cxgbe/tom/t4_tom.c +++ b/sys/dev/cxgbe/tom/t4_tom.c @@ -810,12 +810,12 @@ fill_tcp_info(struct adapter *sc, u_int tid, struct tcp_info *ti) * the tcp_info for an offloaded connection. */ static void -t4_tcp_info(struct toedev *tod, struct tcpcb *tp, struct tcp_info *ti) +t4_tcp_info(struct toedev *tod, const struct tcpcb *tp, struct tcp_info *ti) { struct adapter *sc = tod->tod_softc; struct toepcb *toep = tp->t_toe; - INP_WLOCK_ASSERT(tptoinpcb(tp)); + INP_LOCK_ASSERT(tptoinpcb(tp)); MPASS(ti != NULL); fill_tcp_info(sc, toep->tid, ti); diff --git a/sys/netinet/tcp_offload.c b/sys/netinet/tcp_offload.c index 0a37d0a8ba30..6a362484d46f 100644 --- a/sys/netinet/tcp_offload.c +++ b/sys/netinet/tcp_offload.c @@ -186,12 +186,12 @@ tcp_offload_ctloutput(struct tcpcb *tp, int sopt_dir, int sopt_name) } void -tcp_offload_tcp_info(struct tcpcb *tp, struct tcp_info *ti) +tcp_offload_tcp_info(const struct tcpcb *tp, struct tcp_info *ti) { struct toedev *tod = tp->tod; KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp)); - INP_WLOCK_ASSERT(tptoinpcb(tp)); + INP_LOCK_ASSERT(tptoinpcb(tp)); tod->tod_tcp_info(tod, tp, ti); } diff --git a/sys/netinet/tcp_offload.h b/sys/netinet/tcp_offload.h index 2524a56d0369..b397336ab487 100644 --- a/sys/netinet/tcp_offload.h +++ b/sys/netinet/tcp_offload.h @@ -45,7 +45,7 @@ void tcp_offload_input(struct tcpcb *, struct mbuf *); int tcp_offload_output(struct tcpcb *); void tcp_offload_rcvd(struct tcpcb *); void tcp_offload_ctloutput(struct tcpcb *, int, int); -void tcp_offload_tcp_info(struct tcpcb *, struct tcp_info *); +void tcp_offload_tcp_info(const struct tcpcb *, struct tcp_info *); int tcp_offload_alloc_tls_session(struct tcpcb *, struct ktls_session *, int); void tcp_offload_detach(struct tcpcb *); void tcp_offload_pmtu_update(struct tcpcb *, tcp_seq, int); diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 811dfbaa51bd..a6101bc422f7 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -125,7 +125,7 @@ static int tcp6_connect(struct tcpcb *, struct sockaddr_in6 *, #endif /* INET6 */ static void tcp_disconnect(struct tcpcb *); static void tcp_usrclosed(struct tcpcb *); -static void tcp_fill_info(struct tcpcb *, struct tcp_info *); +static void tcp_fill_info(const struct tcpcb *, struct tcp_info *); static int tcp_pru_options_support(struct tcpcb *tp, int flags); @@ -1538,11 +1538,11 @@ tcp6_connect(struct tcpcb *tp, struct sockaddr_in6 *sin6, struct thread *td) * constants -- for example, the numeric values for tcpi_state will differ * from Linux. */ -static void -tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti) +void +tcp_fill_info(const struct tcpcb *tp, struct tcp_info *ti) { - INP_WLOCK_ASSERT(tptoinpcb(tp)); + INP_LOCK_ASSERT(tptoinpcb(tp)); bzero(ti, sizeof(*ti)); ti->tcpi_state = tp->t_state; diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c index 5f5863431dfe..76aadad9a3b9 100644 --- a/sys/netinet/toecore.c +++ b/sys/netinet/toecore.c @@ -183,7 +183,7 @@ toedev_ctloutput(struct toedev *tod __unused, struct tcpcb *tp __unused, } static void -toedev_tcp_info(struct toedev *tod __unused, struct tcpcb *tp __unused, +toedev_tcp_info(struct toedev *tod __unused, const struct tcpcb *tp __unused, struct tcp_info *ti __unused) { diff --git a/sys/netinet/toecore.h b/sys/netinet/toecore.h index 746d21c138f0..a8e5afd6b50a 100644 --- a/sys/netinet/toecore.h +++ b/sys/netinet/toecore.h @@ -107,7 +107,7 @@ struct toedev { void (*tod_ctloutput)(struct toedev *, struct tcpcb *, int, int); /* Update software state */ - void (*tod_tcp_info)(struct toedev *, struct tcpcb *, + void (*tod_tcp_info)(struct toedev *, const struct tcpcb *, struct tcp_info *); /* Create a TLS session */