diff options
author | kmacy <kmacy@FreeBSD.org> | 2008-07-21 02:23:02 +0000 |
---|---|---|
committer | kmacy <kmacy@FreeBSD.org> | 2008-07-21 02:23:02 +0000 |
commit | 2eb3c40f890dfe942fac03792ddeb7dbc94c3ef8 (patch) | |
tree | cfcd78f7e2c44fc90bb3ee20eb74d84c7f77dde0 /sys/netinet | |
parent | 7658528ea757263aa160d88b06cc8552b88b44f3 (diff) | |
download | FreeBSD-src-2eb3c40f890dfe942fac03792ddeb7dbc94c3ef8.zip FreeBSD-src-2eb3c40f890dfe942fac03792ddeb7dbc94c3ef8.tar.gz |
Add versions of tcp_twstart, tcp_close, and tcp_drop that hide the acquisition the tcbinfo lock.
MFC after: 1 week
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/tcp_offload.c | 60 | ||||
-rw-r--r-- | sys/netinet/tcp_offload.h | 6 |
2 files changed, 65 insertions, 1 deletions
diff --git a/sys/netinet/tcp_offload.c b/sys/netinet/tcp_offload.c index fd4cefd..e5c3a19 100644 --- a/sys/netinet/tcp_offload.c +++ b/sys/netinet/tcp_offload.c @@ -50,7 +50,6 @@ __FBSDID("$FreeBSD$"); #include <netinet/tcp_offload.h> #include <netinet/toedev.h> - int tcp_offload_connect(struct socket *so, struct sockaddr *nam) { @@ -92,3 +91,62 @@ fail: RTFREE(rt); return (error); } + + +/* + * This file contains code as a short-term staging area before it is moved in + * to sys/netinet/tcp_offload.c + */ + +void +tcp_offload_twstart(struct tcpcb *tp) +{ + + INP_INFO_WLOCK(&tcbinfo); + inp_wlock(tp->t_inpcb); + tcp_twstart(tp); + INP_INFO_WUNLOCK(&tcbinfo); +} + +void +tcp_offload_twstart_disconnect(struct tcpcb *tp) +{ + struct socket *so; + + INP_INFO_WLOCK(&tcbinfo); + inp_wlock(tp->t_inpcb); + so = tp->t_inpcb->inp_socket; + tcp_twstart(tp); + if (so) + soisdisconnected(so); + INP_INFO_WUNLOCK(&tcbinfo); +} + +struct tcpcb * +tcp_offload_close(struct tcpcb *tp) +{ + + INP_INFO_WLOCK(&tcbinfo); + INP_WLOCK(tp->t_inpcb); + tp = tcp_close(tp); + INP_INFO_WUNLOCK(&tcbinfo); + if (tp) + INP_WUNLOCK(tp->t_inpcb); + + return (tp); +} + +struct tcpcb * +tcp_offload_drop(struct tcpcb *tp, int error) +{ + + INP_INFO_WLOCK(&tcbinfo); + INP_WLOCK(tp->t_inpcb); + tp = tcp_drop(tp, error); + INP_INFO_WUNLOCK(&tcbinfo); + if (tp) + INP_WUNLOCK(tp->t_inpcb); + + return (tp); +} + diff --git a/sys/netinet/tcp_offload.h b/sys/netinet/tcp_offload.h index 7626d9b..ed1166e 100644 --- a/sys/netinet/tcp_offload.h +++ b/sys/netinet/tcp_offload.h @@ -333,4 +333,10 @@ tcp_offload_listen_close(struct tcpcb *tp) #undef SO_OFFLOADABLE #endif /* _SYS_SOCKETVAR_H_ */ #undef tp_offload + +void tcp_offload_twstart(struct tcpcb *tp); +void tcp_offload_twstart_disconnect(struct tcpcb *tp); +struct tcpcb *tcp_offload_close(struct tcpcb *tp); +struct tcpcb *tcp_offload_drop(struct tcpcb *tp, int error); + #endif /* _NETINET_TCP_OFFLOAD_H_ */ |