Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 36e31b0a authored by Andreas Petlund's avatar Andreas Petlund Committed by David S. Miller
Browse files

net: TCP thin linear timeouts



This patch will make TCP use only linear timeouts if the
stream is thin. This will help to avoid the very high latencies
that thin stream suffer because of exponential backoff. This
mechanism is only active if enabled by iocontrol or syscontrol
and the stream is identified as thin. A maximum of 6 linear
timeouts is tried before exponential backoff is resumed.

Signed-off-by: default avatarAndreas Petlund <apetlund@simula.no>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5aa4b32f
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -487,6 +487,18 @@ tcp_dma_copybreak - INTEGER
	and CONFIG_NET_DMA is enabled.
	and CONFIG_NET_DMA is enabled.
	Default: 4096
	Default: 4096


tcp_thin_linear_timeouts - BOOLEAN
	Enable dynamic triggering of linear timeouts for thin streams.
	If set, a check is performed upon retransmission by timeout to
	determine if the stream is thin (less than 4 packets in flight).
	As long as the stream is found to be thin, up to 6 linear
	timeouts may be performed before exponential backoff mode is
	initiated. This improves retransmission latency for
	non-aggressive thin streams, often found to be time-dependent.
	For more information on thin streams, see
	Documentation/networking/tcp-thin.txt
	Default: 0

UDP variables:
UDP variables:


udp_mem - vector of 3 INTEGERs: min, pressure, max
udp_mem - vector of 3 INTEGERs: min, pressure, max
+4 −1
Original line number Original line Diff line number Diff line
@@ -103,6 +103,7 @@ enum {
#define TCP_CONGESTION		13	/* Congestion control algorithm */
#define TCP_CONGESTION		13	/* Congestion control algorithm */
#define TCP_MD5SIG		14	/* TCP MD5 Signature (RFC2385) */
#define TCP_MD5SIG		14	/* TCP MD5 Signature (RFC2385) */
#define TCP_COOKIE_TRANSACTIONS	15	/* TCP Cookie Transactions */
#define TCP_COOKIE_TRANSACTIONS	15	/* TCP Cookie Transactions */
#define TCP_THIN_LINEAR_TIMEOUTS 16      /* Use linear timeouts for thin streams*/


/* for TCP_INFO socket option */
/* for TCP_INFO socket option */
#define TCPI_OPT_TIMESTAMPS	1
#define TCPI_OPT_TIMESTAMPS	1
@@ -340,7 +341,9 @@ struct tcp_sock {
	u32	frto_highmark;	/* snd_nxt when RTO occurred */
	u32	frto_highmark;	/* snd_nxt when RTO occurred */
	u16	advmss;		/* Advertised MSS			*/
	u16	advmss;		/* Advertised MSS			*/
	u8	frto_counter;	/* Number of new acks after RTO */
	u8	frto_counter;	/* Number of new acks after RTO */
	u8	nonagle;	/* Disable Nagle algorithm?             */
	u8	nonagle     : 4,/* Disable Nagle algorithm?             */
		thin_lto    : 1,/* Use linear timeouts for thin streams */
		unused      : 3;


/* RTT measurement */
/* RTT measurement */
	u32	srtt;		/* smoothed round trip time << 3	*/
	u32	srtt;		/* smoothed round trip time << 3	*/
+4 −0
Original line number Original line Diff line number Diff line
@@ -196,6 +196,9 @@ extern void tcp_time_wait(struct sock *sk, int state, int timeo);
#define TCP_NAGLE_CORK		2	/* Socket is corked	    */
#define TCP_NAGLE_CORK		2	/* Socket is corked	    */
#define TCP_NAGLE_PUSH		4	/* Cork is overridden for already queued data */
#define TCP_NAGLE_PUSH		4	/* Cork is overridden for already queued data */


/* TCP thin-stream limits */
#define TCP_THIN_LINEAR_RETRIES 6       /* After 6 linear retries, do exp. backoff */

extern struct inet_timewait_death_row tcp_death_row;
extern struct inet_timewait_death_row tcp_death_row;


/* sysctl variables for tcp */
/* sysctl variables for tcp */
@@ -241,6 +244,7 @@ extern int sysctl_tcp_workaround_signed_windows;
extern int sysctl_tcp_slow_start_after_idle;
extern int sysctl_tcp_slow_start_after_idle;
extern int sysctl_tcp_max_ssthresh;
extern int sysctl_tcp_max_ssthresh;
extern int sysctl_tcp_cookie_size;
extern int sysctl_tcp_cookie_size;
extern int sysctl_tcp_thin_linear_timeouts;


extern atomic_t tcp_memory_allocated;
extern atomic_t tcp_memory_allocated;
extern struct percpu_counter tcp_sockets_allocated;
extern struct percpu_counter tcp_sockets_allocated;
+7 −0
Original line number Original line Diff line number Diff line
@@ -575,6 +575,13 @@ static struct ctl_table ipv4_table[] = {
		.mode		= 0644,
		.mode		= 0644,
		.proc_handler	= proc_dointvec
		.proc_handler	= proc_dointvec
	},
	},
	{
		.procname       = "tcp_thin_linear_timeouts",
		.data           = &sysctl_tcp_thin_linear_timeouts,
		.maxlen         = sizeof(int),
		.mode           = 0644,
		.proc_handler   = proc_dointvec
	},
	{
	{
		.procname	= "udp_mem",
		.procname	= "udp_mem",
		.data		= &sysctl_udp_mem,
		.data		= &sysctl_udp_mem,
+7 −0
Original line number Original line Diff line number Diff line
@@ -2229,6 +2229,13 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
		}
		}
		break;
		break;


	case TCP_THIN_LINEAR_TIMEOUTS:
		if (val < 0 || val > 1)
			err = -EINVAL;
		else
			tp->thin_lto = val;
		break;

	case TCP_CORK:
	case TCP_CORK:
		/* When set indicates to always queue non-full frames.
		/* When set indicates to always queue non-full frames.
		 * Later the user clears this option and we transmit
		 * Later the user clears this option and we transmit
Loading