aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet
diff options
context:
space:
mode:
authorNavdeep Parhar <np@FreeBSD.org>2018-04-03 01:08:54 +0000
committerNavdeep Parhar <np@FreeBSD.org>2018-04-03 01:08:54 +0000
commita64564109a6944c2ab1719b740f680c80de0f598 (patch)
tree6b6d5cab4d410ae51274f79a436a87cfc34a9849 /sys/netinet
parent9f5b999acafbe8936206ecdc10be2f0e4dd0a536 (diff)
downloadsrc-a64564109a6944c2ab1719b740f680c80de0f598.tar.gz
src-a64564109a6944c2ab1719b740f680c80de0f598.zip
Add a hook to allow the toedev handling an offloaded connection to
provide accurate TCP_INFO. Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D14816
Notes
Notes: svn path=/head/; revision=331901
Diffstat (limited to 'sys/netinet')
-rw-r--r--sys/netinet/tcp_offload.c11
-rw-r--r--sys/netinet/tcp_offload.h1
-rw-r--r--sys/netinet/tcp_usrreq.c8
-rw-r--r--sys/netinet/toecore.c9
-rw-r--r--sys/netinet/toecore.h5
5 files changed, 32 insertions, 2 deletions
diff --git a/sys/netinet/tcp_offload.c b/sys/netinet/tcp_offload.c
index e458a99f79dc..f7814769bdfb 100644
--- a/sys/netinet/tcp_offload.c
+++ b/sys/netinet/tcp_offload.c
@@ -168,6 +168,17 @@ tcp_offload_ctloutput(struct tcpcb *tp, int sopt_dir, int sopt_name)
}
void
+tcp_offload_tcp_info(struct tcpcb *tp, struct tcp_info *ti)
+{
+ struct toedev *tod = tp->tod;
+
+ KASSERT(tod != NULL, ("%s: tp->tod is NULL, tp %p", __func__, tp));
+ INP_WLOCK_ASSERT(tp->t_inpcb);
+
+ tod->tod_tcp_info(tod, tp, ti);
+}
+
+void
tcp_offload_detach(struct tcpcb *tp)
{
struct toedev *tod = tp->tod;
diff --git a/sys/netinet/tcp_offload.h b/sys/netinet/tcp_offload.h
index 8485fa298731..f755ce7ed20b 100644
--- a/sys/netinet/tcp_offload.h
+++ b/sys/netinet/tcp_offload.h
@@ -45,6 +45,7 @@ void tcp_offload_input(struct tcpcb *, struct mbuf *);
int tcp_offload_output(struct tcpcb *);
void tcp_offload_rcvd(struct tcpcb *);
void tcp_offload_ctloutput(struct tcpcb *, int, int);
+void tcp_offload_tcp_info(struct tcpcb *, struct tcp_info *);
void tcp_offload_detach(struct tcpcb *);
#endif
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 0e19d846802d..d5af4063ea95 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1393,11 +1393,15 @@ tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti)
ti->tcpi_snd_nxt = tp->snd_nxt;
ti->tcpi_snd_mss = tp->t_maxseg;
ti->tcpi_rcv_mss = tp->t_maxseg;
- if (tp->t_flags & TF_TOE)
- ti->tcpi_options |= TCPI_OPT_TOE;
ti->tcpi_snd_rexmitpack = tp->t_sndrexmitpack;
ti->tcpi_rcv_ooopack = tp->t_rcvoopack;
ti->tcpi_snd_zerowin = tp->t_sndzerowin;
+#ifdef TCP_OFFLOAD
+ if (tp->t_flags & TF_TOE) {
+ ti->tcpi_options |= TCPI_OPT_TOE;
+ tcp_offload_tcp_info(tp, ti);
+ }
+#endif
}
/*
diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c
index 2d4dde43a4de..74fe91d80d84 100644
--- a/sys/netinet/toecore.c
+++ b/sys/netinet/toecore.c
@@ -182,6 +182,14 @@ toedev_ctloutput(struct toedev *tod __unused, struct tcpcb *tp __unused,
return;
}
+static void
+toedev_tcp_info(struct toedev *tod __unused, struct tcpcb *tp __unused,
+ struct tcp_info *ti __unused)
+{
+
+ return;
+}
+
/*
* Inform one or more TOE devices about a listening socket.
*/
@@ -271,6 +279,7 @@ init_toedev(struct toedev *tod)
tod->tod_syncache_respond = toedev_syncache_respond;
tod->tod_offload_socket = toedev_offload_socket;
tod->tod_ctloutput = toedev_ctloutput;
+ tod->tod_tcp_info = toedev_tcp_info;
}
/*
diff --git a/sys/netinet/toecore.h b/sys/netinet/toecore.h
index 633984a6bd2d..f2374d706869 100644
--- a/sys/netinet/toecore.h
+++ b/sys/netinet/toecore.h
@@ -38,6 +38,7 @@
struct tcpopt;
struct tcphdr;
struct in_conninfo;
+struct tcp_info;
struct toedev {
TAILQ_ENTRY(toedev) link; /* glue for toedev_list */
@@ -101,6 +102,10 @@ struct toedev {
/* TCP socket option */
void (*tod_ctloutput)(struct toedev *, struct tcpcb *, int, int);
+
+ /* Update software state */
+ void (*tod_tcp_info)(struct toedev *, struct tcpcb *,
+ struct tcp_info *);
};
#include <sys/eventhandler.h>