FastMM documentation
FastMM C++ API 0.6.0
Public headers, tier 1 and tier 2
Loading...
Searching...
No Matches
dpdk_datagram_source.hpp File Reference

DPDK datagram source (rx_backend = "dpdk"): one ethdev port, one RX and one TX queue polled from the venue's network thread. More...

#include "fastmm/core/config_macros.hpp"
#include "fastmm/core/time.hpp"
#include "fastmm/net/datagram_source.hpp"
#include "fastmm/net/udp_frame.hpp"
#include <array>
#include <cstddef>
#include <cstdint>
#include <span>
#include <string>
#include <vector>

Go to the source code of this file.

Classes

struct  fastmm::net::DpdkSubscription
 
struct  fastmm::net::DpdkConfig
 
struct  fastmm::net::DpdkStats
 
class  fastmm::net::DpdkDatagramSource
 

Namespaces

namespace  fastmm
 
namespace  fastmm::net
 

Functions

bool fastmm::net::dpdk_available () noexcept
 True when this build has the DPDK backend.
 

Detailed Description

DPDK datagram source (rx_backend = "dpdk"): one ethdev port, one RX and one TX queue polled from the venue's network thread.

Frames are parsed with parse_udp_frame (Ethernet, at most one 802.1Q tag, IPv4, UDP), matched against the subscriptions and handed to the handler; every mbuf of the burst is freed (or passed on) before poll() returns, so payload spans are valid only inside the handler call.

Frames that are not a subscribed datagram:

  • with an exception port (a net_tap vdev), everything else goes to the kernel through it, and what the kernel sends there goes out of the port: the kernel keeps an interface with the port's MAC and exception_ip (ARP, ICMP, IGMP joins, GLIMPSE, re-requests, kernel TCP). The tap is read every exception_interval_ns (a system call per read).
  • without one, ARP requests for a unicast subscription address are answered here; the rest is dropped

Multicast: a kernel UDP socket per subscription joins the group on interface so the IGMP report goes out (the exception interface when the port is bound to vfio-pci; the port's own netdev for af_packet vdevs). A unicast subscription (a local address) needs no join.

Built only with -DFASTMM_WITH_DPDK=ON (FASTMM_HAS_DPDK=1); the header compiles without DPDK so the venue can name the type. No DPDK header is included here.

EAL: initialised once per process by the first open() with DpdkConfig::eal_args; a later open() must pass the same arguments. The calling thread's CPU affinity is restored after rte_eal_init. Unprivileged use (tests, bench over veth): "\--no-huge \--no-pci \--in-memory \--no-telemetry \--vdev=net_af_packet0,iface=\<netdev\>" inside a user + network namespace (CAP_NET_RAW there).