LCOV - code coverage report
Current view: top level - dpdklibs/src/sender - DpdkTxBackend.cpp (source / functions) Coverage Total Hit
Test: code.result Lines: 0.0 % 17 0
Test Date: 2026-10-11 15:05:20 Functions: 0.0 % 4 0

            Line data    Source code
       1              : /**
       2              :  * @file DpdkTxBackend.cpp Implementation of the DPDK TX backend.
       3              :  *
       4              :  * This is part of the DUNE DAQ , copyright 2020.
       5              :  * Licensing/copyright details are in the COPYING file that you should have
       6              :  * received with this code.
       7              :  */
       8              : #include "dpdklibs/sender/DpdkTxBackend.hpp"
       9              : 
      10              : #include <rte_ethdev.h>
      11              : #include <rte_ether.h>
      12              : #include <rte_ip.h>
      13              : #include <rte_mbuf.h>
      14              : #include <rte_udp.h>
      15              : 
      16              : #include <cstddef>
      17              : #include <cstdint>
      18              : 
      19              : namespace dunedaq::dpdklibs::sender {
      20              : 
      21              : void*
      22            0 : DpdkTxBackend::alloc()
      23              : {
      24            0 :   return rte_pktmbuf_alloc(pool);
      25              : }
      26              : 
      27              : std::uint8_t* // NOLINT(build/unsigned)
      28            0 : DpdkTxBackend::prepare(void* buf, std::size_t bytes)
      29              : {
      30            0 :   auto* mbuf = static_cast<rte_mbuf*>(buf);
      31            0 :   char* dst = rte_pktmbuf_append(mbuf, static_cast<std::uint16_t>(bytes)); // NOLINT(build/unsigned)
      32            0 :   if (dst == nullptr) {
      33              :     return nullptr;
      34              :   }
      35            0 :   mbuf->l2_len = static_cast<std::uint16_t>(sizeof(rte_ether_hdr)); // NOLINT(build/unsigned)
      36            0 :   mbuf->l3_len = static_cast<std::uint16_t>(sizeof(rte_ipv4_hdr));  // NOLINT(build/unsigned)
      37            0 :   mbuf->l4_len = static_cast<std::uint16_t>(sizeof(rte_udp_hdr));   // NOLINT(build/unsigned)
      38            0 :   return reinterpret_cast<std::uint8_t*>(dst);                      // NOLINT
      39              : }
      40              : 
      41              : bool
      42            0 : DpdkTxBackend::transmit(void* buf)
      43              : {
      44            0 :   auto* mbuf = static_cast<rte_mbuf*>(buf);
      45            0 :   rte_mbuf* one_packet = mbuf;
      46            0 :   return rte_eth_tx_burst(port, queue, &one_packet, 1) == 1;
      47              : }
      48              : 
      49              : void
      50            0 : DpdkTxBackend::free(void* buf)
      51              : {
      52            0 :   rte_pktmbuf_free(static_cast<rte_mbuf*>(buf));
      53            0 : }
      54              : 
      55              : } // namespace dunedaq::dpdklibs::sender
        

Generated by: LCOV version 2.0-1