diff options
author | 2019-06-28 15:04:00 +0800 | |
---|---|---|
committer | 2019-07-02 08:06:37 +0000 | |
commit | 3fbc22a6729f577e03a5be527671a3d7ac11ef25 (patch) | |
tree | 105fd343d0e033bfa14e4758dde8e0c9a28244fc /lib/libtle_l4p | |
parent | c5f8f7f0e970b5e552268addf73efb549c1bb260 (diff) |
l4p/udp: enqueue fragmented packets as a whole
Send or discard fragments of single IP/UDP packet as a whole, because part
of fragments could not be reassembled. Also avoid mbuf leak, for former
version would never free part of segments which are not sended.
Change-Id: I8cd13e60ced973a8f5d7d24369c3cbee64a38836
Signed-off-by: Jielong Zhou <jielong.zjl@antfin.com>
Diffstat (limited to 'lib/libtle_l4p')
-rw-r--r-- | lib/libtle_l4p/udp_rxtx.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libtle_l4p/udp_rxtx.c b/lib/libtle_l4p/udp_rxtx.c index 76f6316..84a13ea 100644 --- a/lib/libtle_l4p/udp_rxtx.c +++ b/lib/libtle_l4p/udp_rxtx.c @@ -457,7 +457,7 @@ stream_drb_alloc(struct tle_udp_stream *s, struct tle_drb *drbs[], static inline uint16_t queue_pkt_out(struct tle_udp_stream *s, struct tle_dev *dev, const void *pkt[], uint16_t nb_pkt, - struct tle_drb *drbs[], uint32_t *nb_drb) + struct tle_drb *drbs[], uint32_t *nb_drb, uint8_t all_or_nothing) { uint32_t bsz, i, n, nb, nbc, nbm; @@ -479,8 +479,11 @@ queue_pkt_out(struct tle_udp_stream *s, struct tle_dev *dev, return 0; /* not enough free drbs, reduce number of packets to send. */ - else if (nb != nbm) + else if (nb != nbm) { + if (all_or_nothing) + return 0; nb_pkt = nb * bsz; + } /* enqueue packets to the destination device. */ nbc = nb; @@ -581,7 +584,7 @@ tle_udp_stream_send(struct tle_stream *us, struct rte_mbuf *pkt[], if (k != i) { k += queue_pkt_out(s, dst.dev, (const void **)(uintptr_t)&pkt[k], i - k, - drb, &nb); + drb, &nb, 0); /* stream TX queue is full. */ if (k != i) { @@ -603,7 +606,7 @@ tle_udp_stream_send(struct tle_stream *us, struct rte_mbuf *pkt[], } n = queue_pkt_out(s, dst.dev, - (const void **)(uintptr_t)frag, rc, drb, &nb); + (const void **)(uintptr_t)frag, rc, drb, &nb, 1); if (n == 0) { while (rc-- != 0) rte_pktmbuf_free(frag[rc]); |