FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
fastmm::net::XdpDatagramSource Class Reference

#include <fastmm/net/xdp_datagram_source.hpp>

Public Member Functions

 XdpDatagramSource ()=default
 
 ~XdpDatagramSource ()
 
 XdpDatagramSource (const XdpDatagramSource &)=delete
 
XdpDatagramSource & operator= (const XdpDatagramSource &)=delete
 
 XdpDatagramSource (XdpDatagramSource &&)=delete
 
XdpDatagramSource & operator= (XdpDatagramSource &&)=delete
 
int open (const XdpConfig &cfg)
 Returns 0 or -errno; error() explains.
 
void close () noexcept
 
const std::string & error () const noexcept
 
std::span< const std::string > warnings () const noexcept
 Busy-poll options the kernel refused at open (the sockets poll from user space without them).
 
template<class H >
std::size_t poll (H &&handler) noexcept
 Delivers up to batch datagrams per socket; returns the number delivered.
 
std::span< const int > fds () const noexcept
 XDP socket fds, readable when their RX ring has descriptors (adaptive mode waits on them).
 
int refresh_stats () noexcept
 Reads XDP_STATISTICS and the fallback counters (system calls; not for the hot loop).
 
const XdpStats & stats () const noexcept
 
std::span< const XdpSocketStats > socket_stats () const noexcept
 
std::span< const XdpInterfaceStatus > interfaces () const noexcept
 
XdpFilter & filter (std::size_t i) noexcept
 The filter of interfaces()[i] (tests run BPF_PROG_TEST_RUN on the attached program).
 

Constructor & Destructor Documentation

◆ XdpDatagramSource() [1/3]

fastmm::net::XdpDatagramSource::XdpDatagramSource ( )
default

◆ ~XdpDatagramSource()

fastmm::net::XdpDatagramSource::~XdpDatagramSource ( )
inline

◆ XdpDatagramSource() [2/3]

fastmm::net::XdpDatagramSource::XdpDatagramSource ( const XdpDatagramSource &  )
delete

◆ XdpDatagramSource() [3/3]

fastmm::net::XdpDatagramSource::XdpDatagramSource ( XdpDatagramSource &&  )
delete

Member Function Documentation

◆ operator=() [1/2]

XdpDatagramSource & fastmm::net::XdpDatagramSource::operator= ( const XdpDatagramSource &  )
delete

◆ operator=() [2/2]

XdpDatagramSource & fastmm::net::XdpDatagramSource::operator= ( XdpDatagramSource &&  )
delete

◆ open()

int fastmm::net::XdpDatagramSource::open ( const XdpConfig &  cfg)

Returns 0 or -errno; error() explains.

Fails with -EPERM and the setcap command when capabilities are missing, -ENOSYS before Linux 5.11, -EBUSY when an interface already has an XDP program. Never falls back to the kernel backend.

◆ close()

void fastmm::net::XdpDatagramSource::close ( )
noexcept

◆ error()

const std::string & fastmm::net::XdpDatagramSource::error ( ) const
inlinenoexcept

◆ warnings()

std::span< const std::string > fastmm::net::XdpDatagramSource::warnings ( ) const
inlinenoexcept

Busy-poll options the kernel refused at open (the sockets poll from user space without them).

◆ poll()

template<class H >
std::size_t fastmm::net::XdpDatagramSource::poll ( H &&  handler)
inlinenoexcept

Delivers up to batch datagrams per socket; returns the number delivered.

◆ fds()

std::span< const int > fastmm::net::XdpDatagramSource::fds ( ) const
inlinenoexcept

XDP socket fds, readable when their RX ring has descriptors (adaptive mode waits on them).

◆ refresh_stats()

int fastmm::net::XdpDatagramSource::refresh_stats ( )
noexcept

Reads XDP_STATISTICS and the fallback counters (system calls; not for the hot loop).

◆ stats()

const XdpStats & fastmm::net::XdpDatagramSource::stats ( ) const
inlinenoexcept

◆ socket_stats()

std::span< const XdpSocketStats > fastmm::net::XdpDatagramSource::socket_stats ( ) const
inlinenoexcept

◆ interfaces()

std::span< const XdpInterfaceStatus > fastmm::net::XdpDatagramSource::interfaces ( ) const
inlinenoexcept

◆ filter()

XdpFilter & fastmm::net::XdpDatagramSource::filter ( std::size_t  i)
inlinenoexcept

The filter of interfaces()[i] (tests run BPF_PROG_TEST_RUN on the attached program).