From: Florin Coras Date: Sat, 1 May 2021 00:50:29 +0000 (-0700) Subject: quic: improve udp dgram write X-Git-Tag: v21.10-rc0~151 X-Git-Url: https://gerrit.fd.io/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F84%2F32184%2F5;p=vpp.git quic: improve udp dgram write Type: improvement Signed-off-by: Florin Coras Change-Id: I2992c66d11fe6adc96b525b0fde533e5ff58d7e4 --- 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; }