PcapPlusPlus  Next
pcpp::XdpDevice::XdpDeviceConfiguration Struct Reference

#include <XdpDevice.h>

Public Types

enum  AttachMode { SkbMode = 1 , DriverMode = 2 , AutoMode = 3 }
 

Public Member Functions

 XdpDeviceConfiguration (AttachMode attachMode=AutoMode, uint16_t umemNumFrames=0, uint16_t umemFrameSize=0, uint32_t fillRingSize=0, uint32_t completionRingSize=0, uint32_t rxSize=0, uint32_t txSize=0, uint16_t rxTxBatchSize=0)
 

Public Attributes

AttachMode attachMode
 
uint16_t umemNumFrames
 
uint16_t umemFrameSize
 
uint32_t fillRingSize
 
uint32_t completionRingSize
 
uint32_t rxSize
 
uint32_t txSize
 
uint16_t rxTxBatchSize
 

Detailed Description

A struct containing the configuration parameters available for opening an XDP device

Member Enumeration Documentation

◆ AttachMode

AF_XDP operation mode

Enumerator
SkbMode 

A fallback mode that works for any network device. Use it if the network driver doesn't have support for XDP

DriverMode 

Use this mode if the network driver has support for XDP

AutoMode 

Automatically detect whether driver mode is supported, otherwise fallback to SKB mode

Constructor & Destructor Documentation

◆ XdpDeviceConfiguration()

pcpp::XdpDevice::XdpDeviceConfiguration::XdpDeviceConfiguration ( AttachMode  attachMode = AutoMode,
uint16_t  umemNumFrames = 0,
uint16_t  umemFrameSize = 0,
uint32_t  fillRingSize = 0,
uint32_t  completionRingSize = 0,
uint32_t  rxSize = 0,
uint32_t  txSize = 0,
uint16_t  rxTxBatchSize = 0 
)
inlineexplicit

A c'tor for this struct. Each parameter has a default value described below.

Parameters
[in]attachModeAF_XDP operation mode. The default value is auto mode
[in]umemNumFramesNumber of UMEM frames to allocate. The default value is 4096
[in]umemFrameSizeThe size of each UMEM frame. The default value is equal to getpagesize()
[in]fillRingSizeThe size of the fill ring used by the AF_XDP socket. The default value is 4096
[in]completionRingSizeThe size of the completion ring used by the AF_XDP socket. The default value is 2048
[in]rxSizeThe size of the RX ring used by the AF_XDP socket. The default value is 2048
[in]txSizeThe size of the TX ring used by the AF_XDP socket. The default value is 2048
[in]rxTxBatchSizeThe max number of packets to be received or sent in one batch. The default value is 64

Member Data Documentation

◆ attachMode

AttachMode pcpp::XdpDevice::XdpDeviceConfiguration::attachMode

AF_XDP operation mode

◆ completionRingSize

uint32_t pcpp::XdpDevice::XdpDeviceConfiguration::completionRingSize

The size of the completion ring used by the AF_XDP socket. This size should be a power of two and less or equal to the total number of UMEM frames

◆ fillRingSize

uint32_t pcpp::XdpDevice::XdpDeviceConfiguration::fillRingSize

The size of the fill ring used by the AF_XDP socket. This size should be a power of two and less or equal to the total number of UMEM frames

◆ rxSize

uint32_t pcpp::XdpDevice::XdpDeviceConfiguration::rxSize

The size of the RX ring used by the AF_XDP socket. This size should be a power of two and less or equal to the total number of UMEM frames

◆ rxTxBatchSize

uint16_t pcpp::XdpDevice::XdpDeviceConfiguration::rxTxBatchSize

The max number of packets to be received or sent in one batch

◆ txSize

uint32_t pcpp::XdpDevice::XdpDeviceConfiguration::txSize

The size of the TX ring used by the AF_XDP socket. This size should be a power of two and less or equal to the total number of UMEM frames

◆ umemFrameSize

uint16_t pcpp::XdpDevice::XdpDeviceConfiguration::umemFrameSize

UMEM is a region of virtual contiguous memory, divided into equal-sized frames. This parameter determines the frame size that will be allocated. NOTE: the frame size should be equal to the memory page size (use getpagesize() to determine this size)

◆ umemNumFrames

uint16_t pcpp::XdpDevice::XdpDeviceConfiguration::umemNumFrames

UMEM is a region of virtual contiguous memory, divided into equal-sized frames. This parameter determines the number of frames that will be allocated as pert of the UMEM.