Agora
1.2.0
Agora project
|
Go to the documentation of this file.
7 #ifndef PACKETTXRX_DPDK_H_
8 #define PACKETTXRX_DPDK_H_
10 #if !defined(USE_DPDK)
11 static_assert(
false,
"Packet tx rx dpdk defined but DPDK is not enabled");
20 #if defined(USE_DPDK_MEMORY)
21 class DPDKRxPacket :
public RxPacket {
23 DPDKRxPacket() :
RxPacket() { mem_ =
nullptr; }
27 ~DPDKRxPacket() =
default;
28 inline bool Set(rte_mbuf* mem,
Packet* in_pkt) {
37 rte_pktmbuf_free(mem_);
38 this->
Set(
nullptr,
nullptr);
41 #endif // defined(USE_DPDK_MEMORY)
53 Table<char>& rx_buffer,
size_t packet_num_in_buffer,
60 bool CreateWorker(
size_t tid,
size_t interface_count,
size_t interface_offset,
61 size_t* rx_frame_start, std::vector<RxPacket>& rx_memory,
69 std::vector<std::vector<std::pair<uint16_t, uint16_t>>>
74 #if defined(USE_DPDK_MEMORY)
75 std::vector<std::vector<DPDKRxPacket>> rx_packets_dpdk_;
79 #endif // PACKETTXRX_DPDK_H_
Definition: packet_txrx.h:18
std::vector< std::vector< std::pair< uint16_t, uint16_t > > > worker_dev_queue_assignment_
Definition: packet_txrx_dpdk.h:70
std::condition_variable cond_
Definition: packet_txrx.h:90
byte
Definition: core.h:388
std::mutex mutex_
Owned by this class and shared with the workers.
Definition: packet_txrx.h:89
std::vector< std::unique_ptr< TxRxWorker > > worker_threads_
Definition: packet_txrx.h:76
Definition: concurrentqueue.h:630
TxRxTypes
Definition: packet_txrx.h:19
moodycamel::ProducerToken ** tx_producer_tokens_
Definition: packet_txrx.h:86
static std::vector< uint16_t > GetPortIDFromMacAddr(size_t port_num, const std::string &mac_addrs)
uint32_t bs_server_addr_
Definition: packet_txrx_dpdk.h:65
Implementation of PacketTxRxDpdk datapath functions for communicating with DPDK.
Common definations for PacketTxRx. Including datapath functions for communicating with simulators.
bool StopTxRx()
Definition: packet_txrx.cc:109
Config *const cfg_
Definition: packet_txrx.h:77
#define AGORA_LOG_ERROR(...)
Definition: logger.h:39
std::atomic< bool > proceed_
Definition: packet_txrx.h:91
txrx worker dpdk definition. This is the simulator declaration with dpdk enhancements
uint16_t DpdkPortOffset() const
Definition: config.h:314
rte_mempool * mbuf_pool_
Definition: packet_txrx_dpdk.h:66
virtual void GcPacket()
Definition: message.h:191
size_t NumberTotalWorkers() const
Definition: packet_txrx.h:67
for i
Definition: generate_data.m:107
std::string BsServerAddr() const
Definition: config.h:299
Definition: message.h:164
static rte_mempool * CreateMempool(size_t num_ports, size_t packet_length=kJumboFrameMaxSize)
size_t NumberTotalInterfaces() const
Definition: packet_txrx.h:68
Implementations of this class provide packet I/O for Agora.
Definition: packet_txrx.h:34
Implementations of this class provide packet I/O for Agora using dpdk accelerations.
Definition: packet_txrx_dpdk.h:46
moodycamel::ConcurrentQueue< EventData > * event_notify_q_
Definition: packet_txrx.h:80
static constexpr bool kUseDPDK
Definition: symbols.h:144
frame_start
Definition: parse_dl_file.m:6
static int NicInit(uint16_t port, struct rte_mempool *mbuf_pool, int thread_num, size_t pkt_len=kJumboFrameMaxSize)
moodycamel::ProducerToken ** notify_producer_tokens_
Definition: packet_txrx.h:84
#define AGORA_LOG_INFO(...)
Definition: logger.h:62
const std::string & DpdkMacAddrs() const
Definition: config.h:316
#define AGORA_LOG_FRAME(...)
Definition: logger.h:72
static void RtAssert(bool condition, const char *throw_str)
Definition: utils.h:104
OutputIterator copy(const RangeT &range, OutputIterator out)
Definition: ranges.h:26
std::string to_string() const
Definition: eth_common.h:64
const size_t core_offset_
Definition: packet_txrx.h:79
Definition: message.h:186
bool CreateWorker(size_t tid, size_t interface_count, size_t interface_offset, size_t *rx_frame_start, std::vector< RxPacket > &rx_memory, std::byte *const tx_memory) final
Definition: packet_txrx_dpdk.cc:132
const size_t & InterfaceToWorker(size_t interface) const
Definition: packet_txrx.h:71
bool Set(Packet *in_pkt)
Definition: message.h:204
~PacketTxRxDpdk() final
Definition: packet_txrx_dpdk.cc:93
uint32_t bs_rru_addr_
Definition: packet_txrx_dpdk.h:64
Declaration file for the DpdkTransport class.
static void DpdkInit(uint16_t core_offset, size_t thread_num)
Init dpdk on core [core_offset:core_offset+thread_num].
uint16_t DpdkNumPorts() const
Definition: config.h:313
PacketTxRxDpdk(Config *const cfg, size_t core_offset, moodycamel::ConcurrentQueue< EventData > *event_notify_q, moodycamel::ConcurrentQueue< EventData > *tx_pending_q, moodycamel::ProducerToken **notify_producer_tokens, moodycamel::ProducerToken **tx_producer_tokens, Table< char > &rx_buffer, size_t packet_num_in_buffer, Table< size_t > &frame_start, char *tx_buffer)
Definition: packet_txrx_dpdk.cc:14
moodycamel::ConcurrentQueue< EventData > * tx_pending_q_
Definition: packet_txrx.h:81
std::string BsRruAddr() const
Definition: config.h:302
@ kBaseStation
Definition: packet_txrx.h:19
size_t NumChannels() const
Definition: packet_txrx.h:74