mirror of
https://git.savannah.nongnu.org/git/lwip.git
synced 2026-05-19 06:36:51 +08:00
tcp: fix cwnd rollover introduced by ABC
Changes for TCP Appropriate Byte Counting introduce a potential cwnd rollover by not taking into account integer promotion on tcpwnd_size_t during inequality comparisions This fixes the issue by introducing a macro TCP_WND_INC which detects the rollover correctly and now holds the tcpwnd_size_t at the maximum value rather than not incrementing the window. This provides a slight performance improvement by allowing full use of the tcpwnd_size_t number space for the congestion window
This commit is contained in:
@@ -143,6 +143,14 @@ typedef err_t (*tcp_connected_fn)(void *arg, struct tcp_pcb *tpcb, err_t err);
|
||||
#define TCPWND16(x) (x)
|
||||
#define TCP_WND_MAX(pcb) TCP_WND
|
||||
#endif
|
||||
/* Increments a tcpwnd_size_t and holds at max value rather than rollover */
|
||||
#define TCP_WND_INC(wnd, inc) do { \
|
||||
if ((tcpwnd_size_t)(wnd + inc) >= wnd) { \
|
||||
wnd += inc; \
|
||||
} else { \
|
||||
wnd = (tcpwnd_size_t)-1; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
#if LWIP_WND_SCALE || TCP_LISTEN_BACKLOG || LWIP_TCP_TIMESTAMPS
|
||||
typedef u16_t tcpflags_t;
|
||||
|
||||
Reference in New Issue
Block a user