From 757f470aefea09fda41df9cfa713ed16a9b67452 Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Fri, 30 Apr 2021 17:50:29 -0700 Subject: [PATCH] quic: improve udp dgram write Type: improvement Signed-off-by: Florin Coras Change-Id: I2992c66d11fe6adc96b525b0fde533e5ff58d7e4 --- src/plugins/quic/quic.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/plugins/quic/quic.c b/src/plugins/quic/quic.c index 4a2020ca0e1..0cd2800728a 100644 --- a/src/plugins/quic/quic.c +++ b/src/plugins/quic/quic.c @@ -683,19 +683,16 @@ quic_send_datagram (session_t *udp_session, struct iovec *packet, QUIC_ASSERT (dest->sa.sa_family == AF_INET6); struct sockaddr_in6 *sa6 = (struct sockaddr_in6 *) &dest->sa; hdr.rmt_port = sa6->sin6_port; - clib_memcpy (&hdr.rmt_ip.ip6, &sa6->sin6_addr, 16); + clib_memcpy_fast (&hdr.rmt_ip.ip6, &sa6->sin6_addr, 16); } - ret = svm_fifo_enqueue (f, sizeof (hdr), (u8 *) & hdr); - if (ret != sizeof (hdr)) - { - QUIC_ERR ("Not enough space to enqueue header"); - return QUIC_ERROR_FULL_FIFO; - } - ret = svm_fifo_enqueue (f, len, packet->iov_base); - if (ret != len) + svm_fifo_seg_t segs[2] = { { (u8 *) &hdr, sizeof (hdr) }, + { packet->iov_base, len } }; + + ret = svm_fifo_enqueue_segments (f, segs, 2, 0 /* allow partial */); + if (PREDICT_FALSE (ret < 0)) { - QUIC_ERR ("Not enough space to enqueue payload"); + QUIC_ERR ("Not enough space to enqueue dgram"); return QUIC_ERROR_FULL_FIFO; } -- 2.16.6