Agora  1.2.0
Agora project
PacketTxRx Class Referenceabstract

Implementations of this class provide packet I/O for Agora. More...

#include <packet_txrx.h>

Inheritance diagram for PacketTxRx:
Collaboration diagram for PacketTxRx:

Public Member Functions

 PacketTxRx (AgoraTxRx::TxRxTypes type, 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)
 
virtual ~PacketTxRx ()
 
virtual bool StartTxRx (Table< complex_float > &calib_dl_buffer, Table< complex_float > &calib_ul_buffer)
 Start the network I/O threads. More...
 
size_t AntNumToWorkerId (size_t ant_num) const
 Convert the antenna id to txrx worker id. More...
 

Protected Member Functions

bool StopTxRx ()
 
void NotifyWorkers ()
 
size_t NumberTotalWorkers () const
 
size_t NumberTotalInterfaces () const
 
const size_t & InterfaceToWorker (size_t interface) const
 
size_t NumChannels () const
 

Protected Attributes

std::vector< std::unique_ptr< TxRxWorker > > worker_threads_
 
Config *const cfg_
 
const 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_
 
std::mutex mutex_
 Owned by this class and shared with the workers. More...
 
std::condition_variable cond_
 
std::atomic< bool > proceed_
 

Private Member Functions

virtual 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)=0
 

Private Attributes

std::vector< std::vector< RxPacket > > rx_packets_
 
std::byte *const tx_memory_
 
Table< size_t > & frame_start_
 
size_t worker_thread_count_
 
std::vector< size_t > interface_to_worker_
 
const AgoraTxRx::TxRxTypes type_
 
size_t num_channels_
 

Detailed Description

Implementations of this class provide packet I/O for Agora.

In the vanilla mode, this class provides socket or DPDK-based packet I/O to Agora (running on the base station server or client) for communicating with simulated peers.

In the "Argos" mode, this class provides SoapySDR-based communication for Agora (running on the base station server or client) for communicating with real wireless hardware peers (antenna hubs for the server, UE devices for the client).

Constructor & Destructor Documentation

◆ PacketTxRx()

PacketTxRx::PacketTxRx ( AgoraTxRx::TxRxTypes  type,
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 
)

Will make (packet_num_in_buffer % total_radios) unused buffers

Make sure all antennas on an interface is assigned to the same worker

For each requested worker, start assigning interfaces / buffers

Front load the workers

Worker <-> Interface assignment logic

  • Front load the workers with the target number of interfaces

Distribute the buffers per interface

If last interface has been assigned, exit assignment.

The +1 is for worker_index to worker count conversion

Here is the call graph for this function:

◆ ~PacketTxRx()

PacketTxRx::~PacketTxRx ( )
virtual
Here is the call graph for this function:

Member Function Documentation

◆ AntNumToWorkerId()

size_t PacketTxRx::AntNumToWorkerId ( size_t  ant_num) const

Convert the antenna id to txrx worker id.

Parameters
ant_numantenna number
Returns
The worker id

◆ CreateWorker()

virtual bool PacketTxRx::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 
)
privatepure virtual

Implemented in PacketTxRxDpdk, PacketTxRxRadio, PacketTxRxClientRadio, PacketTxRxClientSim, and PacketTxRxSim.

Here is the caller graph for this function:

◆ InterfaceToWorker()

const size_t& PacketTxRx::InterfaceToWorker ( size_t  interface) const
inlineprotected
Here is the caller graph for this function:

◆ NotifyWorkers()

void PacketTxRx::NotifyWorkers ( )
protected
Here is the caller graph for this function:

◆ NumberTotalInterfaces()

size_t PacketTxRx::NumberTotalInterfaces ( ) const
inlineprotected
Here is the caller graph for this function:

◆ NumberTotalWorkers()

size_t PacketTxRx::NumberTotalWorkers ( ) const
inlineprotected
Here is the caller graph for this function:

◆ NumChannels()

size_t PacketTxRx::NumChannels ( ) const
inlineprotected
Here is the caller graph for this function:

◆ StartTxRx()

bool PacketTxRx::StartTxRx ( Table< complex_float > &  calib_dl_buffer,
Table< complex_float > &  calib_ul_buffer 
)
virtual

Start the network I/O threads.

Returns
True on successfully starting the network I/O threads, false otherwise

Can exit here because this list is ordered

Reimplemented in PacketTxRxRadio, and PacketTxRxClientRadio.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ StopTxRx()

bool PacketTxRx::StopTxRx ( )
protected
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ cfg_

Config* const PacketTxRx::cfg_
protected

◆ cond_

std::condition_variable PacketTxRx::cond_
protected

◆ core_offset_

const size_t PacketTxRx::core_offset_
protected

◆ event_notify_q_

moodycamel::ConcurrentQueue<EventData>* PacketTxRx::event_notify_q_
protected

◆ frame_start_

Table<size_t>& PacketTxRx::frame_start_
private

◆ interface_to_worker_

std::vector<size_t> PacketTxRx::interface_to_worker_
private

◆ mutex_

std::mutex PacketTxRx::mutex_
protected

Owned by this class and shared with the workers.

◆ notify_producer_tokens_

moodycamel::ProducerToken** PacketTxRx::notify_producer_tokens_
protected

◆ num_channels_

size_t PacketTxRx::num_channels_
private

◆ proceed_

std::atomic<bool> PacketTxRx::proceed_
protected

◆ rx_packets_

std::vector<std::vector<RxPacket> > PacketTxRx::rx_packets_
private

◆ tx_memory_

std::byte* const PacketTxRx::tx_memory_
private

◆ tx_pending_q_

moodycamel::ConcurrentQueue<EventData>* PacketTxRx::tx_pending_q_
protected

◆ tx_producer_tokens_

moodycamel::ProducerToken** PacketTxRx::tx_producer_tokens_
protected

◆ type_

const AgoraTxRx::TxRxTypes PacketTxRx::type_
private

◆ worker_thread_count_

size_t PacketTxRx::worker_thread_count_
private

◆ worker_threads_

std::vector<std::unique_ptr<TxRxWorker> > PacketTxRx::worker_threads_
protected

The documentation for this class was generated from the following files: