Agora  1.2.0
Agora project
txrx_worker_sim.h
Go to the documentation of this file.
1 
6 #ifndef TXRX_WORKER_SIM_H_
7 #define TXRX_WORKER_SIM_H_
8 
9 #include <memory>
10 #include <vector>
11 
12 #include "message.h"
13 #include "txrx_worker.h"
14 #include "udp_comm.h"
15 
16 class TxRxWorkerSim : public TxRxWorker {
17  public:
18  TxRxWorkerSim(size_t core_offset, size_t tid, size_t interface_count,
19  size_t interface_offset, Config* const config,
20  size_t* rx_frame_start,
23  moodycamel::ProducerToken& tx_producer,
24  moodycamel::ProducerToken& notify_producer,
25  std::vector<RxPacket>& rx_memory, std::byte* const tx_memory,
26  std::mutex& sync_mutex, std::condition_variable& sync_cond,
27  std::atomic<bool>& can_proceed);
28  TxRxWorkerSim() = delete;
29  ~TxRxWorkerSim() final;
30 
31  void DoTxRx() final;
32 
33  private:
34  size_t DequeueSend();
35  void SendBeacon(size_t frame_id);
36  std::vector<Packet*> RecvEnqueue(size_t interface_id);
37 
38  //1 for each responsible interface (ie radio)
39  //socket for incomming messages (received data)
40  std::vector<std::unique_ptr<UDPComm>> udp_comm_;
41  std::vector<std::byte> beacon_buffer_;
43 };
44 #endif // TXRX_WORKER_SIM_H_
kDebugMulticell
static constexpr bool kDebugMulticell
Definition: symbols.h:202
TxRxWorkerSim::beacon_buffer_
std::vector< std::byte > beacon_buffer_
Definition: txrx_worker_sim.h:41
fmt::v8::detail::byte
byte
Definition: core.h:388
udp_comm.h
Declaration file for the UDPComm class. This class is used to send messages and receive messages from...
FrameStats::GetDLSymbolIdx
size_t GetDLSymbolIdx(size_t symbol_number) const
Definition: framestats.cc:152
moodycamel::ProducerToken
Definition: concurrentqueue.h:630
Packet::frame_id_
uint32_t frame_id_
Definition: message.h:168
PinToCoreWithOffset
void PinToCoreWithOffset(ThreadType thread_type, size_t core_offset, size_t thread_id, bool allow_reuse, bool verbose)
Definition: utils.cc:157
kDebugPrintBeacon
static constexpr bool kDebugPrintBeacon
Definition: txrx_worker_sim.cc:16
fmt::v8::printf
auto printf(const S &fmt, const T &... args) -> int
Definition: printf.h:631
FrameStats::NumBeaconSyms
size_t NumBeaconSyms() const
Definition: framestats.cc:87
kSlowStartMulStage2
static constexpr size_t kSlowStartMulStage2
Definition: txrx_worker_sim.cc:21
TxRxWorker::rx_frame_start_
size_t *const rx_frame_start_
Definition: txrx_worker.h:59
gen_tag_t::symbol_id_
uint16_t symbol_id_
Definition: message.h:33
kFrameWnd
static constexpr size_t kFrameWnd
Definition: symbols.h:18
ThreadType::kWorkerTXRX
@ kWorkerTXRX
GetTime::GetTimeUs
static double GetTimeUs()
Definition: gettime.h:14
Config::BsAntNum
size_t BsAntNum() const
Definition: config.h:35
Packet::ant_id_
uint32_t ant_id_
Definition: message.h:171
EventType::kPacketTX
@ kPacketTX
TxRxWorker::GetTxPacket
Packet * GetTxPacket(size_t frame, size_t symbol, size_t ant)
Definition: txrx_worker.cc:160
TxRxWorker::Running
bool Running() const
Definition: txrx_worker.h:42
AGORA_LOG_ERROR
#define AGORA_LOG_ERROR(...)
Definition: logger.h:39
Config::Frame
const FrameStats & Frame() const
Definition: config.h:340
AGORA_LOG_TRACE
#define AGORA_LOG_TRACE(...)
Definition: logger.h:92
rx_tag_t
Definition: message.h:227
TxRxWorker::WaitSync
void WaitSync()
Using a latch might be better but adds c++20 requirement.
Definition: txrx_worker.cc:64
TxRxWorker::ReturnRxPacket
void ReturnRxPacket(RxPacket &unused_packet)
Definition: txrx_worker.cc:129
gen_tag_t
Definition: message.h:22
kDebugPrintInTask
static constexpr bool kDebugPrintInTask
Definition: symbols.h:201
txrx_worker_sim.h
txrx worker thread definition. This is the simulator declaration
kDebugDownlink
static constexpr bool kDebugDownlink
Definition: symbols.h:180
TxRxWorker::GetPendingTxEvents
std::vector< EventData > GetPendingTxEvents(size_t max_events=0)
Definition: txrx_worker.cc:85
EventData
Definition: message.h:142
kEnableSlowStart
static constexpr bool kEnableSlowStart
Definition: txrx_worker_sim.cc:15
Config::BsRruPort
int BsRruPort() const
Definition: config.h:305
Packet::cell_id_
uint32_t cell_id_
Definition: message.h:170
gen_tag_t::ant_id_
uint16_t ant_id_
Definition: message.h:38
message.h
Self defined functions for message storage and passing.
Config::BsServerPort
int BsServerPort() const
Definition: config.h:304
u
Plot Rx waveform for u
Definition: inspect_single_frame.m:108
GetTime::Rdtsc
static size_t Rdtsc()
Return the TSC.
Definition: gettime.h:25
Config::BsServerAddr
std::string BsServerAddr() const
Definition: config.h:299
kSlowStartMulStage1
static constexpr size_t kSlowStartMulStage1
Definition: txrx_worker_sim.cc:20
TxRxWorkerSim::TxRxWorkerSim
TxRxWorkerSim()=delete
TxRxWorkerSim::beacon_send_time_
double beacon_send_time_
Definition: txrx_worker_sim.h:42
Packet
Definition: message.h:164
TxRxWorker::Configuration
Config * Configuration()
Definition: txrx_worker.h:46
EventType::kPacketRX
@ kPacketRX
Config::GetFrameDurationSec
double GetFrameDurationSec() const
Return the frame duration in seconds.
Definition: config.h:464
Packet::symbol_id_
uint32_t symbol_id_
Definition: message.h:169
gen_tag_t::tag_
size_t tag_
Definition: message.h:43
TxRxWorkerSim::~TxRxWorkerSim
~TxRxWorkerSim() final
kNumStatsFrames
static constexpr size_t kNumStatsFrames
Definition: symbols.h:300
TxRxWorker::NotifyComplete
bool NotifyComplete(const EventData &complete_event)
Definition: txrx_worker.cc:75
TxRxWorker
Definition: txrx_worker.h:18
kIsWorkerTimingEnabled
static constexpr bool kIsWorkerTimingEnabled
Definition: symbols.h:303
TxRxWorker::GetRxPacket
RxPacket & GetRxPacket()
Definition: txrx_worker.cc:104
RxPacket::RawPacket
Packet * RawPacket()
Definition: message.h:213
TxRxWorker::channels_per_interface_
const size_t channels_per_interface_
Definition: txrx_worker.h:58
moodycamel::ConcurrentQueue< EventData >
Config::CellId
const std::vector< size_t > & CellId() const
Definition: config.h:368
GetTime::MeasureRdtscFreq
static double MeasureRdtscFreq()
Definition: gettime.h:51
TxRxWorkerSim::SendBeacon
void SendBeacon(size_t frame_id)
Definition: txrx_worker_sim.cc:143
AGORA_LOG_SYMBOL
#define AGORA_LOG_SYMBOL(...)
Definition: logger.h:82
TxRxWorker::tid_
const size_t tid_
Definition: txrx_worker.h:54
Config
Definition: config.h:26
TxRxWorkerSim::RecvEnqueue
std::vector< Packet * > RecvEnqueue(size_t interface_id)
Definition: txrx_worker_sim.cc:174
AGORA_LOG_FRAME
#define AGORA_LOG_FRAME(...)
Definition: logger.h:72
TxRxWorkerSim::DequeueSend
size_t DequeueSend()
Definition: txrx_worker_sim.cc:224
RxPacket
Definition: message.h:186
TxRxWorkerSim
Definition: txrx_worker_sim.h:16
kSlowStartThresh2
static constexpr size_t kSlowStartThresh2
Definition: txrx_worker_sim.cc:19
Config::NumCells
size_t NumCells() const
Definition: config.h:94
kSocketRxBufferSize
static constexpr size_t kSocketRxBufferSize
Definition: txrx_worker_sim.cc:23
TxRxWorkerSim::DoTxRx
void DoTxRx() final
Definition: txrx_worker_sim.cc:61
TxRxWorker::interface_offset_
const size_t interface_offset_
Definition: txrx_worker.h:57
gettime.h
Config::PacketLength
size_t PacketLength() const
Definition: config.h:238
kSlowStartThresh1
static constexpr size_t kSlowStartThresh1
Definition: txrx_worker_sim.cc:18
TxRxWorker::num_interfaces_
const size_t num_interfaces_
Definition: txrx_worker.h:56
gen_tag_t::frame_id_
uint32_t frame_id_
Definition: message.h:32
FrameStats::GetBeaconSymbol
size_t GetBeaconSymbol(size_t location) const
Definition: framestats.cc:126
txrx_worker.h
txrx worker thread definition. This is the parent / interface
TxRxWorkerSim::udp_comm_
std::vector< std::unique_ptr< UDPComm > > udp_comm_
Definition: txrx_worker_sim.h:40
max
max(y1, y1_1)
TxRxWorker::core_offset_
const size_t core_offset_
Definition: txrx_worker.h:55
TxRxWorker::running_
bool running_
Definition: txrx_worker.h:60
Config::BsRruAddr
std::string BsRruAddr() const
Definition: config.h:302