svn commit: r328608 - in head/sys: dev/cxgbe/tom netinet

John Baldwin jhb at FreeBSD.org
Tue Jan 30 23:01:38 UTC 2018


Author: jhb
Date: Tue Jan 30 23:01:37 2018
New Revision: 328608
URL: https://svnweb.freebsd.org/changeset/base/328608

Log:
  Export tcp_always_keepalive for use by the Chelsio TOM module.
  
  This used to work by accident with ld.bfd even though always_keepalive
  was marked as static. LLD honors static more correctly, so export this
  variable properly (including moving it into the tcp_* namespace).
  
  Reviewed by:	bz, emaste
  MFC after:	2 weeks
  Sponsored by:	Chelsio Communications
  Differential Revision:	https://reviews.freebsd.org/D14129

Modified:
  head/sys/dev/cxgbe/tom/t4_tom.c
  head/sys/netinet/tcp_timer.c
  head/sys/netinet/tcp_timer.h

Modified: head/sys/dev/cxgbe/tom/t4_tom.c
==============================================================================
--- head/sys/dev/cxgbe/tom/t4_tom.c	Tue Jan 30 21:34:34 2018	(r328607)
+++ head/sys/dev/cxgbe/tom/t4_tom.c	Tue Jan 30 23:01:37 2018	(r328608)
@@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$");
 #include <netinet6/scope6_var.h>
 #define TCPSTATES
 #include <netinet/tcp_fsm.h>
+#include <netinet/tcp_timer.h>
 #include <netinet/tcp_var.h>
 #include <netinet/toecore.h>
 
@@ -545,8 +546,6 @@ select_rcv_wscale(void)
 	return (wscale);
 }
 
-extern int always_keepalive;
-
 /*
  * socket so could be a listening socket too.
  */
@@ -565,7 +564,7 @@ calc_opt0(struct socket *so, struct vi_info *vi, struc
 	if (so != NULL) {
 		struct inpcb *inp = sotoinpcb(so);
 		struct tcpcb *tp = intotcpcb(inp);
-		int keepalive = always_keepalive ||
+		int keepalive = tcp_always_keepalive ||
 		    so_options_get(so) & SO_KEEPALIVE;
 
 		opt0 |= V_NAGLE((tp->t_flags & TF_NODELAY) == 0);

Modified: head/sys/netinet/tcp_timer.c
==============================================================================
--- head/sys/netinet/tcp_timer.c	Tue Jan 30 21:34:34 2018	(r328607)
+++ head/sys/netinet/tcp_timer.c	Tue Jan 30 23:01:37 2018	(r328608)
@@ -118,9 +118,9 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, rexmit_slop, CTLT
     &tcp_rexmit_slop, 0, sysctl_msec_to_ticks, "I",
     "Retransmission Timer Slop");
 
-static int	always_keepalive = 1;
+int	tcp_always_keepalive = 1;
 SYSCTL_INT(_net_inet_tcp, OID_AUTO, always_keepalive, CTLFLAG_RW,
-    &always_keepalive , 0, "Assume SO_KEEPALIVE on all TCP connections");
+    &tcp_always_keepalive , 0, "Assume SO_KEEPALIVE on all TCP connections");
 
 int    tcp_fast_finwait2_recycle = 0;
 SYSCTL_INT(_net_inet_tcp, OID_AUTO, fast_finwait2_recycle, CTLFLAG_RW, 
@@ -471,7 +471,8 @@ tcp_timer_keep(void *xtp)
 	TCPSTAT_INC(tcps_keeptimeo);
 	if (tp->t_state < TCPS_ESTABLISHED)
 		goto dropit;
-	if ((always_keepalive || inp->inp_socket->so_options & SO_KEEPALIVE) &&
+	if ((tcp_always_keepalive ||
+	    inp->inp_socket->so_options & SO_KEEPALIVE) &&
 	    tp->t_state <= TCPS_CLOSING) {
 		if (ticks - tp->t_rcvtime >= TP_KEEPIDLE(tp) + TP_MAXIDLE(tp))
 			goto dropit;

Modified: head/sys/netinet/tcp_timer.h
==============================================================================
--- head/sys/netinet/tcp_timer.h	Tue Jan 30 21:34:34 2018	(r328607)
+++ head/sys/netinet/tcp_timer.h	Tue Jan 30 23:01:37 2018	(r328608)
@@ -197,6 +197,7 @@ extern int tcp_ttl;			/* time to live for TCP segs */
 extern int tcp_backoff[];
 extern int tcp_syn_backoff[];
 
+extern int tcp_always_keepalive;
 extern int tcp_finwait2_timeout;
 extern int tcp_fast_finwait2_recycle;
 


More information about the svn-src-head mailing list