mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-08 13:28:05 +00:00
VNET virtualize tcp_sendspace/tcp_recvspace and change the
type to INT. A long is not necessary as the TCP window is limited to 2**30. A larger initial window isn't useful. MFC after: 1 week
This commit is contained in:
parent
36daf0495a
commit
e233e2acb3
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=226437
@ -3517,7 +3517,7 @@ tcp_mss(struct tcpcb *tp, int offer)
|
||||
*/
|
||||
so = inp->inp_socket;
|
||||
SOCKBUF_LOCK(&so->so_snd);
|
||||
if ((so->so_snd.sb_hiwat == tcp_sendspace) && metrics.rmx_sendpipe)
|
||||
if ((so->so_snd.sb_hiwat == V_tcp_sendspace) && metrics.rmx_sendpipe)
|
||||
bufsize = metrics.rmx_sendpipe;
|
||||
else
|
||||
bufsize = so->so_snd.sb_hiwat;
|
||||
@ -3534,7 +3534,7 @@ tcp_mss(struct tcpcb *tp, int offer)
|
||||
tp->t_maxseg = mss;
|
||||
|
||||
SOCKBUF_LOCK(&so->so_rcv);
|
||||
if ((so->so_rcv.sb_hiwat == tcp_recvspace) && metrics.rmx_recvpipe)
|
||||
if ((so->so_rcv.sb_hiwat == V_tcp_recvspace) && metrics.rmx_recvpipe)
|
||||
bufsize = metrics.rmx_recvpipe;
|
||||
else
|
||||
bufsize = so->so_rcv.sb_hiwat;
|
||||
|
@ -1501,12 +1501,15 @@ tcp_ctloutput(struct socket *so, struct sockopt *sopt)
|
||||
* Set the initial send and receive socket buffer sizes for
|
||||
* newly created TCP sockets.
|
||||
*/
|
||||
u_long tcp_sendspace = 1024*32;
|
||||
SYSCTL_ULONG(_net_inet_tcp, TCPCTL_SENDSPACE, sendspace, CTLFLAG_RW,
|
||||
&tcp_sendspace , 0, "Initial send socket buffer size");
|
||||
u_long tcp_recvspace = 1024*64;
|
||||
SYSCTL_ULONG(_net_inet_tcp, TCPCTL_RECVSPACE, recvspace, CTLFLAG_RW,
|
||||
&tcp_recvspace , 0, "Initial receive socket buffer size");
|
||||
VNET_DEFINE(int, tcp_sendspace) = 1024*32;
|
||||
#define V_tcp_sendspace VNET(tcp_sendspace)
|
||||
SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_SENDSPACE, tcp_sendspace, CTLFLAG_RW,
|
||||
&VNET_NAME(tcp_sendspace), 0, "Initial send socket buffer size");
|
||||
|
||||
VNET_DEFINE(int, tcp_recvspace) = 1024*64
|
||||
#define V_tcp_recvspace VNET(tcp_recvspace)
|
||||
SYSCTL_VNET_INT(_net_inet_tcp, TCPCTL_RECVSPACE, tcp_recvspace, CTLFLAG_RW,
|
||||
&VNET_NAME(tcp_recvspace), 0, "Initial receive socket buffer size");
|
||||
|
||||
/*
|
||||
* Attach TCP protocol to socket, allocating
|
||||
@ -1521,7 +1524,7 @@ tcp_attach(struct socket *so)
|
||||
int error;
|
||||
|
||||
if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) {
|
||||
error = soreserve(so, tcp_sendspace, tcp_recvspace);
|
||||
error = soreserve(so, V_tcp_sendspace, V_tcp_recvspace);
|
||||
if (error)
|
||||
return (error);
|
||||
}
|
||||
|
@ -606,6 +606,8 @@ VNET_DECLARE(int, tcp_mssdflt); /* XXX */
|
||||
VNET_DECLARE(int, tcp_minmss);
|
||||
VNET_DECLARE(int, tcp_delack_enabled);
|
||||
VNET_DECLARE(int, tcp_do_rfc3390);
|
||||
VNET_DECLARE(int, tcp_sendspace);
|
||||
VNET_DECLARE(int, tcp_recvspace);
|
||||
VNET_DECLARE(int, path_mtu_discovery);
|
||||
VNET_DECLARE(int, ss_fltsz);
|
||||
VNET_DECLARE(int, ss_fltsz_local);
|
||||
@ -618,6 +620,8 @@ VNET_DECLARE(int, tcp_abc_l_var);
|
||||
#define V_tcp_minmss VNET(tcp_minmss)
|
||||
#define V_tcp_delack_enabled VNET(tcp_delack_enabled)
|
||||
#define V_tcp_do_rfc3390 VNET(tcp_do_rfc3390)
|
||||
#define V_tcp_sendspace VNET(tcp_sendspace)
|
||||
#define V_tcp_recvspace VNET(tcp_recvspace)
|
||||
#define V_path_mtu_discovery VNET(path_mtu_discovery)
|
||||
#define V_ss_fltsz VNET(ss_fltsz)
|
||||
#define V_ss_fltsz_local VNET(ss_fltsz_local)
|
||||
@ -716,8 +720,6 @@ void tcp_hc_updatemtu(struct in_conninfo *, u_long);
|
||||
void tcp_hc_update(struct in_conninfo *, struct hc_metrics_lite *);
|
||||
|
||||
extern struct pr_usrreqs tcp_usrreqs;
|
||||
extern u_long tcp_sendspace;
|
||||
extern u_long tcp_recvspace;
|
||||
tcp_seq tcp_new_isn(struct tcpcb *);
|
||||
|
||||
void tcp_sack_doack(struct tcpcb *, struct tcpopt *, tcp_seq);
|
||||
|
Loading…
Reference in New Issue
Block a user