Currently, when tcp_input() receives a packet on a session that matches a
authorjtl <jtl@FreeBSD.org>
Wed, 12 Oct 2016 02:30:33 +0000 (02:30 +0000)
committerjtl <jtl@FreeBSD.org>
Wed, 12 Oct 2016 02:30:33 +0000 (02:30 +0000)
commitc8e3a1fa4088ec33bfc8e27ccbc90019a82b9158
tree260b09820944d8b1474ee922699c01666787e8e5
parent62030781cdc239b37135b2ce6041c2df3d933595
Currently, when tcp_input() receives a packet on a session that matches a
TCPCB, it checks (so->so_options & SO_ACCEPTCONN) to determine whether or
not the socket is a listening socket. However, this causes the code to
access a different cacheline. If we first check if the socket is in the
LISTEN state, we can avoid accessing so->so_options when processing packets
received for ESTABLISHED sessions.

If INVARIANTS is defined, the code still needs to access both variables to
check that so->so_options is consistent with the state.

Reviewed by: gallatin
MFC after: 1 week
Sponsored by: Netflix
sys/netinet/tcp_input.c