summaryrefslogtreecommitdiffstats
path: root/sys/netinet/tcp_offload.c
diff options
context:
space:
mode:
authorkmacy <kmacy@FreeBSD.org>2008-07-21 02:23:02 +0000
committerkmacy <kmacy@FreeBSD.org>2008-07-21 02:23:02 +0000
commit2eb3c40f890dfe942fac03792ddeb7dbc94c3ef8 (patch)
treecfcd78f7e2c44fc90bb3ee20eb74d84c7f77dde0 /sys/netinet/tcp_offload.c
parent7658528ea757263aa160d88b06cc8552b88b44f3 (diff)
downloadFreeBSD-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/tcp_offload.c')
-rw-r--r--sys/netinet/tcp_offload.c60
1 files changed, 59 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);
+}
+
OpenPOWER on IntegriCloud