FreeBSD kernel IPv4 code
tcp_sack.c File Reference
#include <sys/cdefs.h>
#include "opt_inet.h"
#include "opt_inet6.h"
#include "opt_tcpdebug.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/sysctl.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/proc.h>
#include <sys/protosw.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/syslog.h>
#include <machine/cpu.h>
#include <vm/uma.h>
#include <net/if.h>
#include <net/if_var.h>
#include <net/route.h>
#include <net/vnet.h>
#include <netinet/in.h>
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/in_var.h>
#include <netinet/in_pcb.h>
#include <netinet/ip_var.h>
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
#include <netinet6/nd6.h>
#include <netinet6/ip6_var.h>
#include <netinet6/in6_pcb.h>
#include <netinet/tcp.h>
#include <netinet/tcp_fsm.h>
#include <netinet/tcp_seq.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
#include <netinet6/tcp6_var.h>
#include <netinet/tcpip.h>
#include <netinet/cc/cc.h>
#include <machine/in_cksum.h>
Include dependency graph for tcp_sack.c:

Go to the source code of this file.

Macros

#define V_sack_hole_zone   VNET(sack_hole_zone)
 

Functions

 __FBSDID ("$FreeBSD$")
 
 VNET_DECLARE (struct uma_zone *, sack_hole_zone)
 
 SYSCTL_NODE (_net_inet_tcp, OID_AUTO, sack, CTLFLAG_RW|CTLFLAG_MPSAFE, 0, "TCP SACK")
 
 VNET_DEFINE (int, tcp_do_sack)
 
 SYSCTL_INT (_net_inet_tcp_sack, OID_AUTO, enable, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(tcp_do_sack), 0, "Enable/Disable TCP SACK support")
 
 VNET_DEFINE (int, tcp_do_newsack)
 
 SYSCTL_INT (_net_inet_tcp_sack, OID_AUTO, revised, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(tcp_do_newsack), 0, "Use revised SACK loss recovery per RFC 6675")
 
 VNET_DEFINE (int, tcp_sack_maxholes)
 
 SYSCTL_INT (_net_inet_tcp_sack, OID_AUTO, maxholes, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(tcp_sack_maxholes), 0, "Maximum number of TCP SACK holes allowed per connection")
 
 VNET_DEFINE (int, tcp_sack_globalmaxholes)
 
 SYSCTL_INT (_net_inet_tcp_sack, OID_AUTO, globalmaxholes, CTLFLAG_VNET|CTLFLAG_RW, &VNET_NAME(tcp_sack_globalmaxholes), 0, "Global maximum number of TCP SACK holes")
 
 VNET_DEFINE (int, tcp_sack_globalholes)=0
 
 SYSCTL_INT (_net_inet_tcp_sack, OID_AUTO, globalholes, CTLFLAG_VNET|CTLFLAG_RD, &VNET_NAME(tcp_sack_globalholes), 0, "Global number of TCP SACK holes currently allocated")
 
int tcp_dsack_block_exists (struct tcpcb *tp)
 
void tcp_update_dsack_list (struct tcpcb *tp, tcp_seq rcv_start, tcp_seq rcv_end)
 
void tcp_update_sack_list (struct tcpcb *tp, tcp_seq rcv_start, tcp_seq rcv_end)
 
void tcp_clean_dsack_blocks (struct tcpcb *tp)
 
void tcp_clean_sackreport (struct tcpcb *tp)
 
static struct sackholetcp_sackhole_alloc (struct tcpcb *tp, tcp_seq start, tcp_seq end)
 
static void tcp_sackhole_free (struct tcpcb *tp, struct sackhole *hole)
 
static struct sackholetcp_sackhole_insert (struct tcpcb *tp, tcp_seq start, tcp_seq end, struct sackhole *after)
 
static void tcp_sackhole_remove (struct tcpcb *tp, struct sackhole *hole)
 
int tcp_sack_doack (struct tcpcb *tp, struct tcpopt *to, tcp_seq th_ack)
 
void tcp_free_sackholes (struct tcpcb *tp)
 
void tcp_sack_partialack (struct tcpcb *tp, struct tcphdr *th)
 
struct sackholetcp_sack_output (struct tcpcb *tp, int *sack_bytes_rexmt)
 
void tcp_sack_adjust (struct tcpcb *tp)
 
void tcp_sack_lost_retransmission (struct tcpcb *tp, struct tcphdr *th)
 

Macro Definition Documentation

◆ V_sack_hole_zone

#define V_sack_hole_zone   VNET(sack_hole_zone)

Definition at line 130 of file tcp_sack.c.

Function Documentation

◆ __FBSDID()

__FBSDID ( "$FreeBSD$"  )

◆ SYSCTL_INT() [1/5]

SYSCTL_INT ( _net_inet_tcp_sack  ,
OID_AUTO  ,
enable  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEtcp_do_sack,
,
"Enable/Disable TCP SACK support"   
)

◆ SYSCTL_INT() [2/5]

SYSCTL_INT ( _net_inet_tcp_sack  ,
OID_AUTO  ,
globalholes  ,
CTLFLAG_VNET|  CTLFLAG_RD,
VNET_NAMEtcp_sack_globalholes,
,
"Global number of TCP SACK holes currently allocated"   
)

◆ SYSCTL_INT() [3/5]

SYSCTL_INT ( _net_inet_tcp_sack  ,
OID_AUTO  ,
globalmaxholes  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEtcp_sack_globalmaxholes,
,
"Global maximum number of TCP SACK holes"   
)

◆ SYSCTL_INT() [4/5]

SYSCTL_INT ( _net_inet_tcp_sack  ,
OID_AUTO  ,
maxholes  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEtcp_sack_maxholes,
,
"Maximum number of TCP SACK holes allowed per connection"   
)

◆ SYSCTL_INT() [5/5]

SYSCTL_INT ( _net_inet_tcp_sack  ,
OID_AUTO  ,
revised  ,
CTLFLAG_VNET|  CTLFLAG_RW,
VNET_NAMEtcp_do_newsack,
,
"Use revised SACK loss recovery per RFC 6675"   
)

◆ SYSCTL_NODE()

SYSCTL_NODE ( _net_inet_tcp  ,
OID_AUTO  ,
sack  ,
CTLFLAG_RW|  CTLFLAG_MPSAFE,
,
"TCP SACK"   
)

◆ tcp_clean_dsack_blocks()

void tcp_clean_dsack_blocks ( struct tcpcb tp)

Definition at line 409 of file tcp_sack.c.

References sackblk::end, INP_WLOCK_ASSERT, tcpcb::rcv_numsacks, tcpcb::rcv_nxt, tcpcb::sackblks, SEQ_GEQ, SEQ_LEQ, sackblk::start, and tcpcb::t_inpcb.

Referenced by bbr_output_wtime(), rack_output(), and tcp_default_output().

Here is the caller graph for this function:

◆ tcp_clean_sackreport()

void tcp_clean_sackreport ( struct tcpcb tp)

Definition at line 451 of file tcp_sack.c.

References sackblk::end, INP_WLOCK_ASSERT, tcpcb::rcv_numsacks, tcpcb::sackblks, sackblk::start, and tcpcb::t_inpcb.

Referenced by bbr_do_fastnewdata(), rack_do_fastnewdata(), tcp_do_segment(), and tcp_drain().

Here is the caller graph for this function:

◆ tcp_dsack_block_exists()

int tcp_dsack_block_exists ( struct tcpcb tp)

Definition at line 161 of file tcp_sack.c.

References sackblk::end, tcpcb::rcv_numsacks, tcpcb::rcv_nxt, tcpcb::sackblks, and SEQ_LEQ.

Referenced by rack_output().

Here is the caller graph for this function:

◆ tcp_free_sackholes()

void tcp_free_sackholes ( struct tcpcb tp)

Definition at line 830 of file tcp_sack.c.

References INP_WLOCK_ASSERT, sackhint::nexthole, sackhint::sack_bytes_rexmit, tcpcb::sackhint, tcpcb::snd_numholes, tcpcb::t_inpcb, and tcp_sackhole_remove().

Referenced by tcp_discardcb(), tcp_mtudisc(), tcp_timer_2msl(), and tcp_timer_rexmt().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_sack_adjust()

void tcp_sack_adjust ( struct tcpcb tp)

Definition at line 977 of file tcp_sack.c.

References sackhole::end, INP_WLOCK_ASSERT, SEQ_GEQ, SEQ_LT, tcpcb::snd_fack, tcpcb::snd_nxt, sackhole::start, and tcpcb::t_inpcb.

Referenced by tcp_default_output().

Here is the caller graph for this function:

◆ tcp_sack_doack()

◆ tcp_sack_lost_retransmission()

void tcp_sack_lost_retransmission ( struct tcpcb tp,
struct tcphdr *  th 
)

◆ tcp_sack_output()

struct sackhole * tcp_sack_output ( struct tcpcb tp,
int *  sack_bytes_rexmt 
)

Definition at line 952 of file tcp_sack.c.

References sackhole::end, INP_WLOCK_ASSERT, sackhint::nexthole, sackhole::rxmit, sackhint::sack_bytes_rexmit, tcpcb::sackhint, SEQ_LT, and tcpcb::t_inpcb.

Referenced by tcp_default_output().

Here is the caller graph for this function:

◆ tcp_sack_partialack()

void tcp_sack_partialack ( struct tcpcb tp,
struct tcphdr *  th 
)

◆ tcp_sackhole_alloc()

static struct sackhole * tcp_sackhole_alloc ( struct tcpcb tp,
tcp_seq  start,
tcp_seq  end 
)
static

◆ tcp_sackhole_free()

static void tcp_sackhole_free ( struct tcpcb tp,
struct sackhole hole 
)
static

Definition at line 493 of file tcp_sack.c.

References tcpcb::snd_numholes, V_sack_hole_zone, and V_tcp_sack_globalholes.

Referenced by tcp_sackhole_remove().

Here is the caller graph for this function:

◆ tcp_sackhole_insert()

static struct sackhole * tcp_sackhole_insert ( struct tcpcb tp,
tcp_seq  start,
tcp_seq  end,
struct sackhole after 
)
static

Definition at line 509 of file tcp_sack.c.

References sackhole::end, sackhint::nexthole, tcpcb::sackhint, sackhole::start, and tcp_sackhole_alloc().

Referenced by tcp_sack_doack(), and tcp_sack_partialack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_sackhole_remove()

static void tcp_sackhole_remove ( struct tcpcb tp,
struct sackhole hole 
)
static

Definition at line 536 of file tcp_sack.c.

References sackhint::nexthole, tcpcb::sackhint, and tcp_sackhole_free().

Referenced by tcp_free_sackholes(), and tcp_sack_doack().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ tcp_update_dsack_list()

void tcp_update_dsack_list ( struct tcpcb tp,
tcp_seq  rcv_start,
tcp_seq  rcv_end 
)

Definition at line 176 of file tcp_sack.c.

References sackblk::end, INP_WLOCK_ASSERT, tcpcb::rcv_numsacks, tcpcb::rcv_nxt, tcpcb::sackblks, SEQ_GT, SEQ_LEQ, SEQ_LT, SEQ_MAX, SEQ_MIN, sackblk::start, and tcpcb::t_inpcb.

Referenced by bbr_process_data(), rack_process_data(), and tcp_do_segment().

Here is the caller graph for this function:

◆ tcp_update_sack_list()

void tcp_update_sack_list ( struct tcpcb tp,
tcp_seq  rcv_start,
tcp_seq  rcv_end 
)

◆ VNET_DECLARE()

VNET_DECLARE ( struct uma_zone *  ,
sack_hole_zone   
)

◆ VNET_DEFINE() [1/5]

VNET_DEFINE ( int  ,
tcp_do_newsack   
)

◆ VNET_DEFINE() [2/5]

VNET_DEFINE ( int  ,
tcp_do_sack   
)

◆ VNET_DEFINE() [3/5]

VNET_DEFINE ( int  ,
tcp_sack_globalholes   
)
pure virtual

◆ VNET_DEFINE() [4/5]

VNET_DEFINE ( int  ,
tcp_sack_globalmaxholes   
)

◆ VNET_DEFINE() [5/5]

VNET_DEFINE ( int  ,
tcp_sack_maxholes   
)