diff --git a/kernel/Kconfig b/kernel/Kconfig index 78bd4a89..e9ad6ee0 100644 --- a/kernel/Kconfig +++ b/kernel/Kconfig @@ -105,6 +105,15 @@ config MARS_SEPARATE_PORTS If unsure, say Y. +config MARS_IPv4_TOS + bool "use TOS / DSCP in IPv4" + depends on MARS_SEPARATE_PORTS + default y + ---help--- + Tag IP traffic differently for different ports. + In certain private networks, this can improve certain + network bottlenecks. + config MARS_MEM_RETRY bool "make MARS memory allocation more robust" depends on MARS diff --git a/kernel/mars_net.c b/kernel/mars_net.c index 7ad50328..bccf7e32 100644 --- a/kernel/mars_net.c +++ b/kernel/mars_net.c @@ -189,7 +189,9 @@ void _set_socketopts(struct socket *sock, struct mars_tcp_params *params) sock->sk->sk_reuse = 1; _setsockopt(sock, SOL_SOCKET, SO_SNDBUFFORCE, params->tcp_window_size); _setsockopt(sock, SOL_SOCKET, SO_RCVBUFFORCE, params->tcp_window_size); +#ifdef CONFIG_MARS_IPv4_TOS _setsockopt(sock, SOL_IP, IP_TOS, params->ip_tos); +#endif _setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, params->tcp_nodelay); _setsockopt(sock, SOL_SOCKET, SO_KEEPALIVE, x_true); _setsockopt(sock, IPPROTO_TCP, TCP_KEEPCNT, params->tcp_keepcnt);