diff options
author | 2017-03-27 18:56:04 +0100 | |
---|---|---|
committer | 2017-03-27 18:57:26 +0100 | |
commit | 9af556f2060d9d3c4dee3298321e57fb6fe72ffd (patch) | |
tree | c5f99b977c0aad4383f891cc173a112dc3df8177 /lib/libtle_l4p | |
parent | c4c44906536c07fd3d684175db6a5dae05682947 (diff) |
tcp: fix RCV.WND set incorreclty when peer doesn't support WSCALE option
Change-Id: I911fdeeb25bc1112cd38eaa96c34f47a7bf49060
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Diffstat (limited to 'lib/libtle_l4p')
-rw-r--r-- | lib/libtle_l4p/tcp_ctl.h | 9 | ||||
-rw-r--r-- | lib/libtle_l4p/tcp_rxtx.c | 5 |
2 files changed, 13 insertions, 1 deletions
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 */ diff --git a/lib/libtle_l4p/tcp_rxtx.c b/lib/libtle_l4p/tcp_rxtx.c index a6b3989..b525751 100644 --- a/lib/libtle_l4p/tcp_rxtx.c +++ b/lib/libtle_l4p/tcp_rxtx.c @@ -1547,6 +1547,11 @@ rx_synack(struct tle_tcp_stream *s, uint32_t ts, uint32_t state, s->tcb.rcv.irs = si->seq; s->tcb.rcv.nxt = si->seq + 1; + /* if peer doesn't support WSCALE opt, recalculate RCV.WND */ + s->tcb.rcv.wscale = (so.wscale == TCP_WSCALE_NONE) ? + TCP_WSCALE_NONE : TCP_WSCALE_DEFAULT; + s->tcb.rcv.wnd = calc_rx_wnd(s, s->tcb.rcv.wscale); + /* calculate initial rto */ rto_estimate(&s->tcb, ts - s->tcb.snd.ts); |