diff options
author | Ben Magistro <koncept1@gmail.com> | 2022-01-20 22:27:03 +0000 |
---|---|---|
committer | Ben Magistro <koncept1@gmail.com> | 2022-02-01 15:00:31 +0000 |
commit | 324b4cfd81e2db76d0b817f886ee34ba12e42a3c (patch) | |
tree | b70488bd42bd39a52039cab3b07054f6c1af6698 /lib | |
parent | 5d42e683caeff787a618e2b9180d41dcd1825286 (diff) |
Set PSH flag when calling send
As described in RFC 793 section 2.8, this change implements setting the
PSH flag for TCP when sending the last data segment that has been
enqueued.
Signed-off-by: Ben Magistro <koncept1@gmail.com>
Change-Id: I24f2410d204bc2391c0d8253ae81d5a694be27ef
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libtle_l4p/tcp_rxtx.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/libtle_l4p/tcp_rxtx.c b/lib/libtle_l4p/tcp_rxtx.c index 9c80f66..a702177 100644 --- a/lib/libtle_l4p/tcp_rxtx.c +++ b/lib/libtle_l4p/tcp_rxtx.c @@ -306,7 +306,7 @@ tcp_fill_mbuf(struct rte_mbuf *m, const struct tle_tcp_stream *s, */ static inline void tcp_update_mbuf(struct rte_mbuf *m, uint32_t type, const struct tcb *tcb, - uint32_t seq, uint32_t pid) + uint32_t seq, uint32_t pid, uint8_t tcp_flags) { struct rte_tcp_hdr *l4h; uint32_t len; @@ -317,6 +317,8 @@ tcp_update_mbuf(struct rte_mbuf *m, uint32_t type, const struct tcb *tcb, l4h->sent_seq = rte_cpu_to_be_32(seq); l4h->recv_ack = rte_cpu_to_be_32(tcb->rcv.nxt); + l4h->tcp_flags |= tcp_flags; + if (tcb->so.ts.raw != 0) fill_tms_opts(l4h + 1, tcb->snd.ts, tcb->rcv.ts); @@ -394,6 +396,7 @@ tx_data_bulk(struct tle_tcp_stream *s, union seqlen *sl, struct rte_mbuf *mi[], struct tle_dev *dev; struct rte_mbuf *mb; struct rte_mbuf *mo[MAX_PKT_BURST + TCP_MAX_PKT_SEG]; + uint8_t tcp_flags; mss = s->tcb.snd.mss; type = s->s.type; @@ -404,6 +407,8 @@ tx_data_bulk(struct tle_tcp_stream *s, union seqlen *sl, struct rte_mbuf *mi[], k = 0; tn = 0; fail = 0; + tcp_flags = 0x0; + for (i = 0; i != num && sl->len != 0 && fail == 0; i++) { mb = mi[i]; @@ -413,8 +418,12 @@ tx_data_bulk(struct tle_tcp_stream *s, union seqlen *sl, struct rte_mbuf *mi[], /*fast path, no need to use indirect mbufs. */ if (plen <= sz) { + if (i == (num - 1)) { + tcp_flags |= TCP_FLAG_PSH; + } + /* update pkt TCP header */ - tcp_update_mbuf(mb, type, &s->tcb, sl->seq, pid + i); + tcp_update_mbuf(mb, type, &s->tcb, sl->seq, pid + i, tcp_flags); /* keep mbuf till ACK is received. */ rte_pktmbuf_refcnt_update(mb, 1); |