diff options
author | rwatson <rwatson@FreeBSD.org> | 2004-06-14 18:16:22 +0000 |
---|---|---|
committer | rwatson <rwatson@FreeBSD.org> | 2004-06-14 18:16:22 +0000 |
commit | f2c0db1521299639d6b16b7d477a777fbd81ada6 (patch) | |
tree | 38ab74987dd7d2d27fad4ea4e4772c7d36baf7d4 /sys/netinet/tcp_input.c | |
parent | 1598e7b4234febacb1b16af62169c90a2e93cc6b (diff) | |
download | FreeBSD-src-f2c0db1521299639d6b16b7d477a777fbd81ada6.zip FreeBSD-src-f2c0db1521299639d6b16b7d477a777fbd81ada6.tar.gz |
The socket field so_state is used to hold a variety of socket related
flags relating to several aspects of socket functionality. This change
breaks out several bits relating to send and receive operation into a
new per-socket buffer field, sb_state, in order to facilitate locking.
This is required because, in order to provide more granular locking of
sockets, different state fields have different locking properties. The
following fields are moved to sb_state:
SS_CANTRCVMORE (so_state)
SS_CANTSENDMORE (so_state)
SS_RCVATMARK (so_state)
Rename respectively to:
SBS_CANTRCVMORE (so_rcv.sb_state)
SBS_CANTSENDMORE (so_snd.sb_state)
SBS_RCVATMARK (so_rcv.sb_state)
This facilitates locking by isolating fields to be located with other
identically locked fields, and permits greater granularity in socket
locking by avoiding storing fields with different locking semantics in
the same short (avoiding locking conflicts). In the future, we may
wish to coallesce sb_state and sb_flags; for the time being I leave
them separate and there is no additional memory overhead due to the
packing/alignment of shorts in the socket buffer structure.
Diffstat (limited to 'sys/netinet/tcp_input.c')
-rw-r--r-- | sys/netinet/tcp_input.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 04b4d2c..3fa801d 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -355,7 +355,7 @@ present: flags = q->tqe_th->th_flags & TH_FIN; nq = LIST_NEXT(q, tqe_q); LIST_REMOVE(q, tqe_q); - if (so->so_state & SS_CANTRCVMORE) + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) m_freem(q->tqe_m); else sbappendstream(&so->so_rcv, q->tqe_m); @@ -1237,7 +1237,7 @@ after_listen: #endif * Add data to socket buffer. */ - if (so->so_state & SS_CANTRCVMORE) { + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { m_freem(m); } else { m_adj(m, drop_hdrlen); /* delayed header drop */ @@ -2143,7 +2143,7 @@ process_ACK: * we should release the tp also, and use a * compressed state. */ - if (so->so_state & SS_CANTRCVMORE) { + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) { soisdisconnected(so); callout_reset(tp->tt_2msl, tcp_maxidle, tcp_timer_2msl, tp); @@ -2250,7 +2250,7 @@ step6: so->so_oobmark = so->so_rcv.sb_cc + (tp->rcv_up - tp->rcv_nxt) - 1; if (so->so_oobmark == 0) - so->so_state |= SS_RCVATMARK; + so->so_rcv.sb_state |= SBS_RCVATMARK; sohasoutofband(so); tp->t_oobflags &= ~(TCPOOB_HAVEDATA | TCPOOB_HADDATA); } @@ -2311,7 +2311,7 @@ dodata: /* XXX */ tcpstat.tcps_rcvpack++; tcpstat.tcps_rcvbyte += tlen; ND6_HINT(tp); - if (so->so_state & SS_CANTRCVMORE) + if (so->so_rcv.sb_state & SBS_CANTRCVMORE) m_freem(m); else sbappendstream(&so->so_rcv, m); |