Agora
1.2.0
Agora project
|
Go to the documentation of this file.
10 #include <netinet/ether.h>
11 #include <sys/types.h>
21 #include "common_typedef_sdk.h"
58 Sender(
Config* cfg,
size_t socket_thread_num,
size_t core_offset = 30,
60 size_t enable_slow_start = 1,
61 const std::string& server_mac_addr_str =
"ff:ff:ff:ff:ff:ff",
62 bool create_thread_for_master =
false);
93 void DelayForFrame(
size_t tx_frame_count, uint64_t tick_start);
103 DFTI_DESCRIPTOR_HANDLE mkl_handle)
const;
148 #if defined(USE_DPDK)
149 std::vector<uint16_t> port_ids_;
150 struct rte_mempool* mbuf_pool_;
151 uint32_t bs_rru_addr_;
152 uint32_t bs_server_addr_;
154 std::vector<rte_ether_addr> sender_mac_addr_;
156 std::vector<rte_ether_addr> server_mac_addr_;
size_t NumPilotSyms() const
Definition: framestats.cc:91
byte
Definition: core.h:388
const size_t core_offset_
Definition: sender.h:113
uint64_t GetTicksForFrame(size_t frame_id) const
Definition: sender.cc:539
Definition: concurrentqueue.h:630
Table< short > iq_data_short_
Definition: sender.h:138
uint64_t ticks_wnd2_
Definition: sender.h:124
void DelayForFrame(size_t tx_frame_count, uint64_t tick_start)
for ant_num
Definition: parse_all_dl.m:12
uint32_t frame_id_
Definition: message.h:168
const uint64_t ticks_inter_frame_
Definition: sender.h:128
void Calloc(size_t dim1, size_t dim2, Agora_memory::Alignment_t alignment)
Definition: memory_manage.h:45
Definition: test_transpose.cc:22
static constexpr bool kDebugSenderReceiver
Definition: symbols.h:354
void PinToCoreWithOffset(ThreadType thread_type, size_t core_offset, size_t thread_id, bool allow_reuse, bool verbose)
Definition: utils.cc:157
moodycamel::ProducerToken ** task_ptok_
Definition: sender.h:134
size_t SampsPerSymbol() const
Definition: config.h:234
moodycamel::ConcurrentQueue< size_t > send_queue_
Definition: sender.h:130
auto printf(const S &fmt, const T &... args) -> int
Definition: printf.h:631
double Rate() const
Definition: config.h:58
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)
Declaration file for the sender class.
size_t NumChannels() const
Definition: config.h:98
void RunFft(Packet *pkt, complex_float *fft_inout, DFTI_DESCRIPTOR_HANDLE mkl_handle) const
Definition: sender.cc:609
static constexpr bool kUse12BitIQ
Definition: symbols.h:178
size_t try_dequeue_bulk_from_producer(producer_token_t const &producer, It itemFirst, size_t max)
Definition: concurrentqueue.h:1292
static std::vector< uint16_t > GetPortIDFromMacAddr(size_t port_num, const std::string &mac_addrs)
moodycamel::ConcurrentQueue< size_t > completion_queue_
Definition: sender.h:132
uint16_t symbol_id_
Definition: message.h:33
size_t CpLen() const
Definition: config.h:46
size_t FindNextSymbol(size_t start_symbol)
Definition: sender.cc:195
static constexpr size_t kFrameWnd
Definition: symbols.h:18
#define unused(x)
Definition: utils.h:14
void * WorkerThread(int tid)
Definition: sender.cc:333
void * PaddedAlignedAlloc(Alignment_t alignment, size_t size)
Definition: memory_manage.cc:15
short data_[]
Definition: message.h:173
static double GetTimeUs()
Definition: gettime.h:14
void StartTx()
Definition: sender.cc:176
const size_t socket_thread_num_
Definition: sender.h:108
std::vector< std::thread > threads_
Definition: sender.h:146
size_t BsAntNum() const
Definition: config.h:35
uint32_t ant_id_
Definition: message.h:171
#define AGORA_LOG_ERROR(...)
Definition: logger.h:39
#define TOSTRING(x)
Definition: symbols.h:14
const FrameStats & Frame() const
Definition: config.h:340
static double CyclesToUs(size_t cycles, double freq_ghz)
Definition: gettime.h:97
#define AGORA_LOG_TRACE(...)
Definition: logger.h:92
void StartTxfromMain(double *in_frame_start, double *in_frame_end)
Definition: sender.cc:188
void DelayForSymbol(size_t tx_frame_count, uint64_t tick_start)
const size_t inter_frame_delay_
Definition: sender.h:115
void DelayTicks(uint64_t start, uint64_t ticks)
Definition: sender.cc:33
const size_t enable_slow_start_
Definition: sender.h:109
Sender(Config *cfg, size_t socket_thread_num, size_t core_offset=30, size_t frame_duration=1000, size_t inter_frame_delay=0, size_t enable_slow_start=1, const std::string &server_mac_addr_str="ff:ff:ff:ff:ff:ff", bool create_thread_for_master=false)
Create and optionally start a Sender that sends IQ packets to a server with MAC address [server_mac_a...
Definition: sender.cc:39
filename
Definition: parse_all_dl.m:14
static void SimdConvertShortToFloat(const short *in_buf, float *out_buf, size_t n_elems)
Definition: datatype_conversion.h:126
bool FftInRru() const
Definition: config.h:311
uint16_t DpdkPortOffset() const
Definition: config.h:314
~Sender()
Definition: sender.cc:154
int BsRruPort() const
Definition: config.h:305
void InitIqFromFile(const std::string &filename)
Read time-domain 32-bit floating-point IQ samples from [filename] and populate iq_data_short_ by conv...
Definition: sender.cc:551
uint32_t cell_id_
Definition: message.h:170
Self defined functions for message storage and passing.
void Free()
Definition: memory_manage.h:84
#define unlikely(x)
Definition: utils.h:16
int BsServerPort() const
Definition: config.h:304
static gen_tag_t FrmSymAnt(size_t frame_id, size_t symbol_id, size_t ant_id)
Definition: message.h:106
void WriteStatsToFile(size_t tx_frame_count) const
Definition: sender.cc:596
static std::atomic< bool > keep_running
Definition: sender.cc:24
for i
Definition: generate_data.m:107
size_t OfdmCaNum() const
Definition: config.h:45
static constexpr size_t kOffsetOfData
Definition: message.h:166
bool enqueue(T const &item)
Definition: concurrentqueue.h:974
Plot Rx waveform for u
Definition: inspect_single_frame.m:108
static size_t Rdtsc()
Return the TSC.
Definition: gettime.h:25
auto fprintf(std::FILE *f, const S &fmt, const T &... args) -> int
Definition: printf.h:607
static constexpr size_t kDequeueBulkSize
Definition: sender.h:38
std::string BsServerAddr() const
Definition: config.h:299
const double ticks_per_usec_
Definition: sender.h:107
Definition: message.h:164
uint32_t symbol_id_
Definition: message.h:169
static void SimdConvertFloat32ToFloat16(float *out_buf, const float *in_buf, size_t n_elems)
Definition: datatype_conversion.h:576
size_t tag_
Definition: message.h:43
end start
Definition: inspect_agora_results.m:95
size_t FramesToTest() const
Definition: config.h:309
static constexpr size_t kNumStatsFrames
Definition: symbols.h:300
static constexpr bool kDebugPrintSender
Definition: sender.cc:22
static rte_mempool * CreateMempool(size_t num_ports, size_t packet_length=kJumboFrameMaxSize)
bool enqueue_bulk(It itemFirst, size_t count)
Definition: concurrentqueue.h:1016
void ScheduleSymbol(size_t frame, size_t symbol_id)
Definition: sender.cc:208
uint64_t ticks_all_
Definition: sender.h:119
SymbolType GetSymbolType(size_t symbol_id) const
Return the symbol type of this symbol in this frame.
Definition: config.cc:1557
double * frame_start_
Definition: sender.h:143
static double MeasureRdtscFreq()
Definition: gettime.h:51
size_t NumULSyms() const
Definition: framestats.cc:85
static int NicInit(uint16_t port, struct rte_mempool *mbuf_pool, int thread_num, size_t pkt_len=kJumboFrameMaxSize)
static constexpr size_t kMacAddrBtyes
Definition: dpdk_transport.h:35
#define AGORA_LOG_INFO(...)
Definition: logger.h:62
Config * cfg_
Definition: sender.h:105
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
static std::atomic< size_t > num_workers_ready_atomic
Definition: sender.cc:26
std::string to_string() const
Definition: eth_common.h:64
static void SimdConvertFloatToShort(const float *in_buf, short *out_buf, size_t n_elems, size_t n_prefix=0, float scale_down_factor=1.0f)
Definition: datatype_conversion.h:266
void CreateWorkerThreads(size_t num_workers)
Definition: sender.cc:590
size_t NumCells() const
Definition: config.h:94
Declaration file for the configuration class which importants json configuration values into class va...
SymbolType
Definition: symbols.h:261
static constexpr size_t kPayloadOffset
Offset to the payload starting from the beginning of the UDP frame.
Definition: dpdk_transport.h:48
double * frame_end_
Definition: sender.h:144
bool try_dequeue(U &item)
Definition: concurrentqueue.h:1104
static void ConvertFloatTo12bitIq(const float *in_buf, uint8_t *out_buf, size_t n_elems)
Definition: datatype_conversion.h:298
size_t PacketLength() const
Definition: config.h:238
Declaration file for the DpdkTransport class.
size_t frame_duration_
Definition: sender.h:114
uint32_t frame_id_
Definition: message.h:32
size_t NumRadios() const
Definition: config.h:95
void * MasterThread(int tid)
Definition: sender.cc:224
const double freq_ghz_
Definition: sender.h:106
frame_duration
Definition: parse_dl_file.m:27
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
static constexpr bool kDebugPrintPerFrameDone
Definition: symbols.h:196
size_t * packet_count_per_symbol_[kFrameWnd]
Definition: sender.h:141
size_t GetMaxSymbolId() const
std::string BsRruAddr() const
Definition: config.h:302
size_t NumTotalSyms() const
Definition: framestats.cc:93
uint64_t ticks_wnd1_
Definition: sender.h:123
void InterruptHandler(int)
Definition: sender.cc:28