diff options
Diffstat (limited to 'lib/libtle_l4p/tcp_ctl.h')
-rw-r--r-- | lib/libtle_l4p/tcp_ctl.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lib/libtle_l4p/tcp_ctl.h b/lib/libtle_l4p/tcp_ctl.h index 95c2bbc..8ffb924 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 */ @@ -89,13 +96,13 @@ tcp_stream_reset(struct tle_ctx *ctx, struct tle_tcp_stream *s) rte_atomic32_set(&s->tx.arm, 0); /* reset TCB */ - uop = s->tcb.uop & (TCP_OP_LISTEN | TCP_OP_CONNECT); + uop = s->tcb.uop & ~TCP_OP_CLOSE; memset(&s->tcb, 0, sizeof(s->tcb)); /* reset cached destination */ memset(&s->tx.dst, 0, sizeof(s->tx.dst)); - if (uop != 0) { + if (uop != TCP_OP_ACCEPT) { /* free stream's destination port */ stream_clear_ctx(ctx, &s->s); if (uop == TCP_OP_LISTEN) |