From 6a9b58d4736908dadbd918c8336b15a328424934 Mon Sep 17 00:00:00 2001 From: Christian Giese Date: Wed, 21 Jul 2021 16:41:13 +0200 Subject: [PATCH] Minor performance optimisation. --- src/bbl_io.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bbl_io.c b/src/bbl_io.c index c5a34076..5b30d0f7 100644 --- a/src/bbl_io.c +++ b/src/bbl_io.c @@ -35,11 +35,6 @@ bbl_io_packet_mmap_rx_job (timer_s *timer) { if (!interface) { return; } - ctx = interface->ctx; - - - /* Get RX timestamp */ - clock_gettime(CLOCK_MONOTONIC, &interface->rx_timestamp); frame_ptr = interface->io.ring_rx + (interface->io.cursor_rx * interface->io.req_rx.tp_frame_size); tphdr = (struct tpacket2_hdr*)frame_ptr; @@ -52,8 +47,14 @@ bbl_io_packet_mmap_rx_job (timer_s *timer) { LOG(IO, "Failed to RX poll interface %s", interface->name); } interface->stats.poll_rx++; + return; } + ctx = interface->ctx; + + /* Get RX timestamp */ + clock_gettime(CLOCK_MONOTONIC, &interface->rx_timestamp); + while ((tphdr->tp_status & TP_STATUS_USER)) { eth_start = (uint8_t*)tphdr + tphdr->tp_mac; eth_len = tphdr->tp_len;