23 #ifndef DPDK_NET_DEVICE_H
24 #define DPDK_NET_DEVICE_H
29 #include <rte_mempool.h>
30 #include <rte_cycles.h>
32 struct rte_eth_dev_tx_buffer;
81 void InitDpdk (
int argc,
char **argv, std::string dpdkDriver);
140 ssize_t
Write (uint8_t *buffer,
size_t length);
a NetDevice to read/write network traffic from/into a Dpdk enabled port.
static int LaunchCore(void *arg)
A function to handle rx & tx operations.
virtual void FreeBuffer(uint8_t *buf)
Free the given packet buffer.
uint32_t m_maxRxPktBurst
Size of Rx burst.
void InitDpdk(int argc, char **argv, std::string dpdkDriver)
Initialize Dpdk.
void SetDeviceName(std::string deviceName)
Set device name.
void HandleTx()
Transmit packets in burst from the tx_buffer to the nic.
static void SignalHandler(int signum)
A signal handler for SIGINT and SIGTERM signals.
~DpdkNetDevice()
Destructor for the DpdkNetDevice.
struct rte_eth_dev_tx_buffer * m_txBuffer
Buffer to handle burst transmission.
struct rte_eth_dev_tx_buffer * m_rxBuffer
Buffer to handle burst reception.
uint32_t m_maxTxPktBurst
Size of Tx burst.
EventId m_txEvent
Event for stale packet transmission.
std::string m_deviceName
The device name;.
static volatile bool m_forceQuit
Condition variable for Dpdk to stop.
void DoFinishStoppingDevice(void)
Complete additional actions, if any, to tear down the device.
uint16_t m_nbTxDesc
Number of Tx descriptors.
uint16_t m_nbRxDesc
Number of Rx descriptors.
bool IsLinkUp(void) const
Check the status of the link.
struct rte_mempool * m_mempool
Packet memory pool.
uint16_t m_portId
The port number of the device to be used.
virtual uint8_t * AllocateBuffer(size_t len)
Allocate packet buffer.
DpdkNetDevice()
Constructor for the DpdkNetDevice.
void HandleRx()
Receive packets in burst from the nic to the rx_buffer.
void CheckAllPortsLinkStatus(void)
Check the link status of all ports in up to 9s and print them finally.
Time m_txTimeout
The time to wait before transmitting burst from Tx buffer.
ssize_t Write(uint8_t *buffer, size_t length)
Write packet data to device.
static TypeId GetTypeId(void)
Get the type ID.
uint32_t m_mempoolCacheSize
Mempool cache size.
An identifier for simulation events.
a NetDevice to read/write network traffic from/into a file descriptor.
Simulation virtual time values and global simulation resolution.
a unique identifier for an interface.
Every class exported by the ns3 library is enclosed in the ns3 namespace.