diff options
author | Jielong Zhou <jielong.zjl@antfin.com> | 2019-07-02 20:21:01 +0800 |
---|---|---|
committer | Jielong Zhou <jielong.zjl@antfin.com> | 2019-08-13 12:19:01 +0800 |
commit | 17f6b7ad23f52784f0a6897480d7a6050806aa65 (patch) | |
tree | 363b2d37642ec9ff9473c47afd80775d6341e516 /lib/libtle_l4p/tcp_rxq.h | |
parent | 3fbc22a6729f577e03a5be527671a3d7ac11ef25 (diff) |
l4p/tcp_ofo: fix handling out-of-order packets
Problems are:
1. ofodb could not be assigned directly, as direct assignment does not
copy the mbuf pointer area belonging to it.
2. _ofo_insert_new and _ofo_insert_right doesn't remove overlap correctly.
3. _ofo_insert_new insert new db in wrong position.
4. rx_ofo_reduce sets wrong seq, and would insert overlapped data into
rx queue.
5. _ofo_compact may miss compacting some ofodbs and doesn't update partly
moved ofodb correctly.
Change-Id: I03f1065ef5a15ef2abc664f9cc98910aab72d39b
Signed-off-by: Jielong Zhou <jielong.zjl@antfin.com>
Diffstat (limited to 'lib/libtle_l4p/tcp_rxq.h')
-rw-r--r-- | lib/libtle_l4p/tcp_rxq.h | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/lib/libtle_l4p/tcp_rxq.h b/lib/libtle_l4p/tcp_rxq.h index 01f34fa..2351ee6 100644 --- a/lib/libtle_l4p/tcp_rxq.h +++ b/lib/libtle_l4p/tcp_rxq.h @@ -46,14 +46,16 @@ rx_ofo_enqueue(struct tle_tcp_stream *s, union seqlen *sl, static inline uint32_t rx_ofo_reduce(struct tle_tcp_stream *s) { - uint32_t i, n, end, seq; + uint32_t i, n, seq; struct ofo *ofo; struct ofodb *db; - union seqlen sl; seq = s->tcb.rcv.nxt; ofo = s->rx.ofo; + if (ofo->nb_elem == 0) + return 0; + n = 0; for (i = 0; i != ofo->nb_elem; i++) { @@ -63,15 +65,11 @@ rx_ofo_reduce(struct tle_tcp_stream *s) if (tcp_seq_lt(seq, db->sl.seq)) break; - end = db->sl.seq + db->sl.len; - /* this db is fully overlapped */ - if (tcp_seq_leq(end, seq)) + if (tcp_seq_leq(db->sl.seq + db->sl.len, seq)) _ofodb_free(db); else - n += _ofodb_enqueue(s->rx.q, db, &sl); - - seq = sl.seq + sl.len; + n += _ofodb_enqueue(s->rx.q, db, &seq); } s->tcb.rcv.nxt = seq; |