Agora
1.2.0
Agora project
|
Go to the documentation of this file.
6 #ifndef DPDK_TRANSPORT_H_
7 #define DPDK_TRANSPORT_H_
9 #include <netinet/ether.h>
10 #include <rte_byteorder.h>
11 #include <rte_cycles.h>
12 #include <rte_debug.h>
13 #include <rte_distributor.h>
15 #include <rte_ethdev.h>
16 #include <rte_ether.h>
19 #include <rte_malloc.h>
20 #include <rte_pause.h>
21 #include <rte_prefetch.h>
33 static constexpr
size_t kNumMBufs = ((64 * 1024) - 1);
49 sizeof(rte_ether_hdr) +
sizeof(rte_ipv4_hdr) +
sizeof(rte_udp_hdr);
57 size_t port_num,
const std::string& mac_addrs);
59 static int NicInit(uint16_t port,
struct rte_mempool* mbuf_pool,
70 static void FastMemcpy(
void* pvDest,
void* pvSrc,
size_t nBytes);
76 static std::string
PktToString(
const rte_mbuf* pkt);
80 static rte_mbuf*
AllocUdp(rte_mempool* mbuf_pool, rte_ether_addr src_mac_addr,
81 rte_ether_addr dst_mac_addr, uint32_t src_ip_addr,
82 uint32_t dst_ip_addr, uint16_t src_udp_port,
83 uint16_t dst_udp_port,
size_t buffer_length,
87 static void DpdkInit(uint16_t core_offset,
size_t thread_num);
92 #endif // DPDK_TRANSPORT_H_
static void InstallFlowRule(uint16_t port_id, uint16_t rx_q, uint32_t src_ip, uint32_t dest_ip, uint16_t src_port, uint16_t dst_port)
class RadioSocket __attribute__
static constexpr size_t kMBufCacheSize
Definition: dpdk_transport.h:34
auto printf(const S &fmt, const T &... args) -> int
Definition: printf.h:631
static rte_mbuf * AllocUdp(rte_mempool *mbuf_pool, rte_ether_addr src_mac_addr, rte_ether_addr dst_mac_addr, uint32_t src_ip_addr, uint32_t dst_ip_addr, uint16_t src_udp_port, uint16_t dst_udp_port, size_t buffer_length, uint16_t pkt_id)
uint16_t src_port
Definition: eth_common.h:60
static std::vector< uint16_t > GetPortIDFromMacAddr(size_t port_num, const std::string &mac_addrs)
@ error
Definition: format-inl.h:643
uint32_t src_ip
Definition: eth_common.h:70
uint16_t dst_port
Definition: eth_common.h:61
#define AGORA_LOG_TRACE(...)
Definition: logger.h:92
static std::string frame_header_to_string(const uint8_t *buf)
Definition: eth_common.h:150
static void PrintPkt(rte_be32_t src_ip, rte_be32_t dst_ip, rte_be16_t src_port, rte_be16_t dst_port, size_t len, size_t tid)
Definition: dpdk_transport.h:51
Self defined functions for message storage and passing.
static void InstallFlowRuleDropAll(uint16_t port_id)
static constexpr size_t kNumMBufs
Definition: dpdk_transport.h:33
uint16_t len
Definition: eth_common.h:62
for i
Definition: generate_data.m:107
static void FastMemcpy(void *pvDest, void *pvSrc, size_t nBytes)
Plot Rx waveform for u
Definition: inspect_single_frame.m:108
Definition: message.h:164
Common definitons for Ethernet-based transports.
static rte_mempool * CreateMempool(size_t num_ports, size_t packet_length=kJumboFrameMaxSize)
static constexpr size_t kTxRingSize
Definition: dpdk_transport.h:32
static constexpr size_t kInetHdrsTotSize
Definition: eth_common.h:144
static constexpr size_t kRxRingSize
Definition: dpdk_transport.h:31
static int NicInit(uint16_t port, struct rte_mempool *mbuf_pool, int thread_num, size_t pkt_len=kJumboFrameMaxSize)
size_t GetPhysicalCoreId(size_t core_id)
Definition: utils.cc:128
#define AGORA_LOG_INFO(...)
Definition: logger.h:62
static constexpr size_t kMacAddrBtyes
Definition: dpdk_transport.h:35
static std::list< CoreInfo > core_list
Definition: utils.cc:49
static void RtAssert(bool condition, const char *throw_str)
Definition: utils.h:104
#define AGORA_LOG_WARN(...)
Definition: logger.h:53
static std::string PktToString(const rte_mbuf *pkt)
Return a string representation of this packet.
std::string to_string() const
Definition: eth_common.h:64
static constexpr size_t kPayloadOffset
Offset to the payload starting from the beginning of the UDP frame.
Definition: dpdk_transport.h:48
static constexpr size_t kRxBatchSize
Maximum number of packets received in rx_burst.
Definition: dpdk_transport.h:40
static constexpr size_t kTxBatchSize
Definition: dpdk_transport.h:41
Utility functions for file and text processing.
Declaration file for the DpdkTransport class.
static constexpr size_t kJumboFrameMaxSize
Definition: dpdk_transport.h:38
static void DpdkInit(uint16_t core_offset, size_t thread_num)
Init dpdk on core [core_offset:core_offset+thread_num].
uint32_t dst_ip
Definition: eth_common.h:71
std::string ToString() const
Definition: message.h:177