SRSENB/UE Fixed NR workers

master
Xavier Arteaga 4 years ago committed by Andre Puschmann
parent b501f2eeaf
commit f9643843a0

@ -24,6 +24,7 @@ extern "C" {
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
srslte_pdsch_args_t pdsch; srslte_pdsch_args_t pdsch;
uint32_t nof_tx_antennas; uint32_t nof_tx_antennas;
uint32_t nof_max_prb;
} srslte_enb_dl_nr_args_t; } srslte_enb_dl_nr_args_t;
typedef struct SRSLTE_API { typedef struct SRSLTE_API {

@ -440,6 +440,8 @@ static uint32_t srslte_dmrs_pdsch_seed(const srslte_carrier_nr_t* carrier,
const srslte_pdsch_dmrs_cfg_t* dmrs_cfg = const srslte_pdsch_dmrs_cfg_t* dmrs_cfg =
grant->mapping == srslte_pdsch_mapping_type_A ? &cfg->dmrs_cfg_typeA : &cfg->dmrs_cfg_typeB; grant->mapping == srslte_pdsch_mapping_type_A ? &cfg->dmrs_cfg_typeA : &cfg->dmrs_cfg_typeB;
slot_idx = slot_idx % SRSLTE_NSLOTS_PER_FRAME_NR(carrier->numerology);
// Calculate scrambling IDs // Calculate scrambling IDs
uint32_t n_id = carrier->id; uint32_t n_id = carrier->id;
uint32_t n_scid = (grant->n_scid) ? 1 : 0; uint32_t n_scid = (grant->n_scid) ? 1 : 0;

@ -50,14 +50,14 @@ int srslte_enb_dl_nr_init(srslte_enb_dl_nr_t* q, cf_t* output[SRSLTE_MAX_PORTS],
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
if (enb_dl_alloc_prb(q, SRSLTE_MAX_PRB_NR) < SRSLTE_SUCCESS) { if (enb_dl_alloc_prb(q, args->nof_max_prb) < SRSLTE_SUCCESS) {
ERROR("Error allocating\n"); ERROR("Error allocating\n");
return SRSLTE_ERROR; return SRSLTE_ERROR;
} }
srslte_ofdm_cfg_t fft_cfg = {}; srslte_ofdm_cfg_t fft_cfg = {};
fft_cfg.nof_prb = 100; fft_cfg.nof_prb = args->nof_max_prb;
fft_cfg.symbol_sz = srslte_symbol_sz(100); fft_cfg.symbol_sz = srslte_symbol_sz(args->nof_max_prb);
fft_cfg.keep_dc = true; fft_cfg.keep_dc = true;
for (uint32_t i = 0; i < q->nof_tx_antennas; i++) { for (uint32_t i = 0; i < q->nof_tx_antennas; i++) {

@ -648,7 +648,7 @@ static uint32_t srslte_pdsch_nr_grant_info(const srslte_pdsch_cfg_nr_t* cfg,
len = srslte_print_check(str, str_len, len, ",Nl=%d", grant->nof_layers); len = srslte_print_check(str, str_len, len, ",Nl=%d", grant->nof_layers);
// Append scrambling ID // Append scrambling ID
len = srslte_print_check(str, str_len, len, ",n_scid=%d", grant->n_scid); len = srslte_print_check(str, str_len, len, ",n_scid=%d,", grant->n_scid);
// Append TB info // Append TB info
for (uint32_t i = 0; i < SRSLTE_MAX_TB; i++) { for (uint32_t i = 0; i < SRSLTE_MAX_TB; i++) {

@ -28,6 +28,8 @@ static srslte_carrier_nr_t carrier = {
}; };
#define MAX_PRB 100
static uint32_t n_prb = 0; // Set to 0 for steering static uint32_t n_prb = 0; // Set to 0 for steering
static uint32_t mcs = 30; // Set to 30 for steering static uint32_t mcs = 30; // Set to 30 for steering
static srslte_pdsch_cfg_nr_t pdsch_cfg = {}; static srslte_pdsch_cfg_nr_t pdsch_cfg = {};
@ -86,7 +88,7 @@ int main(int argc, char** argv)
uint8_t* data_rx[SRSLTE_MAX_CODEWORDS] = {}; uint8_t* data_rx[SRSLTE_MAX_CODEWORDS] = {};
cf_t* buffer = NULL; cf_t* buffer = NULL;
buffer = srslte_vec_cf_malloc(SRSLTE_SF_LEN_PRB(carrier.nof_prb)); buffer = srslte_vec_cf_malloc(SRSLTE_SF_LEN_PRB(MAX_PRB));
if (buffer == NULL) { if (buffer == NULL) {
ERROR("Error malloc\n"); ERROR("Error malloc\n");
goto clean_exit; goto clean_exit;
@ -94,13 +96,14 @@ int main(int argc, char** argv)
srslte_ue_dl_nr_args_t ue_dl_args = {}; srslte_ue_dl_nr_args_t ue_dl_args = {};
ue_dl_args.nof_rx_antennas = 1; ue_dl_args.nof_rx_antennas = 1;
ue_dl_args.nof_max_prb = carrier.nof_prb; ue_dl_args.nof_max_prb = MAX_PRB;
ue_dl_args.pdsch.sch.disable_simd = true; ue_dl_args.pdsch.sch.disable_simd = true;
ue_dl_args.pdsch.measure_evm = true; ue_dl_args.pdsch.measure_evm = true;
ue_dl_args.pdsch.measure_time = true; ue_dl_args.pdsch.measure_time = true;
srslte_enb_dl_nr_args_t enb_dl_args = {}; srslte_enb_dl_nr_args_t enb_dl_args = {};
enb_dl_args.nof_tx_antennas = 1; enb_dl_args.nof_tx_antennas = 1;
enb_dl_args.nof_max_prb = MAX_PRB;
enb_dl_args.pdsch.sch.disable_simd = true; enb_dl_args.pdsch.sch.disable_simd = true;
// Set default PDSCH configuration // Set default PDSCH configuration

@ -32,7 +32,6 @@ namespace nr {
typedef struct { typedef struct {
uint32_t nof_carriers; uint32_t nof_carriers;
uint32_t max_prb;
srslte_enb_dl_nr_args_t dl; srslte_enb_dl_nr_args_t dl;
} phy_nr_args_t; } phy_nr_args_t;
@ -49,7 +48,7 @@ public:
phy_nr_state() phy_nr_state()
{ {
args.nof_carriers = 1; args.nof_carriers = 1;
args.max_prb = 100; args.dl.nof_max_prb = 100;
args.dl.nof_tx_antennas = 1; args.dl.nof_tx_antennas = 1;
args.dl.pdsch.measure_evm = true; args.dl.pdsch.measure_evm = true;
args.dl.pdsch.measure_time = true; args.dl.pdsch.measure_time = true;
@ -77,6 +76,7 @@ private:
uint32_t cc_idx = 0; uint32_t cc_idx = 0;
std::array<cf_t*, SRSLTE_MAX_PORTS> tx_buffer = {}; std::array<cf_t*, SRSLTE_MAX_PORTS> tx_buffer = {};
std::array<cf_t*, SRSLTE_MAX_PORTS> rx_buffer = {}; std::array<cf_t*, SRSLTE_MAX_PORTS> rx_buffer = {};
uint32_t buffer_sz = 0;
phy_nr_state* phy_state; phy_nr_state* phy_state;
srslte_enb_dl_nr_t enb_dl = {}; srslte_enb_dl_nr_t enb_dl = {};
srslte::log* log_h = nullptr; srslte::log* log_h = nullptr;

@ -20,6 +20,7 @@
*/ */
#include "srsenb/hdr/phy/nr/cc_worker.h" #include "srsenb/hdr/phy/nr/cc_worker.h"
#include "srslte/common/common.h"
#include "srslte/phy/enb/enb_dl_nr.h" #include "srslte/phy/enb/enb_dl_nr.h"
#include "srslte/phy/phch/ra_nr.h" #include "srslte/phy/phch/ra_nr.h"
#include "srslte/phy/ue/ue_dl_nr_data.h" #include "srslte/phy/ue/ue_dl_nr_data.h"
@ -32,10 +33,10 @@ cc_worker::cc_worker(uint32_t cc_idx_, srslte::log* log, phy_nr_state* phy_state
cf_t* buffer_c[SRSLTE_MAX_PORTS] = {}; cf_t* buffer_c[SRSLTE_MAX_PORTS] = {};
// Allocate buffers // Allocate buffers
uint32_t sf_len = SRSLTE_SF_LEN_PRB(phy_state->args.max_prb); buffer_sz = SRSLTE_SF_LEN_PRB(phy_state->args.dl.nof_max_prb);
for (uint32_t i = 0; i < phy_state_->args.dl.nof_tx_antennas; i++) { for (uint32_t i = 0; i < phy_state_->args.dl.nof_tx_antennas; i++) {
tx_buffer[i] = srslte_vec_cf_malloc(sf_len); tx_buffer[i] = srslte_vec_cf_malloc(buffer_sz);
rx_buffer[i] = srslte_vec_cf_malloc(sf_len); rx_buffer[i] = srslte_vec_cf_malloc(buffer_sz);
buffer_c[i] = tx_buffer[i]; buffer_c[i] = tx_buffer[i];
} }
@ -49,12 +50,9 @@ cc_worker::cc_worker(uint32_t cc_idx_, srslte::log* log, phy_nr_state* phy_state
ERROR("Error init soft-buffer\n"); ERROR("Error init soft-buffer\n");
return; return;
} }
data.resize(SRSLTE_SCH_NR_MAX_NOF_CB_LDPC * SRSLTE_LDPC_MAX_LEN_ENCODED_CB); data.resize(SRSLTE_SCH_NR_MAX_NOF_CB_LDPC * SRSLTE_LDPC_MAX_LEN_ENCODED_CB / 8);
srslte_random_t r = srslte_random_init(1234); srslte_vec_u8_zero(data.data(), SRSLTE_SCH_NR_MAX_NOF_CB_LDPC * SRSLTE_LDPC_MAX_LEN_ENCODED_CB / 8);
for (uint32_t i = 0; i < SRSLTE_SCH_NR_MAX_NOF_CB_LDPC * SRSLTE_LDPC_MAX_LEN_ENCODED_CB; i++) { snprintf((char*)data.data(), SRSLTE_SCH_NR_MAX_NOF_CB_LDPC * SRSLTE_LDPC_MAX_LEN_ENCODED_CB / 8, "hello world!");
data[i] = srslte_random_uniform_int_dist(r, 0, UINT8_MAX);
}
srslte_random_free(r);
} }
cc_worker::~cc_worker() cc_worker::~cc_worker()
@ -84,7 +82,7 @@ bool cc_worker::set_carrier(const srslte_carrier_nr_t* carrier)
void cc_worker::set_tti(uint32_t tti) void cc_worker::set_tti(uint32_t tti)
{ {
dl_slot_cfg.idx = tti; dl_slot_cfg.idx = TTI_ADD(tti, FDD_HARQ_DELAY_UL_MS);
} }
cf_t* cc_worker::get_tx_buffer(uint32_t antenna_idx) cf_t* cc_worker::get_tx_buffer(uint32_t antenna_idx)

@ -66,6 +66,7 @@ uint32_t sf_worker::get_buffer_len()
void sf_worker::set_tti(uint32_t tti) void sf_worker::set_tti(uint32_t tti)
{ {
log_h->step(tti);
for (auto& w : cc_workers) { for (auto& w : cc_workers) {
w->set_tti(tti); w->set_tti(tti);
} }

@ -127,8 +127,10 @@ void phy_common::worker_end(void* tx_sem_id, srslte::rf_buffer_t& buffer, srslte
nr_tx_buffer_ready = true; nr_tx_buffer_ready = true;
semaphore.release(); semaphore.release();
return; return;
} else if (nr_tx_buffer_ready) { }
// ... otherwise, append NR baseband from saved buffer if available
// ... otherwise, append NR base-band from saved buffer if available
if (nr_tx_buffer_ready) {
uint32_t j = 0; uint32_t j = 0;
for (uint32_t i = 0; i < SRSLTE_MAX_CHANNELS; i++) { for (uint32_t i = 0; i < SRSLTE_MAX_CHANNELS; i++) {
if (buffer.get(i) == nullptr) { if (buffer.get(i) == nullptr) {

@ -185,6 +185,7 @@ void txrx::run_thread()
// Launch NR worker only if available // Launch NR worker only if available
if (nr_worker != nullptr) { if (nr_worker != nullptr) {
nr_worker->set_tti(tti);
worker_com->semaphore.push(nr_worker); worker_com->semaphore.push(nr_worker);
nr_workers->start_worker(nr_worker); nr_workers->start_worker(nr_worker);
} }

@ -76,6 +76,7 @@ private:
uint32_t cc_idx = 0; uint32_t cc_idx = 0;
std::array<cf_t*, SRSLTE_MAX_PORTS> rx_buffer = {}; std::array<cf_t*, SRSLTE_MAX_PORTS> rx_buffer = {};
std::array<cf_t*, SRSLTE_MAX_PORTS> tx_buffer = {}; std::array<cf_t*, SRSLTE_MAX_PORTS> tx_buffer = {};
uint32_t buffer_sz = 0;
phy_nr_state* phy_state = nullptr; phy_nr_state* phy_state = nullptr;
srslte_ue_dl_nr_t ue_dl = {}; srslte_ue_dl_nr_t ue_dl = {};
srslte::log* log_h = nullptr; srslte::log* log_h = nullptr;

@ -426,7 +426,7 @@ static int parse_args(all_args_t* args, int argc, char* argv[])
("vnf.type", bpo::value<string>(&args->phy.vnf_args.type)->default_value("ue"), "VNF instance type [gnb,ue]") ("vnf.type", bpo::value<string>(&args->phy.vnf_args.type)->default_value("ue"), "VNF instance type [gnb,ue]")
("vnf.addr", bpo::value<string>(&args->phy.vnf_args.bind_addr)->default_value("localhost"), "Address to bind VNF interface") ("vnf.addr", bpo::value<string>(&args->phy.vnf_args.bind_addr)->default_value("localhost"), "Address to bind VNF interface")
("vnf.port", bpo::value<uint16_t>(&args->phy.vnf_args.bind_port)->default_value(3334), "Bind port") ("vnf.port", bpo::value<uint16_t>(&args->phy.vnf_args.bind_port)->default_value(3334), "Bind port")
("nr.nof_carriers", bpo::value<uint32_t>(&args->phy.nof_nr_carriers)->default_value(1), "Number of NR carriers") ("nr.nof_carriers", bpo::value<uint32_t>(&args->phy.nof_nr_carriers)->default_value(0), "Number of NR carriers")
("nr.nof_prb", bpo::value<uint32_t>(&args->phy.nr_nof_prb)->default_value(50), "NR carrier bandwidth") ("nr.nof_prb", bpo::value<uint32_t>(&args->phy.nr_nof_prb)->default_value(50), "NR carrier bandwidth")
("nr.freq", bpo::value<double>(&args->phy.nr_freq_hz)->default_value(2630e6), "NR carrier bandwidth") ("nr.freq", bpo::value<double>(&args->phy.nr_freq_hz)->default_value(2630e6), "NR carrier bandwidth")
; ;

@ -31,10 +31,10 @@ cc_worker::cc_worker(uint32_t cc_idx_, srslte::log* log, phy_nr_state* phy_state
cf_t* buffer_c[SRSLTE_MAX_PORTS] = {}; cf_t* buffer_c[SRSLTE_MAX_PORTS] = {};
// Allocate buffers // Allocate buffers
uint32_t sf_len = SRSLTE_SF_LEN_PRB(phy_state->args.dl.nof_max_prb); buffer_sz = SRSLTE_SF_LEN_PRB(phy_state->args.dl.nof_max_prb) * 5;
for (uint32_t i = 0; i < phy_state_->args.dl.nof_rx_antennas; i++) { for (uint32_t i = 0; i < phy_state_->args.dl.nof_rx_antennas; i++) {
rx_buffer[i] = srslte_vec_cf_malloc(sf_len); rx_buffer[i] = srslte_vec_cf_malloc(buffer_sz);
tx_buffer[i] = srslte_vec_cf_malloc(sf_len); tx_buffer[i] = srslte_vec_cf_malloc(buffer_sz);
buffer_c[i] = rx_buffer[i]; buffer_c[i] = rx_buffer[i];
} }
@ -93,7 +93,7 @@ cf_t* cc_worker::get_rx_buffer(uint32_t antenna_idx)
uint32_t cc_worker::get_buffer_len() uint32_t cc_worker::get_buffer_len()
{ {
return rx_buffer.size(); return buffer_sz;
} }
bool cc_worker::work_dl() bool cc_worker::work_dl()

@ -57,6 +57,7 @@ uint32_t sf_worker::get_buffer_len()
void sf_worker::set_tti(uint32_t tti) void sf_worker::set_tti(uint32_t tti)
{ {
log_h->step(tti);
for (auto& w : cc_workers) { for (auto& w : cc_workers) {
w->set_tti(tti); w->set_tti(tti);
} }

@ -65,7 +65,8 @@ void sync::init(srslte::radio_interface_phy* _radio,
worker_com = _worker_com; worker_com = _worker_com;
prach_buffer = _prach_buffer; prach_buffer = _prach_buffer;
nof_rf_channels = worker_com->args->nof_lte_carriers * worker_com->args->nof_rx_ant; nof_rf_channels =
(worker_com->args->nof_lte_carriers + worker_com->args->nof_nr_carriers) * worker_com->args->nof_rx_ant;
if (nof_rf_channels == 0 || nof_rf_channels > SRSLTE_MAX_CHANNELS) { if (nof_rf_channels == 0 || nof_rf_channels > SRSLTE_MAX_CHANNELS) {
Error("SYNC: Invalid number of RF channels (%d)\n", nof_rf_channels); Error("SYNC: Invalid number of RF channels (%d)\n", nof_rf_channels);
return; return;
@ -507,6 +508,7 @@ void sync::run_camping_in_sync_state(lte::sf_worker* lte_worker,
// Start NR worker only if present // Start NR worker only if present
if (nr_worker != nullptr) { if (nr_worker != nullptr) {
nr_worker->set_tti(tti);
nr_worker_pool->start_worker(nr_worker); nr_worker_pool->start_worker(nr_worker);
} }
} }

Loading…
Cancel
Save