Date: Tue, 3 Apr 2018 01:08:54 +0000 (UTC) From: Navdeep Parhar <np@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331901 - head/sys/netinet Message-ID: <201804030108.w3318s2P051624@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: np Date: Tue Apr 3 01:08:54 2018 New Revision: 331901 URL: https://svnweb.freebsd.org/changeset/base/331901 Log: 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 Modified: head/sys/netinet/tcp_offload.c head/sys/netinet/tcp_offload.h head/sys/netinet/tcp_usrreq.c head/sys/netinet/toecore.c head/sys/netinet/toecore.h Modified: head/sys/netinet/tcp_offload.c ============================================================================== --- head/sys/netinet/tcp_offload.c Tue Apr 3 00:45:38 2018 (r331900) +++ head/sys/netinet/tcp_offload.c Tue Apr 3 01:08:54 2018 (r331901) @@ -168,6 +168,17 @@ tcp_offload_ctloutput(struct tcpcb *tp, int sopt_dir, } 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; Modified: head/sys/netinet/tcp_offload.h ============================================================================== --- head/sys/netinet/tcp_offload.h Tue Apr 3 00:45:38 2018 (r331900) +++ head/sys/netinet/tcp_offload.h Tue Apr 3 01:08:54 2018 (r331901) @@ -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 Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Tue Apr 3 00:45:38 2018 (r331900) +++ head/sys/netinet/tcp_usrreq.c Tue Apr 3 01:08:54 2018 (r331901) @@ -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 } /* Modified: head/sys/netinet/toecore.c ============================================================================== --- head/sys/netinet/toecore.c Tue Apr 3 00:45:38 2018 (r331900) +++ head/sys/netinet/toecore.c Tue Apr 3 01:08:54 2018 (r331901) @@ -182,6 +182,14 @@ toedev_ctloutput(struct toedev *tod __unused, struct t 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; } /* Modified: head/sys/netinet/toecore.h ============================================================================== --- head/sys/netinet/toecore.h Tue Apr 3 00:45:38 2018 (r331900) +++ head/sys/netinet/toecore.h Tue Apr 3 01:08:54 2018 (r331901) @@ -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>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201804030108.w3318s2P051624>