From 9af556f2060d9d3c4dee3298321e57fb6fe72ffd Mon Sep 17 00:00:00 2001 From: Konstantin Ananyev Date: Mon, 27 Mar 2017 18:56:04 +0100 Subject: tcp: fix RCV.WND set incorreclty when peer doesn't support WSCALE option Change-Id: I911fdeeb25bc1112cd38eaa96c34f47a7bf49060 Signed-off-by: Konstantin Ananyev --- lib/libtle_l4p/tcp_ctl.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/libtle_l4p/tcp_ctl.h') diff --git a/lib/libtle_l4p/tcp_ctl.h b/lib/libtle_l4p/tcp_ctl.h index 95c2bbc..8e15b2b 100644 --- a/lib/libtle_l4p/tcp_ctl.h +++ b/lib/libtle_l4p/tcp_ctl.h @@ -45,7 +45,14 @@ tcp_stream_up(struct tle_tcp_stream *s) static inline uint32_t calc_rx_wnd(const struct tle_tcp_stream *s, uint32_t scale) { - return s->rx.q->prod.mask << scale; + uint32_t wnd; + + /* peer doesn't support WSCALE option, wnd size is limited to 64K */ + if (scale == TCP_WSCALE_NONE) { + wnd = s->rx.q->prod.mask << TCP_WSCALE_DEFAULT; + return RTE_MIN(wnd, (uint32_t)UINT16_MAX); + } else + return s->rx.q->prod.mask << scale; } /* empty stream's receive queue */ -- cgit 1.2.3-korg