From 18c394976ebd841c3ba31e5e72a92821a81e3cc0 Mon Sep 17 00:00:00 2001 From: whitequark Date: Sun, 13 Nov 2016 00:33:24 +0000 Subject: [PATCH] runtime: disable the Nagle algorithm entirely. See also commit feed91d; that commit fixed the test_rpc_timing test, but caused frequent hangs elsewhere, which were also caused by buggy Nagle implementation. Just disable this entirely, as with our explicit buffering it provides no benefit anyway. --- artiq/runtime.rs/liblwip-sys/lib.rs | 1 + artiq/runtime.rs/liblwip/lib.rs | 1 + artiq/runtime/main.c | 4 ++++ 3 files changed, 6 insertions(+) diff --git a/artiq/runtime.rs/liblwip-sys/lib.rs b/artiq/runtime.rs/liblwip-sys/lib.rs index 82a7c5bcf..912b7c381 100644 --- a/artiq/runtime.rs/liblwip-sys/lib.rs +++ b/artiq/runtime.rs/liblwip-sys/lib.rs @@ -149,6 +149,7 @@ extern { // nonstandard pub fn tcp_sndbuf_(pcb: *mut tcp_pcb) -> u16; pub fn tcp_so_options_(pcb: *mut tcp_pcb) -> *mut u8; + pub fn tcp_nagle_disable_(pcb: *mut tcp_pcb); pub fn udp_new() -> *mut udp_pcb; pub fn udp_new_ip_type(type_: ip_addr_type) -> *mut udp_pcb; diff --git a/artiq/runtime.rs/liblwip/lib.rs b/artiq/runtime.rs/liblwip/lib.rs index f94b65dac..7eed9497b 100644 --- a/artiq/runtime.rs/liblwip/lib.rs +++ b/artiq/runtime.rs/liblwip/lib.rs @@ -549,6 +549,7 @@ impl TcpStream { lwip_sys::tcp_recv(raw, Some(recv)); lwip_sys::tcp_sent(raw, Some(sent)); lwip_sys::tcp_err(raw, Some(err)); + lwip_sys::tcp_nagle_disable_(raw); TcpStream { raw: raw, state: state } } } diff --git a/artiq/runtime/main.c b/artiq/runtime/main.c index d5db5e5dc..c9f6f0951 100644 --- a/artiq/runtime/main.c +++ b/artiq/runtime/main.c @@ -177,6 +177,10 @@ u8_t* tcp_so_options_(struct tcp_pcb *pcb) { return &pcb->so_options; } +void tcp_nagle_disable_(struct tcp_pcb *pcb) { + tcp_nagle_disable(pcb); +} + int main(void) { irq_setmask(0);