DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dunedaq::dpdklibs::sender Namespace Reference

Classes

class  BufGuard
class  CallbackGate
struct  DpdkTxBackend
class  WIBEthTransmitter

Enumerations

enum class  TxOutcome { kSent , kAllocFailed , kPrepareFailed , kTxFailed }

Functions

template<typename Backend, typename BuildFn, typename OnSentFn>
TxOutcome send_packet (Backend &backend, std::size_t packet_bytes, std::uint8_t *pre_tx_copy, BuildFn &&build, OnSentFn &&on_sent)

Enumeration Type Documentation

◆ TxOutcome

Enumerator
kSent 
kAllocFailed 
kPrepareFailed 
kTxFailed 

Definition at line 40 of file TxEngine.hpp.

41{
42 kSent, // backend took ownership of the buffer
43 kAllocFailed, // no buffer was available
44 kPrepareFailed, // append rejected: insufficient tailroom
45 kTxFailed // backend refused the packet; buffer freed
46};

Function Documentation

◆ send_packet()

template<typename Backend, typename BuildFn, typename OnSentFn>
TxOutcome dunedaq::dpdklibs::sender::send_packet ( Backend & backend,
std::size_t packet_bytes,
std::uint8_t * pre_tx_copy,
BuildFn && build,
OnSentFn && on_sent )

Definition at line 84 of file TxEngine.hpp.

85{
86 void* buf = backend.alloc();
87 if (buf == nullptr) {
89 }
90 BufGuard<Backend> guard(backend, buf);
91
92 std::uint8_t* dst = backend.prepare(buf, packet_bytes);
93 if (dst == nullptr) {
95 }
96
97 build(dst);
98 if (pre_tx_copy != nullptr) {
99 std::memcpy(pre_tx_copy, dst, packet_bytes);
100 }
101
102 if (!backend.transmit(buf)) {
104 }
105
106 guard.release();
107 on_sent();
108 return TxOutcome::kSent;
109}