HomeFreeBSD

tcp: utilize new solisten_clone() and solisten_enqueue()

Description

tcp: utilize new solisten_clone() and solisten_enqueue()

This streamlines cloning of a socket from a listener. Now we do not
drop the inpcb lock during creation of a new socket, do not do useless
state transitions, and put a fully initialized socket+inpcb+tcpcb into
the listen queue.

Before this change, first we would allocate the socket and inpcb+tcpcb via
tcp_usr_attach() as TCPS_CLOSED, link them into global list of pcbs, unlock
pcb and put this onto incomplete queue (see 6f3caa6d815). Then, after
sonewconn() we would lock it again, transition into TCPS_SYN_RECEIVED,
insert into inpcb hash, finalize initialization of tcpcb. And then, in
call into tcp_do_segment() and upon transition to TCPS_ESTABLISHED call
soisconnected(). This call would lock the listening socket once again
with a LOR protection sequence and then we would relocate the socket onto
the complete queue and only now it is ready for accept(2).

Reviewed by: rrs, tuexen
Differential revision: https://reviews.freebsd.org/D36064

Details

Provenance
glebiusAuthored on Aug 10 2022, 6:09 PM
Reviewer
rrs
Differential Revision
D36064: tcp: utilize new solisten_clone() and solisten_enqueue()
Parents
rG8f5a0a2e4f31: sockets: provide solisten_clone(), solisten_enqueue()
Branches
Unknown
Tags
Unknown