From: Vitaliy Makkoveev Subject: Re: tcp syn cache locking comments To: Alexander Bluhm Cc: tech@openbsd.org Date: Mon, 28 Apr 2025 23:57:54 +0300 > On 28 Apr 2025, at 23:54, Alexander Bluhm wrote: > > Hi, > > I have switched TCP SYN cache from net lock to socket lock a while > ago. Comments for locking in struct syn_cache have been forgotten. > > ok? > ok mvs > bluhm > > Index: netinet/tcp_var.h > =================================================================== > RCS file: /data/mirror/openbsd/cvs/src/sys/netinet/tcp_var.h,v > diff -u -p -r1.188 tcp_var.h > --- netinet/tcp_var.h 21 Apr 2025 09:54:53 -0000 1.188 > +++ netinet/tcp_var.h 28 Apr 2025 20:02:11 -0000 > @@ -230,6 +230,7 @@ struct tcp_opt_info { > * I immutable after creation > * N net lock > * S syn_cache_mtx tcp syn cache global mutex > + * s so_lock socket lock of listen socket > */ > > extern struct mutex syn_cache_mtx; > @@ -247,11 +248,11 @@ struct syn_cache { > TAILQ_ENTRY(syn_cache) sc_bucketq; /* [S] link on bucket list */ > struct refcnt sc_refcnt; /* ref count list and timer */ > struct timeout sc_timer; /* rexmt timer */ > - struct route sc_route; /* [N] cached route */ > + struct route sc_route; /* [s] cached route */ > long sc_win; /* [I] advertised window */ > struct syn_cache_head *sc_buckethead; /* [S] our bucket index */ > struct syn_cache_set *sc_set; /* [S] our syn cache set */ > - u_int64_t sc_timestamp; /* [N] timestamp from SYN */ > + u_int64_t sc_timestamp; /* [s] timestamp from SYN */ > u_int32_t sc_hash; /* [S] */ > u_int32_t sc_modulate; /* [I] our timestamp modulator */ > union syn_cache_sa sc_src; /* [I] */ > @@ -272,7 +273,7 @@ struct syn_cache { > #define SCF_ECN_PERMIT 0x0040U /* permit ecn */ > #define SCF_SIGNATURE 0x0080U /* enforce tcp signatures */ > > - struct mbuf *sc_ipopts; /* [N] IP options */ > + struct mbuf *sc_ipopts; /* [s] IP options */ > u_int16_t sc_peermaxseg; /* [I] */ > u_int16_t sc_ourmaxseg; /* [I] */ > u_int sc_request_r_scale : 4, /* [I] */ >