253 int waitForTxCompletionTimeoutMS = 5000);
268 int waitForTxCompletionTimeoutMS = 5000);
287 explicit XdpUmem(uint16_t numFrames, uint16_t frameSize, uint32_t fillRingSize,
288 uint32_t completionRingSize);
292 inline uint16_t getFrameSize()
const
296 inline uint16_t getFrameCount()
const
301 std::pair<bool, std::vector<uint64_t>> allocateFrames(uint32_t count);
303 void freeFrame(uint64_t addr);
305 const uint8_t* getDataPtr(uint64_t addr)
const;
307 void setData(uint64_t addr,
const uint8_t* data,
size_t dataLen);
309 inline size_t getFreeFrameCount()
311 return m_FreeFrames.size();
314 inline void* getInfo()
322 uint16_t m_FrameSize;
323 uint16_t m_FrameCount;
324 std::vector<uint64_t> m_FreeFrames;
327 struct XdpPrevDeviceStats
332 uint64_t txSentPackets;
333 uint64_t txSentBytes;
334 uint64_t txCompletedPackets;
337 std::string m_InterfaceName;
338 XdpDeviceConfiguration* m_Config;
339 bool m_ReceivingPackets;
342 XdpDeviceStats m_Stats;
343 XdpPrevDeviceStats m_PrevStats;
345 bool sendPackets(
const std::function<RawPacket(uint32_t)>& getPacketAt,
346 const std::function<uint32_t()>& getPacketCount,
bool waitForTxCompletion =
false,
347 int waitForTxCompletionTimeoutMS = 5000);
348 bool populateFillRing(uint32_t count, uint32_t rxId = 0);
349 bool populateFillRing(
const std::vector<uint64_t>& addresses, uint32_t rxId);
350 uint32_t checkCompletionRing();
351 bool configureSocket();
354 bool getSocketStats();
Definition: PointerVector.h:29
Definition: RawPacket.h:269
Definition: XdpDevice.h:24
bool receivePackets(OnPacketsArrive onPacketsArrive, void *onPacketsArriveUserCookie, int timeoutMS=5000)
XdpDeviceStats getStatistics()
bool open(const XdpDeviceConfiguration &config)
bool sendPackets(const RawPacketVector &packets, bool waitForTxCompletion=false, int waitForTxCompletionTimeoutMS=5000)
void stopReceivePackets()
bool sendPackets(RawPacket packets[], size_t packetCount, bool waitForTxCompletion=false, int waitForTxCompletionTimeoutMS=5000)
void(* OnPacketsArrive)(RawPacket packets[], uint32_t packetCount, XdpDevice *device, void *userCookie)
Definition: XdpDevice.h:34
XdpDevice(std::string interfaceName)
XdpDeviceConfiguration * getConfig() const
Definition: XdpDevice.h:273
The main namespace for the PcapPlusPlus lib.
Definition: XdpDevice.h:41
uint16_t umemNumFrames
Definition: XdpDevice.h:64
uint32_t fillRingSize
Definition: XdpDevice.h:77
uint16_t umemFrameSize
Definition: XdpDevice.h:71
AttachMode
Definition: XdpDevice.h:47
@ DriverMode
Definition: XdpDevice.h:52
@ SkbMode
Definition: XdpDevice.h:50
@ AutoMode
Definition: XdpDevice.h:54
uint32_t txSize
Definition: XdpDevice.h:95
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)
Definition: XdpDevice.h:115
uint32_t completionRingSize
Definition: XdpDevice.h:83
uint16_t rxTxBatchSize
Definition: XdpDevice.h:100
uint32_t rxSize
Definition: XdpDevice.h:89
AttachMode attachMode
Definition: XdpDevice.h:58
Definition: XdpDevice.h:136
uint64_t rxDroppedInvalidPackets
Definition: XdpDevice.h:150
timespec timestamp
Definition: XdpDevice.h:138
uint64_t rxPackets
Definition: XdpDevice.h:140
uint64_t txSentBytes
Definition: XdpDevice.h:162
uint64_t txRingId
Definition: XdpDevice.h:174
uint64_t rxRingId
Definition: XdpDevice.h:172
uint64_t umemAllocatedFrames
Definition: XdpDevice.h:180
uint64_t txSentBytesPerSec
Definition: XdpDevice.h:164
uint64_t txDroppedInvalidPackets
Definition: XdpDevice.h:170
uint64_t fqRingId
Definition: XdpDevice.h:176
uint64_t rxDroppedTotalPackets
Definition: XdpDevice.h:148
uint64_t rxPacketsPerSec
Definition: XdpDevice.h:142
uint64_t rxDroppedRxRingFullPackets
Definition: XdpDevice.h:152
uint64_t txCompletedPackets
Definition: XdpDevice.h:166
uint64_t rxDroppedFillRingPackets
Definition: XdpDevice.h:154
uint64_t txCompletedPacketsPerSec
Definition: XdpDevice.h:168
uint64_t rxBytesPerSec
Definition: XdpDevice.h:146
uint64_t cqRingId
Definition: XdpDevice.h:178
uint64_t umemFreeFrames
Definition: XdpDevice.h:182
uint64_t rxBytes
Definition: XdpDevice.h:144
uint64_t txSentPackets
Definition: XdpDevice.h:158
uint64_t rxPollTimeout
Definition: XdpDevice.h:156
uint64_t txSentPacketsPerSec
Definition: XdpDevice.h:160