Changeset View
Standalone View
sys/kern/uipc_socket.c
Show First 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | |||||
* sopoll() currently does not need a VNET context to be set. | * sopoll() currently does not need a VNET context to be set. | ||||
*/ | */ | ||||
#include <sys/cdefs.h> | #include <sys/cdefs.h> | ||||
__FBSDID("$FreeBSD$"); | __FBSDID("$FreeBSD$"); | ||||
#include "opt_inet.h" | #include "opt_inet.h" | ||||
#include "opt_inet6.h" | #include "opt_inet6.h" | ||||
#include "opt_ratelimit.h" | |||||
#include "opt_compat.h" | #include "opt_compat.h" | ||||
#include <sys/param.h> | #include <sys/param.h> | ||||
#include <sys/systm.h> | #include <sys/systm.h> | ||||
#include <sys/fcntl.h> | #include <sys/fcntl.h> | ||||
#include <sys/limits.h> | #include <sys/limits.h> | ||||
#include <sys/lock.h> | #include <sys/lock.h> | ||||
#include <sys/mac.h> | #include <sys/mac.h> | ||||
▲ Show 20 Lines • Show All 2,549 Lines • ▼ Show 20 Lines | #endif | ||||
break; | break; | ||||
} | } | ||||
break; | break; | ||||
case SO_LABEL: | case SO_LABEL: | ||||
#ifdef MAC | #ifdef MAC | ||||
error = sooptcopyin(sopt, &extmac, sizeof extmac, | error = sooptcopyin(sopt, &extmac, sizeof extmac, | ||||
sizeof extmac); | sizeof extmac); | ||||
if (error) | if (error) | ||||
julian: is 32 bits good for the next 100 years? | |||||
Done Inline ActionsTCP is a 32-bit protocol. Due to the window sizes wrapping too quickly, TCP is not suitable for speeds in the 100GBit/s range going long distance. Most likely typical speeds for this API will be well below 16 GBit/s which is the maximum we can support when using a 32-bit unsigned integer. hselasky: TCP is a 32-bit protocol. Due to the window sizes wrapping too quickly, TCP is not suitable for… | |||||
goto bad; | goto bad; | ||||
error = mac_setsockopt_label(sopt->sopt_td->td_ucred, | error = mac_setsockopt_label(sopt->sopt_td->td_ucred, | ||||
so, &extmac); | so, &extmac); | ||||
#else | #else | ||||
Done Inline ActionsPersonally, I would rather store the user-requested value separately from the actual value deployed on the card.
And, at minimum, this solves problems where you want to track the user-requested pacing rate even where the actual deployed value varies due to errors. (See, for example, your error handling code at sys/netinet/ip_output.c:651.) (Note: some of these are incomplete thoughts; ping me if I need to fill in the details. Bottom line: I think we should track deployed value separately from the requested value.) jtl: Personally, I would rather store the user-requested value separately from the actual value… | |||||
error = EOPNOTSUPP; | error = EOPNOTSUPP; | ||||
#endif | #endif | ||||
break; | break; | ||||
case SO_MAX_PACING_RATE: | |||||
#ifdef RATELIMIT | |||||
error = sooptcopyin(sopt, &val32, sizeof(val32), | |||||
sizeof(val32)); | |||||
if (error) | |||||
goto bad; | |||||
so->so_max_pacing_rate = val32; | |||||
Done Inline ActionsSince so_max_pacing_rate has to be in the so unconditionally, I'd use less heavy-handed ifdefs so all the code was still compiled & it is less jarring to read. gallatin: Since so_max_pacing_rate has to be in the so unconditionally, I'd use less heavy-handed ifdefs… | |||||
#else | |||||
error = EOPNOTSUPP; | |||||
#endif | |||||
break; | |||||
default: | default: | ||||
if (V_socket_hhh[HHOOK_SOCKET_OPT]->hhh_nhooks > 0) | if (V_socket_hhh[HHOOK_SOCKET_OPT]->hhh_nhooks > 0) | ||||
error = hhook_run_socket(so, sopt, | error = hhook_run_socket(so, sopt, | ||||
HHOOK_SOCKET_OPT); | HHOOK_SOCKET_OPT); | ||||
else | else | ||||
error = ENOPROTOOPT; | error = ENOPROTOOPT; | ||||
break; | break; | ||||
} | } | ||||
Show All 39 Lines | |||||
sogetopt(struct socket *so, struct sockopt *sopt) | sogetopt(struct socket *so, struct sockopt *sopt) | ||||
{ | { | ||||
int error, optval; | int error, optval; | ||||
struct linger l; | struct linger l; | ||||
struct timeval tv; | struct timeval tv; | ||||
#ifdef MAC | #ifdef MAC | ||||
struct mac extmac; | struct mac extmac; | ||||
#endif | #endif | ||||
#ifdef RATELIMIT | |||||
uint32_t val32; | |||||
#endif | |||||
CURVNET_SET(so->so_vnet); | CURVNET_SET(so->so_vnet); | ||||
error = 0; | error = 0; | ||||
if (sopt->sopt_level != SOL_SOCKET) { | if (sopt->sopt_level != SOL_SOCKET) { | ||||
if (so->so_proto->pr_ctloutput != NULL) | if (so->so_proto->pr_ctloutput != NULL) | ||||
error = (*so->so_proto->pr_ctloutput)(so, sopt); | error = (*so->so_proto->pr_ctloutput)(so, sopt); | ||||
else | else | ||||
error = ENOPROTOOPT; | error = ENOPROTOOPT; | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | #endif | ||||
case SO_LISTENQLEN: | case SO_LISTENQLEN: | ||||
optval = so->so_qlen; | optval = so->so_qlen; | ||||
goto integer; | goto integer; | ||||
case SO_LISTENINCQLEN: | case SO_LISTENINCQLEN: | ||||
optval = so->so_incqlen; | optval = so->so_incqlen; | ||||
goto integer; | goto integer; | ||||
case SO_MAX_PACING_RATE: | |||||
#ifdef RATELIMIT | |||||
val32 = so->so_max_pacing_rate; | |||||
error = sooptcopyout(sopt, &val32, sizeof(val32)); | |||||
#else | |||||
error = EOPNOTSUPP; | |||||
#endif | |||||
break; | |||||
default: | default: | ||||
if (V_socket_hhh[HHOOK_SOCKET_OPT]->hhh_nhooks > 0) | if (V_socket_hhh[HHOOK_SOCKET_OPT]->hhh_nhooks > 0) | ||||
error = hhook_run_socket(so, sopt, | error = hhook_run_socket(so, sopt, | ||||
HHOOK_SOCKET_OPT); | HHOOK_SOCKET_OPT); | ||||
else | else | ||||
error = ENOPROTOOPT; | error = ENOPROTOOPT; | ||||
break; | break; | ||||
▲ Show 20 Lines • Show All 853 Lines • Show Last 20 Lines |
is 32 bits good for the next 100 years?