aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libtle_l4p/tcp_txq.h
diff options
context:
space:
mode:
authorJianfeng Tan <henry.tjf@antfin.com>2019-11-18 06:59:50 +0000
committerJianfeng Tan <henry.tjf@antfin.com>2020-03-05 01:31:33 +0800
commit78c896b3b3127515478090c19447e27dc406427e (patch)
treed6d67d4683e9ca0409f9984a834547a572fb5310 /lib/libtle_l4p/tcp_txq.h
parente4380f4866091fd92a7a57667dd938a99144f9cd (diff)
Signed-off-by: Jianfeng Tan <henry.tjf@antfin.com> Signed-off-by: Jielong Zhou <jielong.zjl@antfin.com> Signed-off-by: Jian Zhang <wuzai.zj@antfin.com> Signed-off-by: Chen Zhao <winters.zc@antfin.com> Change-Id: I55c39de4c6cd30f991f35631eb507f770230f08e
Diffstat (limited to 'lib/libtle_l4p/tcp_txq.h')
-rw-r--r--lib/libtle_l4p/tcp_txq.h29
1 files changed, 26 insertions, 3 deletions
diff --git a/lib/libtle_l4p/tcp_txq.h b/lib/libtle_l4p/tcp_txq.h
index 78f1d56..303b8fd 100644
--- a/lib/libtle_l4p/tcp_txq.h
+++ b/lib/libtle_l4p/tcp_txq.h
@@ -68,9 +68,28 @@ tcp_txq_set_nxt_head(struct tle_tcp_stream *s, uint32_t num)
static inline void
tcp_txq_rst_nxt_head(struct tle_tcp_stream *s)
{
- struct rte_ring *r;
+ struct rte_ring *r = s->tx.q;
+ struct rte_mbuf *m;
+ uint32_t offset, data_len;
+
+ if (s->tcb.snd.nxt_pkt != NULL) {
+ s->tcb.snd.nxt_offset = 0;
+ s->tcb.snd.nxt_pkt = NULL;
+ }
+
+ offset = s->tcb.snd.una_offset;
+ if (offset) {
+ m = (struct rte_mbuf *)(_rte_ring_get_data(r)[r->cons.tail & r->mask]);
+ data_len = m->data_len - PKT_L234_HLEN(m);
+ while (offset >= data_len) {
+ offset -= data_len;
+ m = m->next;
+ data_len = m->data_len;
+ }
+ s->tcb.snd.nxt_pkt = m;
+ s->tcb.snd.nxt_offset = offset;
+ }
- r = s->tx.q;
r->cons.head = r->cons.tail;
}
@@ -110,9 +129,13 @@ static inline uint32_t
txs_dequeue_bulk(struct tle_ctx *ctx, struct tle_tcp_stream *s[], uint32_t num)
{
struct rte_ring *r;
+ uint32_t n, i;
r = CTX_TCP_TSQ(ctx);
- return _rte_ring_dequeue_burst(r, (void **)s, num);
+ n = _rte_ring_dequeue_burst(r, (void **)s, num);
+ for (i = 0; i < n; i++)
+ rte_atomic32_clear(&s[i]->tx.arm);
+ return n;
}
#ifdef __cplusplus