1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-17 10:26:15 +00:00

-Put the optimized soreceive_stream() under a compile time option called

TCP_SORECEIVE_STREAM for the time being.

Requested by:	brooks

Once compiled in make it easily switchable for testers by using a tuneable
 net.inet.tcp.soreceive_stream
and a corresponding read-only sysctl to report the current state.

Suggested by:	rwatson

MFC after:	2 days
This commit is contained in:
Andre Oppermann 2009-09-15 22:23:45 +00:00
parent 812777783d
commit 11c99a6d7b
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=197236
4 changed files with 17 additions and 6 deletions

View File

@ -416,6 +416,7 @@ SLIP_IFF_OPTS opt_slip.h
TCPDEBUG TCPDEBUG
TCP_OFFLOAD_DISABLE opt_inet.h #Disable code to dispatch tcp offloading TCP_OFFLOAD_DISABLE opt_inet.h #Disable code to dispatch tcp offloading
TCP_SIGNATURE opt_inet.h TCP_SIGNATURE opt_inet.h
TCP_SORECEIVE_STREAM opt_inet.h
VLAN_ARRAY opt_vlan.h VLAN_ARRAY opt_vlan.h
XBONEHACK XBONEHACK
FLOWTABLE opt_route.h FLOWTABLE opt_route.h

View File

@ -1870,6 +1870,7 @@ soreceive_generic(struct socket *so, struct sockaddr **psa, struct uio *uio,
/* /*
* Optimized version of soreceive() for stream (TCP) sockets. * Optimized version of soreceive() for stream (TCP) sockets.
*/ */
#ifdef TCP_SORECEIVE_STREAM
int int
soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio, soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio,
struct mbuf **mp0, struct mbuf **controlp, int *flagsp) struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
@ -2062,6 +2063,7 @@ soreceive_stream(struct socket *so, struct sockaddr **psa, struct uio *uio,
sbunlock(sb); sbunlock(sb);
return (error); return (error);
} }
#endif /* TCP_SORECEIVE_STREAM */
/* /*
* Optimized version of soreceive() for simple datagram cases from userspace. * Optimized version of soreceive() for simple datagram cases from userspace.

View File

@ -259,6 +259,12 @@ SYSCTL_VNET_INT(_net_inet_tcp_inflight, OID_AUTO, stab, CTLFLAG_RW,
&VNET_NAME(tcp_inflight_stab), 0, &VNET_NAME(tcp_inflight_stab), 0,
"Inflight Algorithm Stabilization 20 = 2 packets"); "Inflight Algorithm Stabilization 20 = 2 packets");
#ifdef TCP_SORECEIVE_STREAM
static int tcp_soreceive_stream = 0;
SYSCTL_INT(_net_inet_tcp, OID_AUTO, soreceive_stream, CTLFLAG_RDTUN,
&tcp_soreceive_stream, 0, "Using soreceive_stream for TCP sockets");
#endif
VNET_DEFINE(uma_zone_t, sack_hole_zone); VNET_DEFINE(uma_zone_t, sack_hole_zone);
#define V_sack_hole_zone VNET(sack_hole_zone) #define V_sack_hole_zone VNET(sack_hole_zone)
@ -420,6 +426,14 @@ tcp_init(void)
tcp_finwait2_timeout = TCPTV_FINWAIT2_TIMEOUT; tcp_finwait2_timeout = TCPTV_FINWAIT2_TIMEOUT;
tcp_tcbhashsize = hashsize; tcp_tcbhashsize = hashsize;
#ifdef TCP_SORECEIVE_STREAM
TUNABLE_INT_FETCH("net.inet.tcp.soreceive_stream", &tcp_soreceive_stream);
if (tcp_soreceive_stream) {
tcp_usrreqs.pru_soreceive = soreceive_stream;
tcp6_usrreqs.pru_soreceive = soreceive_stream;
}
#endif
#ifdef INET6 #ifdef INET6
#define TCP_MINPROTOHDR (sizeof(struct ip6_hdr) + sizeof(struct tcphdr)) #define TCP_MINPROTOHDR (sizeof(struct ip6_hdr) + sizeof(struct tcphdr))
#else /* INET6 */ #else /* INET6 */

View File

@ -1015,9 +1015,6 @@ struct pr_usrreqs tcp_usrreqs = {
.pru_send = tcp_usr_send, .pru_send = tcp_usr_send,
.pru_shutdown = tcp_usr_shutdown, .pru_shutdown = tcp_usr_shutdown,
.pru_sockaddr = in_getsockaddr, .pru_sockaddr = in_getsockaddr,
#if 0
.pru_soreceive = soreceive_stream,
#endif
.pru_sosetlabel = in_pcbsosetlabel, .pru_sosetlabel = in_pcbsosetlabel,
.pru_close = tcp_usr_close, .pru_close = tcp_usr_close,
}; };
@ -1039,9 +1036,6 @@ struct pr_usrreqs tcp6_usrreqs = {
.pru_send = tcp_usr_send, .pru_send = tcp_usr_send,
.pru_shutdown = tcp_usr_shutdown, .pru_shutdown = tcp_usr_shutdown,
.pru_sockaddr = in6_mapped_sockaddr, .pru_sockaddr = in6_mapped_sockaddr,
#if 0
.pru_soreceive = soreceive_stream,
#endif
.pru_sosetlabel = in_pcbsosetlabel, .pru_sosetlabel = in_pcbsosetlabel,
.pru_close = tcp_usr_close, .pru_close = tcp_usr_close,
}; };