Merge branch 'next'

master
Andre Puschmann 7 years ago
commit dfe430a584

@ -185,7 +185,8 @@ void parse_args(int argc, char **argv) {
cell.id = atoi(argv[optind]);
break;
case 'x':
strncpy(mimo_type_str, argv[optind], 32);
strncpy(mimo_type_str, argv[optind], 31);
mimo_type_str[31] = 0;
break;
case 'b':
multiplex_pmi = (uint32_t) atoi(argv[optind]);

@ -75,9 +75,11 @@ public:
void print_all_buffers()
{
printf("%d buffers in queue\n", (int) used.size());
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
for (uint32_t i=0;i<used.size();i++) {
printf("%s\n", strlen(used[i]->debug_name)?used[i]->debug_name:"Undefined");
}
#endif
}
bool is_almost_empty() {

@ -63,7 +63,7 @@
#define SRSLTE_MAX_BUFFER_SIZE_BYTES 12756
#define SRSLTE_BUFFER_HEADER_OFFSET 1024
#define SRSLTE_BUFFER_POOL_LOG_ENABLED
//#define SRSLTE_BUFFER_POOL_LOG_ENABLED
#ifdef SRSLTE_BUFFER_POOL_LOG_ENABLED
#define pool_allocate (pool->allocate(__FUNCTION__))

@ -110,7 +110,7 @@ typedef enum {SRSLTE_SF_NORM, SRSLTE_SF_MBSFN} srslte_sf_t;
#define SRSLTE_SF_LEN_MAX (SRSLTE_SF_LEN(SRSLTE_SYMBOL_SZ_MAX))
#define SRSLTE_SLOT_LEN_PRB(nof_prb) (SRSLTE_SLOT_LEN(srslte_symbol_sz(nof_prb)))
#define SRSLTE_SF_LEN_PRB(nof_prb) (nof_prb > 0 ? SRSLTE_SF_LEN(srslte_symbol_sz(nof_prb)) : 0)
#define SRSLTE_SF_LEN_PRB(nof_prb) (SRSLTE_SF_LEN(srslte_symbol_sz(nof_prb)))
#define SRSLTE_SLOT_LEN_RE(nof_prb, cp) (nof_prb*SRSLTE_NRE*SRSLTE_CP_NSYMB(cp))
#define SRSLTE_SF_LEN_RE(nof_prb, cp) (2*SRSLTE_SLOT_LEN_RE(nof_prb, cp))

@ -180,8 +180,8 @@ private:
int build_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_retx_t retx);
int build_data_pdu(uint8_t *payload, uint32_t nof_bytes);
void handle_data_pdu(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_header_t header);
void handle_data_pdu_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_header_t header);
void handle_data_pdu(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_header_t &header);
void handle_data_pdu_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_header_t &header);
void handle_control_pdu(uint8_t *payload, uint32_t nof_bytes);
void reassemble_rx_sdus();

@ -2243,9 +2243,9 @@ LIBLTE_ERROR_ENUM liblte_s1ap_pack_imsi(
if(ie != NULL &&
ptr != NULL)
{
// max length of IE buffer is 32, so limit
if (ie->n_octets > 31) {
printf("Length in struct exceeds buffer (%d > 31).\n", ie->n_octets);
// max length of IE buffer is 8, so limit
if (ie->n_octets > 7) {
printf("Length in struct exceeds buffer (%d > 7).\n", ie->n_octets);
return LIBLTE_ERROR_ENCODE_FAIL;
}

@ -90,6 +90,7 @@ uint32_t srslte_sch_find_Ioffset_cqi(float beta) {
int srslte_sch_init(srslte_sch_t *q) {
int ret = SRSLTE_ERROR_INVALID_INPUTS;
if (q) {
ret = SRSLTE_ERROR;
bzero(q, sizeof(srslte_sch_t));
if (srslte_crc_init(&q->crc_tb, SRSLTE_LTE_CRC24A, 24)) {
@ -754,6 +755,10 @@ int srslte_ulsch_uci_encode(srslte_sch_t *q,
uint32_t nb_q = cfg->nbits.nof_bits;
uint32_t Qm = cfg->grant.Qm;
if (Qm == 0) {
return SRSLTE_ERROR_INVALID_INPUTS;
}
if (uci_data.uci_ri_len > 0) {
float beta = beta_ri_offset[cfg->uci_cfg.I_offset_ri];
if (cfg->cb_segm.tbs == 0) {

@ -178,21 +178,10 @@ int main(int argc, char **argv) {
goto quit;
}
switch(mimo_type) {
case SRSLTE_MIMO_TYPE_SINGLE_ANTENNA:
cell.nof_ports = 1;
break;
case SRSLTE_MIMO_TYPE_SPATIAL_MULTIPLEX:
case SRSLTE_MIMO_TYPE_CDD:
if (nof_rx_antennas < 2) {
ERROR("At least two receiving antennas are required");
goto quit;
}
case SRSLTE_MIMO_TYPE_TX_DIVERSITY:
default:
cell.nof_ports = 2;
break;
if (mimo_type == SRSLTE_MIMO_TYPE_SINGLE_ANTENNA) {
cell.nof_ports = 1;
} else {
cell.nof_ports = 2;
}
srslte_ra_dl_dci_t dci;
@ -250,7 +239,7 @@ int main(int argc, char **argv) {
for (i=0;i<SRSLTE_MAX_PORTS;i++) {
for (j = 0; j < SRSLTE_MAX_PORTS; j++) {
ce[i][j] = srslte_vec_malloc(sizeof(cf_t) * NOF_CE_SYMBOLS);
if (!ce[i]) {
if (!ce[i][j]) {
perror("srslte_vec_malloc");
goto quit;
}

@ -176,8 +176,8 @@ int main(int argc, char **argv) {
srslte_rf_set_rx_freq(&rf, uhd_freq);
srslte_rf_set_tx_freq(&rf, uhd_freq);
if (srate > 1e6) {
if (30720%((int) srate/1000) == 0) {
if (srate > 1e6 && (srate/1000) > 0) {
if (30720%(srate/1000) == 0) {
srslte_rf_set_master_clock_rate(&rf, 30.72e6);
} else {
srslte_rf_set_master_clock_rate(&rf, 23.04e6);

@ -655,11 +655,19 @@ int srslte_uci_encode_ack(srslte_pusch_cfg_t *cfg, uint8_t acks[2], uint32_t nof
uint32_t nof_encoded_bits = encode_ri_ack(acks, nof_acks, q_encoded_bits, cfg->grant.Qm);
for (uint32_t i=0;i<Qprime;i++) {
uci_ulsch_interleave_ack_gen(i, cfg->grant.Qm, H_prime_total, cfg->nbits.nof_symb, cfg->cp, &ack_bits[cfg->grant.Qm*i]);
uci_ulsch_interleave_put(&q_encoded_bits[(i*cfg->grant.Qm)%nof_encoded_bits], cfg->grant.Qm, &ack_bits[cfg->grant.Qm*i]);
if (nof_encoded_bits > 0) {
for (uint32_t i = 0; i < Qprime; i++) {
uci_ulsch_interleave_ack_gen(i,
cfg->grant.Qm,
H_prime_total,
cfg->nbits.nof_symb,
cfg->cp,
&ack_bits[cfg->grant.Qm * i]);
uci_ulsch_interleave_put(&q_encoded_bits[(i * cfg->grant.Qm) % nof_encoded_bits],
cfg->grant.Qm,
&ack_bits[cfg->grant.Qm * i]);
}
}
return (int) Qprime;
}
@ -706,25 +714,27 @@ int srslte_uci_encode_ack_ri(srslte_pusch_cfg_t *cfg,
uint32_t nof_encoded_bits = encode_ri_ack(data, data_len, q_encoded_bits, cfg->grant.Qm);
for (uint32_t i = 0; i < Qprime; i++) {
if (ack_ri) {
uci_ulsch_interleave_ri_gen(i,
cfg->grant.Qm,
H_prime_total,
cfg->nbits.nof_symb,
cfg->cp,
&bits[cfg->grant.Qm * i]);
} else {
uci_ulsch_interleave_ack_gen(i,
cfg->grant.Qm,
H_prime_total,
cfg->nbits.nof_symb,
cfg->cp,
&bits[cfg->grant.Qm * i]);
if (nof_encoded_bits > 0) {
for (uint32_t i = 0; i < Qprime; i++) {
if (ack_ri) {
uci_ulsch_interleave_ri_gen(i,
cfg->grant.Qm,
H_prime_total,
cfg->nbits.nof_symb,
cfg->cp,
&bits[cfg->grant.Qm * i]);
} else {
uci_ulsch_interleave_ack_gen(i,
cfg->grant.Qm,
H_prime_total,
cfg->nbits.nof_symb,
cfg->cp,
&bits[cfg->grant.Qm * i]);
}
uci_ulsch_interleave_put(&q_encoded_bits[(i * cfg->grant.Qm) % nof_encoded_bits],
cfg->grant.Qm,
&bits[cfg->grant.Qm * i]);
}
uci_ulsch_interleave_put(&q_encoded_bits[(i * cfg->grant.Qm) % nof_encoded_bits],
cfg->grant.Qm,
&bits[cfg->grant.Qm * i]);
}
return (int) Qprime;

@ -59,7 +59,7 @@ void usage(char *prog) {
printf("Usage: %s [nlestodv] -i cell_id -f input_file_name\n", prog);
printf("\t-n nof_frames [Default %d]\n", nof_frames);
printf("\t-l N_id_2 to sync [Default use cell_id]\n");
printf("\t-e Extended CP [Default Normal]\n", fft_size);
printf("\t-e Extended CP [Default Normal]\n");
printf("\t-s symbol_sz [Default %d]\n", fft_size);
printf("\t-t threshold [Default %.2f]\n", threshold);
printf("\t-o file read offset [Default %d]\n", file_offset);
@ -266,7 +266,7 @@ int main(int argc, char **argv) {
}
} else {
INFO("No space for CFO computation. Frame starts at \n",peak_idx);
INFO("No space for CFO computation. Frame starts at \n");
}
if(srslte_sss_subframe(m0,m1) == 0)

@ -61,7 +61,7 @@ void usage(char *prog) {
printf("\t-g RF Gain [Default %.2f dB]\n", rf_gain);
printf("\t-n nof_frames [Default %d]\n", nof_frames);
printf("\t-l N_id_2 to sync [Default use cell_id]\n");
printf("\t-e Extended CP [Default Normal]\n", fft_size);
printf("\t-e Extended CP [Default Normal]\n");
printf("\t-s symbol_sz [Default %d]\n", fft_size);
printf("\t-t threshold [Default %.2f]\n", threshold);
#ifndef DISABLE_GRAPHICS
@ -291,7 +291,7 @@ int main(int argc, char **argv) {
}
} else {
INFO("No space for CFO computation. Frame starts at \n",peak_idx);
INFO("No space for CFO computation. Frame starts at \n");
}
if(srslte_sss_subframe(m0,m1) == 0)

@ -896,7 +896,7 @@ static int find_dl_dci_type_crnti(srslte_ue_dl_t *q, uint32_t tm, uint32_t cfi,
dci_blind_search_t *current_ss = &search_space;
if (cfi < 1 || cfi > 3) {
ERROR("CFI must be 1 ≤ cfi ≤ 3", cfi);
ERROR("CFI must be 1 ≤ cfi ≤ 3 (cfi=%d)", cfi);
return SRSLTE_ERROR;
}

@ -30,7 +30,14 @@
namespace srslte {
pdcp::pdcp()
{}
{
rlc = NULL;
rrc = NULL;
gw = NULL;
pdcp_log = NULL;
lcid = 0;
direction = 0;
}
void pdcp::init(srsue::rlc_interface_pdcp *rlc_, srsue::rrc_interface_pdcp *rrc_, srsue::gw_interface_pdcp *gw_, log *pdcp_log_, uint32_t lcid_, uint8_t direction_)
{

@ -35,6 +35,17 @@ pdcp_entity::pdcp_entity()
,tx_count(0)
{
pool = byte_buffer_pool::get_instance();
log = NULL;
rlc = NULL;
rrc = NULL;
gw = NULL;
lcid = 0;
sn_len_bytes = 0;
do_integrity = false;
do_encryption = false;
rx_count = 0;
cipher_algo = CIPHERING_ALGORITHM_ID_EEA0;
integ_algo = INTEGRITY_ALGORITHM_ID_EIA0;
}
void pdcp_entity::init(srsue::rlc_interface_pdcp *rlc_,

@ -35,6 +35,15 @@ namespace srslte {
rlc::rlc()
{
pool = byte_buffer_pool::get_instance();
rlc_log = NULL;
pdcp = NULL;
rrc = NULL;
mac_timers = NULL;
ue = NULL;
default_lcid = 0;
bzero(metrics_time, sizeof(metrics_time));
bzero(ul_tput_bytes, sizeof(ul_tput_bytes));
bzero(dl_tput_bytes, sizeof(dl_tput_bytes));
}
void rlc::init(srsue::pdcp_interface_rlc *pdcp_,
@ -233,13 +242,13 @@ void rlc::add_bearer(uint32_t lcid)
void rlc::add_bearer(uint32_t lcid, srslte_rlc_config_t cnfg)
{
if(lcid < 0 || lcid >= SRSLTE_N_RADIO_BEARERS) {
if(lcid >= SRSLTE_N_RADIO_BEARERS) {
rlc_log->error("Radio bearer id must be in [0:%d] - %d\n", SRSLTE_N_RADIO_BEARERS, lcid);
return;
}
if (!rlc_array[lcid].active()) {
rlc_log->info("Adding radio bearer %s with mode %s\n",
rlc_log->warning("Adding radio bearer %s with mode %s\n",
rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg.rlc_mode]);
switch(cnfg.rlc_mode)
{
@ -271,10 +280,9 @@ void rlc::add_bearer(uint32_t lcid, srslte_rlc_config_t cnfg)
*******************************************************************************/
bool rlc::valid_lcid(uint32_t lcid)
{
if(lcid < 0 || lcid >= SRSLTE_N_RADIO_BEARERS) {
if(lcid >= SRSLTE_N_RADIO_BEARERS) {
return false;
}
if(!rlc_array[lcid].active()) {
} else if(!rlc_array[lcid].active()) {
return false;
}
return true;

@ -38,6 +38,12 @@ namespace srslte {
rlc_am::rlc_am() : tx_sdu_queue(16)
{
log = NULL;
pdcp = NULL;
rrc = NULL;
lcid = 0;
bzero(&cfg, sizeof(srslte_rlc_am_config_t));
tx_sdu = NULL;
rx_sdu = NULL;
pool = byte_buffer_pool::get_instance();
@ -77,7 +83,7 @@ void rlc_am::init(srslte::log *log_,
void rlc_am::configure(srslte_rlc_config_t cfg_)
{
cfg = cfg_.am;
log->info("%s configured: t_poll_retx=%d, poll_pdu=%d, poll_byte=%d, max_retx_thresh=%d, "
log->warning("%s configured: t_poll_retx=%d, poll_pdu=%d, poll_byte=%d, max_retx_thresh=%d, "
"t_reordering=%d, t_status_prohibit=%d\n",
rrc->get_rb_name(lcid).c_str(), cfg.t_poll_retx, cfg.poll_pdu, cfg.poll_byte, cfg.max_retx_thresh,
cfg.t_reordering, cfg.t_status_prohibit);
@ -768,7 +774,7 @@ int rlc_am::build_data_pdu(uint8_t *payload, uint32_t nof_bytes)
return (ptr-payload) + pdu->N_bytes;
}
void rlc_am::handle_data_pdu(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_header_t header)
void rlc_am::handle_data_pdu(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_header_t &header)
{
std::map<uint32_t, rlc_amd_rx_pdu_t>::iterator it;
@ -806,7 +812,7 @@ void rlc_am::handle_data_pdu(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_h
memcpy(pdu.buf->msg, payload, nof_bytes);
pdu.buf->N_bytes = nof_bytes;
pdu.header = header;
memcpy(&pdu.header, &header, sizeof(rlc_amd_pdu_header_t));
rx_window[header.sn] = pdu;
@ -865,7 +871,7 @@ void rlc_am::handle_data_pdu(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_h
debug_state();
}
void rlc_am::handle_data_pdu_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_header_t header)
void rlc_am::handle_data_pdu_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_pdu_header_t &header)
{
std::map<uint32_t, rlc_amd_rx_pdu_segments_t>::iterator it;
@ -891,7 +897,7 @@ void rlc_am::handle_data_pdu_segment(uint8_t *payload, uint32_t nof_bytes, rlc_a
}
memcpy(segment.buf->msg, payload, nof_bytes);
segment.buf->N_bytes = nof_bytes;
segment.header = header;
memcpy(&segment.header, &header, sizeof(rlc_amd_pdu_header_t));
// Check if we already have a segment from the same PDU
it = rx_segments.find(header.sn);

@ -31,6 +31,10 @@ namespace srslte {
rlc_tm::rlc_tm() : ul_queue(16)
{
log = NULL;
pdcp = NULL;
rrc = NULL;
lcid = 0;
pool = byte_buffer_pool::get_instance();
}

@ -33,6 +33,14 @@ namespace srslte {
rlc_um::rlc_um() : tx_sdu_queue(16)
{
log = NULL;
pdcp = NULL;
rrc = NULL;
reordering_timer = NULL;
lcid = 0;
reordering_timer_id = 0;
bzero(&cfg, sizeof(srslte_rlc_um_config_t));
tx_sdu = NULL;
rx_sdu = NULL;
pool = byte_buffer_pool::get_instance();
@ -73,18 +81,18 @@ void rlc_um::configure(srslte_rlc_config_t cnfg_)
switch(cnfg_.rlc_mode)
{
case LIBLTE_RRC_RLC_MODE_UM_BI:
log->info("%s configured in %s mode: "
log->warning("%s configured in %s mode: "
"t_reordering=%d ms, rx_sn_field_length=%u bits, tx_sn_field_length=%u bits\n",
rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode],
cfg.t_reordering, rlc_umd_sn_size_num[cfg.rx_sn_field_length], rlc_umd_sn_size_num[cfg.rx_sn_field_length]);
break;
case LIBLTE_RRC_RLC_MODE_UM_UNI_UL:
log->info("%s configured in %s mode: tx_sn_field_length=%u bits\n",
log->warning("%s configured in %s mode: tx_sn_field_length=%u bits\n",
rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode],
rlc_umd_sn_size_num[cfg.rx_sn_field_length]);
break;
case LIBLTE_RRC_RLC_MODE_UM_UNI_DL:
log->info("%s configured in %s mode: "
log->warning("%s configured in %s mode: "
"t_reordering=%d ms, rx_sn_field_length=%u bits\n",
rrc->get_rb_name(lcid).c_str(), liblte_rrc_rlc_mode_text[cnfg_.rlc_mode],
cfg.t_reordering, rlc_umd_sn_size_num[cfg.rx_sn_field_length]);

@ -67,7 +67,7 @@ void write(std::string filename) {
bool read(std::string filename) {
bool pass = true;
bool written[NTHREADS][NMSGS];
int thread, msg;
int thread = 0, msg = 0;
int r;
for(int i=0;i<NTHREADS;i++) {
@ -78,7 +78,12 @@ bool read(std::string filename) {
FILE *f = fopen(filename.c_str(), "r");
if(f!=NULL) {
while(fscanf(f, "Thread %d: %d\n", &thread, &msg)) {
written[thread][msg] = true;
if (thread < NTHREADS && msg < NMSGS) {
written[thread][msg] = true;
} else {
perror("Wrong thread and/or msg");
return false;
}
}
fclose(f);
}
@ -95,7 +100,11 @@ int main(int argc, char **argv) {
std::string f("log.txt");
write(f);
result = read(f);
remove(f.c_str());
if (remove(f.c_str())) {
perror("Removing file");
}
if(result) {
printf("Passed\n");
exit(0);

@ -39,6 +39,7 @@ public:
finished = false;
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&cvar, NULL);
bzero(&start_time, sizeof(start_time));
}
void timeout_expired(uint32_t timeout_id)

@ -54,7 +54,10 @@ class rlc_am_tester
,public rrc_interface_rlc
{
public:
rlc_am_tester(){n_sdus = 0;}
rlc_am_tester(){
bzero(sdus, sizeof(sdus));
n_sdus = 0;
}
// PDCP interface
void write_pdu(uint32_t lcid, byte_buffer_t *sdu)

@ -57,7 +57,10 @@ class rlc_um_tester
,public rrc_interface_rlc
{
public:
rlc_um_tester(){n_sdus = 0;}
rlc_um_tester(){
bzero(sdus, sizeof(sdus));
n_sdus = 0;
}
// PDCP interface
void write_pdu(uint32_t lcid, byte_buffer_t *sdu)

@ -43,7 +43,14 @@ class ue : public srslte::read_pdu_interface,
{
public:
ue() : mac_msg_dl(20), mac_msg_ul(20), pdus(128) {
ue() : mac_msg_dl(20), mac_msg_ul(20), conres_id_available(false),
dl_ri_counter(0),
dl_pmi_counter(0),
conres_id(0),
last_tti(0),
pdus(128) {
rrc = NULL;
sched = NULL;
rlc = NULL;
log_h = NULL;
rnti = 0;
@ -55,6 +62,14 @@ public:
for (int i=0;i<NOF_HARQ_PROCESSES;i++) {
pending_buffers[i] = NULL;
}
bzero(&metrics, sizeof(mac_metrics_t));
bzero(&mutex, sizeof(pthread_mutex_t));
bzero(softbuffer_tx, sizeof(softbuffer_tx));
bzero(softbuffer_rx, sizeof(softbuffer_rx));
for (int i = 0; i < SRSLTE_MAX_TB; ++i) {
bzero(tx_payload_buffer, sizeof(uint8_t) * payload_buffer_len);
}
pthread_mutex_init(&mutex, NULL);
}

@ -57,6 +57,16 @@ public:
nof_mutex = 0;
max_mutex = max_mutex_;
params.max_prach_offset_us = 20;
radio = NULL;
mac = NULL;
is_first_tx = false;
is_first_of_burst = false;
pdsch_p_b = 0;
nof_workers = 0;
bzero(&pusch_cfg, sizeof(pusch_cfg));
bzero(&hopping_cfg, sizeof(hopping_cfg));
bzero(&pucch_cfg, sizeof(pucch_cfg));
bzero(&ul_grants, sizeof(ul_grants));
}
bool init(srslte_cell_t *cell, srslte::radio *radio_handler, mac_interface_phy *mac);

@ -103,7 +103,11 @@ private:
class ue {
public:
ue() : I_sr(0), I_sr_en(false), cqi_en(false), pucch_cqi_ack(false), pmi_idx(0), has_grant_tti(0),
dedicated_ack(false) {bzero(&metrics, sizeof(phy_metrics_t));}
dedicated_ack(false), ri_idx(0), ri_en(false), rnti(0) {
bzero(&dedicated, sizeof(LIBLTE_RRC_PHYSICAL_CONFIG_DEDICATED_STRUCT));
bzero(&phich_info, sizeof(srslte_enb_ul_phich_info_t));
bzero(&metrics, sizeof(phy_metrics_t));
}
uint32_t I_sr;
uint32_t pmi_idx;
uint32_t ri_idx;

@ -36,7 +36,20 @@ namespace srsenb {
class prach_worker : thread
{
public:
prach_worker() : initiated(false),max_prach_offset_us(0) {}
prach_worker() : initiated(false), prach_nof_det(0), max_prach_offset_us(0), pending_tti(0), processed_tti(0),
running(false), nof_sf(0), sf_cnt(0) {
log_h = NULL;
mac = NULL;
signal_buffer_rx = NULL;
bzero(&prach, sizeof(srslte_prach_t));
bzero(&prach_indices, sizeof(prach_indices));
bzero(&prach_offsets, sizeof(prach_offsets));
bzero(&prach_p2avg, sizeof(prach_p2avg));
bzero(&cell, sizeof(cell));
bzero(&prach_cfg, sizeof(prach_cfg));
bzero(&mutex, sizeof(mutex));
bzero(&cvar, sizeof(cvar));
}
int init(srslte_cell_t *cell, srslte_prach_cfg_t *prach_cfg, mac_interface_phy *mac, srslte::log *log_h, int priority);
int new_tti(uint32_t tti, cf_t *buffer);

@ -104,7 +104,27 @@ class rrc : public rrc_interface_pdcp,
{
public:
rrc() : act_monitor(this), cnotifier(NULL) {}
rrc() : act_monitor(this), cnotifier(NULL), running(false), nof_si_messages(0) {
users.clear();
pending_paging.clear();
pool = NULL;
phy = NULL;
mac = NULL;
rlc = NULL;
pdcp = NULL;
gtpu = NULL;
s1ap = NULL;
rrc_log = NULL;
bzero(&sr_sched, sizeof(sr_sched));
bzero(&cqi_sched, sizeof(cqi_sched));
bzero(&cfg, sizeof(cfg));
bzero(&sib2, sizeof(sib2));
bzero(&user_mutex, sizeof(user_mutex));
bzero(&paging_mutex, sizeof(paging_mutex));
}
void init(rrc_cfg_t *cfg,
phy_interface_rrc *phy,

@ -54,11 +54,14 @@ void enb::cleanup(void)
}
}
enb::enb()
:started(false)
{
enb::enb() : started(false) {
srslte_dft_load();
pool = srslte::byte_buffer_pool::get_instance();
logger = NULL;
args = NULL;
bzero(&rf_metrics, sizeof(rf_metrics));
}
enb::~enb()

@ -55,8 +55,8 @@ int enb::parse_cell_cfg(all_args_t *args, srslte_cell_t *cell) {
);
parser::parse_section(args->enb_files.rr_config, &phy_cnfg);
cell->phich_length = (srslte_phich_length_t) phichcfg.dur;
cell->phich_resources = (srslte_phich_resources_t) phichcfg.res;
cell->phich_length = (srslte_phich_length_t) (int) phichcfg.dur;
cell->phich_resources = (srslte_phich_resources_t) (int) phichcfg.res;
if (!srslte_cell_isvalid(cell)) {
fprintf(stderr, "Invalid cell parameters: nof_prb=%d, cell_id=%d\n", args->enb.n_prb, args->enb.s1ap.cell_id);
@ -845,7 +845,7 @@ int enb::parse_rr(all_args_t* args, rrc_cfg_t* rrc_cfg)
{
/* Transmission mode config section */
if (args->enb.transmission_mode < 0 || args->enb.transmission_mode > 4) {
if (args->enb.transmission_mode < 1 || args->enb.transmission_mode > 4) {
ERROR("Invalid transmission mode (%d). Only indexes 1-4 are implemented.\n", args->enb.transmission_mode);
return SRSLTE_ERROR;
} else if (args->enb.transmission_mode == 1 && args->enb.nof_ports > 1) {

@ -42,13 +42,26 @@
namespace srsenb {
mac::mac() : timers_db(128),
timers_thread(&timers_db),
rar_pdu_msg(sched_interface::MAX_RAR_LIST),
mac::mac() : timers_db(128), timers_thread(&timers_db), tti(0), last_rnti(0),
rar_pdu_msg(sched_interface::MAX_RAR_LIST), rar_payload(),
pdu_process_thread(this)
{
started = false;
pcap = NULL;
phy_h = NULL;
rlc_h = NULL;
rrc_h = NULL;
log_h = NULL;
bzero(&locations, sizeof(locations));
bzero(&cell, sizeof(cell));
bzero(&args, sizeof(args));
bzero(&pending_rars, sizeof(pending_rars));
bzero(&bcch_dlsch_payload, sizeof(bcch_dlsch_payload));
bzero(&pcch_payload_buffer, sizeof(pcch_payload_buffer));
bzero(&bcch_softbuffer_tx, sizeof(bcch_softbuffer_tx));
bzero(&pcch_softbuffer_tx, sizeof(pcch_softbuffer_tx));
bzero(&rar_softbuffer_tx, sizeof(rar_softbuffer_tx));
}
bool mac::init(mac_args_t *args_, srslte_cell_t *cell_, phy_interface_mac *phy, rlc_interface_mac *rlc, rrc_interface_mac *rrc, srslte::log *log_h_)
@ -722,8 +735,7 @@ void mac::timer_thread::tti_clock()
* DEMU unit
*
*******************************************************/
mac::pdu_process::pdu_process(pdu_process_handler *h)
{
mac::pdu_process::pdu_process(pdu_process_handler *h) : running(false) {
handler = h;
pthread_mutex_init(&mutex, NULL);
pthread_cond_init(&cvar, NULL);

@ -18,10 +18,26 @@ namespace srsenb {
* Initialization and sched configuration functions
*
*******************************************************/
sched::sched()
{
sched::sched() : bc_aggr_level(0), rar_aggr_level(0), avail_rbg(0), P(0), start_rbg(0), si_n_rbg(0), rar_n_rb(0),
nof_rbg(0), sf_idx(0), sfn(0), current_cfi(0) {
current_tti = 0;
log_h = NULL;
dl_metric = NULL;
ul_metric = NULL;
rrc = NULL;
bzero(&cfg, sizeof(cfg));
bzero(&regs, sizeof(regs));
bzero(&used_cce, sizeof(used_cce));
bzero(&sched_cfg, sizeof(sched_cfg));
bzero(&common_locations, sizeof(common_locations));
bzero(&pdsch_re, sizeof(pdsch_re));
bzero(&mutex, sizeof(mutex));
for (int i = 0; i < 3; i++) {
bzero(rar_locations[i], sizeof(sched_ue::sched_dci_cce_t) * 10);
}
pthread_mutex_init(&mutex, NULL);
reset();
}
@ -80,7 +96,10 @@ int sched::cell_cfg(sched_interface::cell_cfg_t* cell_cfg)
memcpy(&cfg, cell_cfg, sizeof(sched_interface::cell_cfg_t));
// Get DCI locations
srslte_regs_init(&regs, cfg.cell);
if (srslte_regs_init(&regs, cfg.cell)) {
Error("Getting DCI locations\n");
return SRSLTE_ERROR;
}
P = srslte_ra_type0_P(cfg.cell.nof_prb);
si_n_rbg = 4/P;

@ -49,8 +49,17 @@ namespace srsenb {
*
*******************************************************/
sched_ue::sched_ue()
sched_ue::sched_ue() : ue_idx(0), has_pucch(false), power_headroom(0), rnti(0), max_mcs_dl(0), max_mcs_ul(0),
fixed_mcs_ul(0), fixed_mcs_dl(0), phy_config_dedicated_enabled(false)
{
log_h = NULL;
bzero(&cell, sizeof(cell));
bzero(&lch, sizeof(lch));
bzero(&dci_locations, sizeof(dci_locations));
bzero(&dl_harq, sizeof(dl_harq));
bzero(&ul_harq, sizeof(ul_harq));
bzero(&dl_ant_info, sizeof(dl_ant_info));
reset();
}
@ -102,6 +111,10 @@ void sched_ue::reset()
ul_cqi = 1;
dl_cqi_tti = 0;
ul_cqi_tti = 0;
dl_ri = 0;
dl_ri_tti = 0;
dl_pmi = 0;
dl_pmi_tti = 0;
cqi_request_tti = 0;
for (int i=0;i<SCHED_MAX_HARQ_PROC;i++) {
for(uint32_t tb = 0; tb < SRSLTE_MAX_TB; tb++) {

@ -368,8 +368,7 @@ uint8_t* ue::generate_pdu(uint32_t tb_idx, sched_interface::dl_sched_pdu_t pdu[s
{
uint8_t *ret = NULL;
pthread_mutex_lock(&mutex);
if (rlc)
{
if (rlc) {
mac_msg_dl.init_tx(tx_payload_buffer[tb_idx], grant_size, false);
for (uint32_t i=0;i<nof_pdu_elems;i++) {
if (pdu[i].lcid <= srslte::sch_subh::PHR_REPORT) {
@ -383,7 +382,6 @@ uint8_t* ue::generate_pdu(uint32_t tb_idx, sched_interface::dl_sched_pdu_t pdu[s
} else {
std::cout << "Error ue not configured (must call config() first" << std::endl;
return NULL;
}
pthread_mutex_unlock(&mutex);

@ -35,6 +35,7 @@
#include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
@ -46,11 +47,11 @@ char const * const prefixes[2][9] =
{ "", "k", "M", "G", "T", "P", "E", "Z", "Y", },
};
metrics_stdout::metrics_stdout()
:started(false)
,do_print(false)
,n_reports(10)
metrics_stdout::metrics_stdout() : started(false) ,do_print(false), metrics_report_period(0.0f),n_reports(10)
{
enb_ = NULL;
bzero(&metrics_thread, sizeof(metrics_thread));
bzero(&metrics, sizeof(metrics));
}
bool metrics_stdout::init(enb_metrics_interface *u, float report_period_secs)
@ -101,6 +102,8 @@ void metrics_stdout::metrics_thread_run()
void metrics_stdout::print_metrics()
{
std::ios::fmtflags f(cout.flags()); // For avoiding Coverity defect: Not restoring ostream format
if(!do_print)
return;
@ -158,6 +161,7 @@ void metrics_stdout::print_metrics()
printf("RF status: O=%d, U=%d, L=%d\n", metrics.rf.rf_o, metrics.rf.rf_u, metrics.rf.rf_l);
}
cout.flags(f); // For avoiding Coverity defect: Not restoring ostream format
}
void metrics_stdout::print_disconnect()

@ -73,6 +73,11 @@ namespace srsenb {
phch_worker::phch_worker()
{
phy = NULL;
bzero(&enb_dl, sizeof(enb_dl));
bzero(&enb_ul, sizeof(enb_ul));
bzero(&tx_time, sizeof(tx_time));
reset();
}

@ -48,8 +48,11 @@ namespace srsenb {
phy::phy() : workers_pool(MAX_WORKERS),
workers(MAX_WORKERS),
workers_common(txrx::MUTEX_X_WORKER*MAX_WORKERS)
workers_common(txrx::MUTEX_X_WORKER*MAX_WORKERS),
nof_workers(0)
{
radio_handler = NULL;
bzero(&prach_cfg, sizeof(prach_cfg));
}
void phy::parse_config(phy_cfg_t* cfg)

@ -42,13 +42,13 @@ using namespace std;
namespace srsenb {
txrx::txrx()
{
txrx::txrx() : tx_mutex_cnt(0), nof_tx_mutex(0), tti(0) {
running = false;
radio_h = NULL;
log_h = NULL;
workers_pool = NULL;
worker_com = NULL;
prach = NULL;
}
bool txrx::init(srslte::radio* radio_h_, srslte::thread_pool* workers_pool_, phch_common* worker_com_, prach_worker *prach_, srslte::log* log_h_, uint32_t prio_)

@ -554,60 +554,66 @@ void rrc::parse_ul_ccch(uint16_t rnti, byte_buffer_t *pdu)
{
uint16_t old_rnti = 0;
LIBLTE_RRC_UL_CCCH_MSG_STRUCT ul_ccch_msg;
bzero(&ul_ccch_msg, sizeof(LIBLTE_RRC_UL_CCCH_MSG_STRUCT));
if (pdu) {
LIBLTE_RRC_UL_CCCH_MSG_STRUCT ul_ccch_msg;
bzero(&ul_ccch_msg, sizeof(LIBLTE_RRC_UL_CCCH_MSG_STRUCT));
srslte_bit_unpack_vector(pdu->msg, bit_buf.msg, pdu->N_bytes*8);
bit_buf.N_bits = pdu->N_bytes*8;
liblte_rrc_unpack_ul_ccch_msg((LIBLTE_BIT_MSG_STRUCT*)&bit_buf, &ul_ccch_msg);
srslte_bit_unpack_vector(pdu->msg, bit_buf.msg, pdu->N_bytes * 8);
bit_buf.N_bits = pdu->N_bytes * 8;
liblte_rrc_unpack_ul_ccch_msg((LIBLTE_BIT_MSG_STRUCT *) &bit_buf, &ul_ccch_msg);
rrc_log->info_hex(pdu->msg, pdu->N_bytes,
"SRB0 - Rx: %s",
liblte_rrc_ul_ccch_msg_type_text[ul_ccch_msg.msg_type]);
rrc_log->info_hex(pdu->msg, pdu->N_bytes,
"SRB0 - Rx: %s",
liblte_rrc_ul_ccch_msg_type_text[ul_ccch_msg.msg_type]);
switch(ul_ccch_msg.msg_type) {
case LIBLTE_RRC_UL_CCCH_MSG_TYPE_RRC_CON_REQ:
if (users.count(rnti)) {
users[rnti].handle_rrc_con_req(&ul_ccch_msg.msg.rrc_con_req);
} else {
rrc_log->error("Received ConnectionSetup for rnti=0x%x without context\n", rnti);
}
break;
case LIBLTE_RRC_UL_CCCH_MSG_TYPE_RRC_CON_REEST_REQ:
rrc_log->debug("rnti=0x%x, phyid=0x%x, smac=0x%x, cause=%s\n",
ul_ccch_msg.msg.rrc_con_reest_req.ue_id.c_rnti, ul_ccch_msg.msg.rrc_con_reest_req.ue_id.phys_cell_id,
ul_ccch_msg.msg.rrc_con_reest_req.ue_id.short_mac_i, liblte_rrc_con_reest_req_cause_text[ul_ccch_msg.msg.rrc_con_reest_req.cause]
);
if (users[rnti].is_idle()) {
old_rnti = ul_ccch_msg.msg.rrc_con_reest_req.ue_id.c_rnti;
if (users.count(old_rnti)) {
rrc_log->error("Not supported: ConnectionReestablishment. Sending Connection Reject\n", old_rnti);
users[rnti].send_connection_reest_rej();
rem_user_thread(old_rnti);
switch (ul_ccch_msg.msg_type) {
case LIBLTE_RRC_UL_CCCH_MSG_TYPE_RRC_CON_REQ:
if (users.count(rnti)) {
users[rnti].handle_rrc_con_req(&ul_ccch_msg.msg.rrc_con_req);
} else {
rrc_log->error("Received ConnectionReestablishment for rnti=0x%x without context\n", old_rnti);
users[rnti].send_connection_reest_rej();
rrc_log->error("Received ConnectionSetup for rnti=0x%x without context\n", rnti);
}
// remove temporal rnti
rem_user_thread(rnti);
} else {
rrc_log->error("Received ReestablishmentRequest from an rnti=0x%x not in IDLE\n", rnti);
}
break;
default:
rrc_log->error("UL CCCH message not recognised\n");
break;
}
break;
case LIBLTE_RRC_UL_CCCH_MSG_TYPE_RRC_CON_REEST_REQ:
rrc_log->debug("rnti=0x%x, phyid=0x%x, smac=0x%x, cause=%s\n",
ul_ccch_msg.msg.rrc_con_reest_req.ue_id.c_rnti,
ul_ccch_msg.msg.rrc_con_reest_req.ue_id.phys_cell_id,
ul_ccch_msg.msg.rrc_con_reest_req.ue_id.short_mac_i,
liblte_rrc_con_reest_req_cause_text[ul_ccch_msg.msg.rrc_con_reest_req.cause]
);
if (users[rnti].is_idle()) {
old_rnti = ul_ccch_msg.msg.rrc_con_reest_req.ue_id.c_rnti;
if (users.count(old_rnti)) {
rrc_log->error("Not supported: ConnectionReestablishment. Sending Connection Reject\n", old_rnti);
users[rnti].send_connection_reest_rej();
rem_user_thread(old_rnti);
} else {
rrc_log->error("Received ConnectionReestablishment for rnti=0x%x without context\n", old_rnti);
users[rnti].send_connection_reest_rej();
}
// remove temporal rnti
rem_user_thread(rnti);
} else {
rrc_log->error("Received ReestablishmentRequest from an rnti=0x%x not in IDLE\n", rnti);
}
break;
default:
rrc_log->error("UL CCCH message not recognised\n");
break;
}
pool->deallocate(pdu);
pool->deallocate(pdu);
}
}
void rrc::parse_ul_dcch(uint16_t rnti, uint32_t lcid, byte_buffer_t *pdu)
{
if (users.count(rnti)) {
users[rnti].parse_ul_dcch(lcid, pdu);
} else {
rrc_log->error("Processing %s: Unkown rnti=0x%x\n", rb_id_text[lcid], rnti);
if (pdu) {
if (users.count(rnti)) {
users[rnti].parse_ul_dcch(lcid, pdu);
} else {
rrc_log->error("Processing %s: Unkown rnti=0x%x\n", rb_id_text[lcid], rnti);
}
}
}
@ -1757,7 +1763,7 @@ int rrc::ue::cqi_allocate(uint32_t period, uint32_t *pmi_idx, uint32_t *n_pucch)
*pmi_idx = 318 + parent->cfg.cqi_cfg.sf_mapping[j_min];
} else if (period == 64) {
*pmi_idx = 350 + parent->cfg.cqi_cfg.sf_mapping[j_min];
} else if (period == 64) {
} else if (period == 128) {
*pmi_idx = 414 + parent->cfg.cqi_cfg.sf_mapping[j_min];
}
}

@ -590,15 +590,15 @@ int main(int argc, char *argv[])
/******************* This is copied from srsue gw **********************/
int setup_if_addr(char *ip_addr)
{
char *dev = (char*) "tun_srsenb";
int sock = 0;
// Construct the TUN device
int tun_fd = open("/dev/net/tun", O_RDWR);
if(0 > tun_fd)
{
perror("open");
return(-1);
return SRSLTE_ERROR;
}
struct ifreq ifr;
@ -609,30 +609,23 @@ int setup_if_addr(char *ip_addr)
if(0 > ioctl(tun_fd, TUNSETIFF, &ifr))
{
perror("ioctl1");
close(tun_fd);
return -1;
goto clean_exit;
}
// Bring up the interface
int sock = socket(AF_INET, SOCK_DGRAM, 0);
sock = socket(AF_INET, SOCK_DGRAM, 0);
if(0 > ioctl(sock, SIOCGIFFLAGS, &ifr))
{
perror("socket");
close(sock);
close(tun_fd);
return -1;
goto clean_exit;
}
ifr.ifr_flags |= IFF_UP | IFF_RUNNING;
if(0 > ioctl(sock, SIOCSIFFLAGS, &ifr))
{
perror("ioctl2");
close(sock);
close(tun_fd);
return -1;
goto clean_exit;
}
close(sock);
// Setup the IP address
sock = socket(AF_INET, SOCK_DGRAM, 0);
ifr.ifr_addr.sa_family = AF_INET;
@ -640,21 +633,19 @@ int setup_if_addr(char *ip_addr)
if(0 > ioctl(sock, SIOCSIFADDR, &ifr))
{
perror("ioctl");
close(sock);
close(tun_fd);
return -1;
goto clean_exit;
}
ifr.ifr_netmask.sa_family = AF_INET;
((struct sockaddr_in *)&ifr.ifr_netmask)->sin_addr.s_addr = inet_addr("255.255.255.0");
if(0 > ioctl(sock, SIOCSIFNETMASK, &ifr))
{
perror("ioctl");
close(sock);
close(tun_fd);
return -1;
goto clean_exit;
}
close(sock);
return(tun_fd);
clean_exit:
close(tun_fd);
return SRSLTE_ERROR;
}

@ -193,6 +193,7 @@ s1ap::enb_listen()
evnts.sctp_data_io_event = 1;
evnts.sctp_shutdown_event=1;
if(setsockopt(sock_fd, IPPROTO_SCTP, SCTP_EVENTS, &evnts, sizeof (evnts))){
close(sock_fd);
m_s1ap_log->console("Subscribing to sctp_data_io_events failed\n");
return -1;
}
@ -204,6 +205,7 @@ s1ap::enb_listen()
s1mme_addr.sin_port = htons(S1MME_PORT);
err = bind(sock_fd, (struct sockaddr*) &s1mme_addr, sizeof (s1mme_addr));
if (err != 0){
close(sock_fd);
m_s1ap_log->error("Error binding SCTP socket\n");
m_s1ap_log->console("Error binding SCTP socket\n");
return -1;
@ -212,6 +214,7 @@ s1ap::enb_listen()
//Listen for connections
err = listen(sock_fd,SOMAXCONN);
if (err != 0){
close(sock_fd);
m_s1ap_log->error("Error in SCTP socket listen\n");
m_s1ap_log->console("Error in SCTP socket listen\n");
return -1;

@ -428,22 +428,19 @@ s1ap_nas_transport::handle_nas_authentication_response(srslte::byte_buffer_t *na
bool ue_valid=true;
m_s1ap_log->console("Authentication Response -- IMSI %015lu\n", ue_ctx->imsi);
m_s1ap_log->console("Authentication Response -- RES 0x%x%x%x%x%x%x%x%x\n",
auth_resp.res[0],
auth_resp.res[1],
auth_resp.res[2],
auth_resp.res[3],
auth_resp.res[4],
auth_resp.res[5],
auth_resp.res[6],
auth_resp.res[7]
);
//Get NAS authentication response
LIBLTE_ERROR_ENUM err = liblte_mme_unpack_authentication_response_msg((LIBLTE_BYTE_MSG_STRUCT *) nas_msg, &auth_resp);
if(err != LIBLTE_SUCCESS){
m_s1ap_log->error("Error unpacking NAS authentication response. Error: %s\n", liblte_error_text[err]);
return false;
}
m_s1ap_log->console("Authentication Response -- RES 0x%x%x%x%x%x%x%x%x\n",
auth_resp.res[0], auth_resp.res[1], auth_resp.res[2], auth_resp.res[3],
auth_resp.res[4], auth_resp.res[5], auth_resp.res[6], auth_resp.res[7]);
m_s1ap_log->info("Authentication Response -- RES 0x%x%x%x%x%x%x%x%x\n",
auth_resp.res[0], auth_resp.res[1], auth_resp.res[2], auth_resp.res[3],
auth_resp.res[4], auth_resp.res[5], auth_resp.res[6], auth_resp.res[7]);
for(int i=0; i<8;i++)
{
@ -547,7 +544,7 @@ s1ap_nas_transport::handle_nas_attach_complete(srslte::byte_buffer_t *nas_msg, u
m_s1ap_log->console("Unpacked Attached Complete Message\n");
m_s1ap_log->console("Unpacked Activavate Default EPS Bearer message. EPS Bearer id %d\n",act_bearer.eps_bearer_id);
//ue_ctx->erabs_ctx[act_bearer->eps_bearer_id].enb_fteid;
if(act_bearer.eps_bearer_id < 5 || act_bearer.eps_bearer_id > 16)
if(act_bearer.eps_bearer_id < 5 || act_bearer.eps_bearer_id > 15)
{
m_s1ap_log->error("EPS Bearer ID out of range\n");
return false;
@ -1091,6 +1088,14 @@ s1ap_nas_transport::pack_attach_accept(ue_ctx_t *ue_ctx, LIBLTE_S1AP_E_RABTOBESE
act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].contents[2] = 8;
act_def_eps_bearer_context_req.protocol_cnfg_opts.opt[0].contents[3] = 8;
//Make sure all unused options are set to false
act_def_eps_bearer_context_req.negotiated_qos_present = false;
act_def_eps_bearer_context_req.llc_sapi_present = false;
act_def_eps_bearer_context_req.radio_prio_present = false;
act_def_eps_bearer_context_req.packet_flow_id_present = false;
act_def_eps_bearer_context_req.apn_ambr_present = false;
act_def_eps_bearer_context_req.esm_cause_present = false;
uint8_t sec_hdr_type =2;
ue_ctx->security_ctxt.dl_nas_count++;
liblte_mme_pack_activate_default_eps_bearer_context_request_msg(&act_def_eps_bearer_context_req, &attach_accept.esm_msg);

@ -175,7 +175,9 @@ spgw::init_sgi_if(spgw_args_t *args)
memset(&ifr, 0, sizeof(ifr));
ifr.ifr_flags = IFF_TUN | IFF_NO_PI;
strncpy(ifr.ifr_ifrn.ifrn_name, dev, IFNAMSIZ);
strncpy(ifr.ifr_ifrn.ifrn_name, dev, IFNAMSIZ-1);
ifr.ifr_ifrn.ifrn_name[IFNAMSIZ-1]='\0';
if(ioctl(m_sgi_if, TUNSETIFF, &ifr) < 0)
{
m_spgw_log->error("Failed to set TUN device name: %s\n", strerror(errno));

@ -57,7 +57,6 @@ private:
std::string float_to_eng_string(float f, int digits);
std::string int_to_eng_string(int f, int digits);
float metrics_report_period;
bool do_print;
uint8_t n_reports;
ue_metrics_interface* ue;

@ -232,8 +232,8 @@ void phch_worker::work_imp()
/** Calculate RSSI on the input signal before generating the output */
// Average RSSI over all symbols
float rssi_dbm = 10*log10(srslte_vec_avg_power_cf(signal_buffer[0], SRSLTE_SF_LEN_PRB(cell.nof_prb))) + 30;
// Average RSSI over all symbols (make sure SF length is non-zero)
float rssi_dbm = SRSLTE_SF_LEN_PRB(cell.nof_prb) > 0 ? (10*log10(srslte_vec_avg_power_cf(signal_buffer[0], SRSLTE_SF_LEN_PRB(cell.nof_prb))) + 30) : 0;
if (isnormal(rssi_dbm)) {
phy->avg_rssi_dbm = SRSLTE_VEC_EMA(rssi_dbm, phy->avg_rssi_dbm, phy->args->snr_ema_coeff);
}

@ -81,6 +81,7 @@ bool ue::init(all_args_t *args_)
// Init logs
rf_log.set_level(srslte::LOG_LEVEL_INFO);
rf_log.info("Starting UE\n");
for (int i=0;i<args->expert.phy.nof_phy_threads;i++) {
((srslte::log_filter*) phy_log[i])->set_level(level(args->log.phy_level));
}

Loading…
Cancel
Save