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)
This commit is contained in:
Marius Strobl 2023-08-22 19:03:42 +02:00
parent 949491f2a6
commit 8c6104c48e
6 changed files with 11 additions and 11 deletions

View File

@ -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);

View File

@ -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);
}

View File

@ -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);

View File

@ -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;

View File

@ -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)
{

View File

@ -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 */