Simplify implementation of net.inet.tcp.reass.maxsegments and
net.inet.tcp.reass.cursegments. MFC after: 2 weeks
This commit is contained in:
parent
f62563d33c
commit
aafa0b4164
@ -74,7 +74,6 @@ __FBSDID("$FreeBSD$");
|
||||
#include <netinet/tcp_debug.h>
|
||||
#endif /* TCPDEBUG */
|
||||
|
||||
static int tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS);
|
||||
static int tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS);
|
||||
|
||||
static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0,
|
||||
@ -82,16 +81,12 @@ static SYSCTL_NODE(_net_inet_tcp, OID_AUTO, reass, CTLFLAG_RW, 0,
|
||||
|
||||
static VNET_DEFINE(int, tcp_reass_maxseg) = 0;
|
||||
#define V_tcp_reass_maxseg VNET(tcp_reass_maxseg)
|
||||
SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, maxsegments,
|
||||
CTLTYPE_INT | CTLFLAG_RDTUN,
|
||||
&VNET_NAME(tcp_reass_maxseg), 0, &tcp_reass_sysctl_maxseg, "I",
|
||||
SYSCTL_VNET_INT(_net_inet_tcp_reass, OID_AUTO, maxsegments, CTLFLAG_RDTUN,
|
||||
&VNET_NAME(tcp_reass_maxseg), 0,
|
||||
"Global maximum number of TCP Segments in Reassembly Queue");
|
||||
|
||||
static VNET_DEFINE(int, tcp_reass_qsize) = 0;
|
||||
#define V_tcp_reass_qsize VNET(tcp_reass_qsize)
|
||||
SYSCTL_VNET_PROC(_net_inet_tcp_reass, OID_AUTO, cursegments,
|
||||
CTLTYPE_INT | CTLFLAG_RD,
|
||||
&VNET_NAME(tcp_reass_qsize), 0, &tcp_reass_sysctl_qsize, "I",
|
||||
(CTLTYPE_INT | CTLFLAG_RD), NULL, 0, &tcp_reass_sysctl_qsize, "I",
|
||||
"Global number of TCP Segments currently in Reassembly Queue");
|
||||
|
||||
static VNET_DEFINE(int, tcp_reass_overflows) = 0;
|
||||
@ -109,8 +104,10 @@ static void
|
||||
tcp_reass_zone_change(void *tag)
|
||||
{
|
||||
|
||||
/* Set the zone limit and read back the effective value. */
|
||||
V_tcp_reass_maxseg = nmbclusters / 16;
|
||||
uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg);
|
||||
V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone);
|
||||
}
|
||||
|
||||
void
|
||||
@ -122,7 +119,9 @@ tcp_reass_init(void)
|
||||
&V_tcp_reass_maxseg);
|
||||
V_tcp_reass_zone = uma_zcreate("tcpreass", sizeof (struct tseg_qent),
|
||||
NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
|
||||
/* Set the zone limit and read back the effective value. */
|
||||
uma_zone_set_max(V_tcp_reass_zone, V_tcp_reass_maxseg);
|
||||
V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone);
|
||||
EVENTHANDLER_REGISTER(nmbclusters_change,
|
||||
tcp_reass_zone_change, NULL, EVENTHANDLER_PRI_ANY);
|
||||
}
|
||||
@ -155,18 +154,13 @@ tcp_reass_flush(struct tcpcb *tp)
|
||||
tp, tp->t_segqlen));
|
||||
}
|
||||
|
||||
static int
|
||||
tcp_reass_sysctl_maxseg(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
V_tcp_reass_maxseg = uma_zone_get_max(V_tcp_reass_zone);
|
||||
return (sysctl_handle_int(oidp, arg1, arg2, req));
|
||||
}
|
||||
|
||||
static int
|
||||
tcp_reass_sysctl_qsize(SYSCTL_HANDLER_ARGS)
|
||||
{
|
||||
V_tcp_reass_qsize = uma_zone_get_cur(V_tcp_reass_zone);
|
||||
return (sysctl_handle_int(oidp, arg1, arg2, req));
|
||||
int qsize;
|
||||
|
||||
qsize = uma_zone_get_cur(V_tcp_reass_zone);
|
||||
return (sysctl_handle_int(oidp, &qsize, sizeof(qsize), req));
|
||||
}
|
||||
|
||||
int
|
||||
|
Loading…
Reference in New Issue
Block a user