diff --git a/lib/test/upper/rlc_am_test.cc b/lib/test/upper/rlc_am_test.cc index c379724cc..fbd013e3b 100644 --- a/lib/test/upper/rlc_am_test.cc +++ b/lib/test/upper/rlc_am_test.cc @@ -482,7 +482,7 @@ void resegment_test_1() // Read the retx PDU from RLC1 and force resegmentation byte_buffer_t retx1; - len = rlc1.read_pdu(retx1.msg, 9); // 4 byte header + 5 data + len = rlc1.read_pdu(retx1.msg, 11); // 4 byte header + 5 data retx1.N_bytes = len; // Write the retx PDU to RLC2 @@ -492,7 +492,7 @@ void resegment_test_1() // Read the remaining segment byte_buffer_t retx2; - len = rlc1.read_pdu(retx2.msg, 9); // 4 byte header + 5 data + len = rlc1.read_pdu(retx2.msg, 11); // 4 byte header + 5 data retx2.N_bytes = len; // Write the retx PDU to RLC2 @@ -591,7 +591,7 @@ void resegment_test_2() // Read the retx PDU from RLC1 and force resegmentation byte_buffer_t retx1; - retx1.N_bytes = rlc1.read_pdu(retx1.msg, 16); // 6 byte header + 10 data + retx1.N_bytes = rlc1.read_pdu(retx1.msg, 18); // 6 byte header + 10 data // Write the retx PDU to RLC2 rlc2.write_pdu(retx1.msg, retx1.N_bytes); @@ -600,7 +600,7 @@ void resegment_test_2() // Read the remaining segment byte_buffer_t retx2; - retx2.N_bytes = rlc1.read_pdu(retx2.msg, 16); // 6 byte header + 10 data + retx2.N_bytes = rlc1.read_pdu(retx2.msg, 18); // 6 byte header + 10 data // Write the retx PDU to RLC2 rlc2.write_pdu(retx2.msg, retx2.N_bytes); @@ -696,14 +696,14 @@ void resegment_test_3() // Read the retx PDU from RLC1 and force resegmentation byte_buffer_t retx1; - retx1.N_bytes = rlc1.read_pdu(retx1.msg, 14); // 4 byte header + 10 data + retx1.N_bytes = rlc1.read_pdu(retx1.msg, 16); // 4 byte header + 10 data // Write the retx PDU to RLC2 rlc2.write_pdu(retx1.msg, retx1.N_bytes); // Read the remaining segment byte_buffer_t retx2; - retx2.N_bytes = rlc1.read_pdu(retx2.msg, 14); // 4 byte header + 10 data + retx2.N_bytes = rlc1.read_pdu(retx2.msg, 16); // 4 byte header + 10 data // Write the retx PDU to RLC2 rlc2.write_pdu(retx2.msg, retx2.N_bytes); @@ -799,14 +799,14 @@ void resegment_test_4() // Read the retx PDU from RLC1 and force resegmentation byte_buffer_t retx1; - retx1.N_bytes = rlc1.read_pdu(retx1.msg, 21); // 6 byte header + 15 data + retx1.N_bytes = rlc1.read_pdu(retx1.msg, 23); // 6 byte header + 15 data // Write the retx PDU to RLC2 rlc2.write_pdu(retx1.msg, retx1.N_bytes); // Read the remaining segment byte_buffer_t retx2; - retx2.N_bytes = rlc1.read_pdu(retx2.msg, 21); // 6 byte header + 15 data + retx2.N_bytes = rlc1.read_pdu(retx2.msg, 23); // 6 byte header + 15 data // Write the retx PDU to RLC2 rlc2.write_pdu(retx2.msg, retx2.N_bytes); @@ -902,14 +902,14 @@ void resegment_test_5() // Read the retx PDU from RLC1 and force resegmentation byte_buffer_t retx1; - retx1.N_bytes = rlc1.read_pdu(retx1.msg, 27); // 7 byte header + 20 data + retx1.N_bytes = rlc1.read_pdu(retx1.msg, 29); // 7 byte header + 20 data // Write the retx PDU to RLC2 rlc2.write_pdu(retx1.msg, retx1.N_bytes); // Read the remaining segment byte_buffer_t retx2; - retx2.N_bytes = rlc1.read_pdu(retx2.msg, 27); // 7 byte header + 20 data + retx2.N_bytes = rlc1.read_pdu(retx2.msg, 29); // 7 byte header + 20 data // Write the retx PDU to RLC2 rlc2.write_pdu(retx2.msg, retx2.N_bytes); @@ -1017,7 +1017,7 @@ void resegment_test_6() // Read the retx PDU from RLC1 and force resegmentation byte_buffer_t retx1; - len = rlc1.read_pdu(retx1.msg, 127); + len = rlc1.read_pdu(retx1.msg, 129); retx1.N_bytes = len; // Write the retx PDU to RLC2 @@ -1027,7 +1027,7 @@ void resegment_test_6() // Read the remaining segment byte_buffer_t retx2; - len = rlc1.read_pdu(retx2.msg, 157); + len = rlc1.read_pdu(retx2.msg, 159); retx2.N_bytes = len; // Write the retx PDU to RLC2 diff --git a/srsue/src/mac/proc_ra.cc b/srsue/src/mac/proc_ra.cc index d9a3e0d4d..ef7c55f1e 100644 --- a/srsue/src/mac/proc_ra.cc +++ b/srsue/src/mac/proc_ra.cc @@ -222,7 +222,7 @@ void ra_proc::step_resource_selection() { if (preambleIndex > 0) { // Preamble is chosen by Higher layers (ie Network) sel_maskIndex = maskIndex; - sel_preamble = (uint32_t) preambleIndex%nof_preambles; + sel_preamble = (uint32_t) preambleIndex; } else { // Preamble is chosen by MAC UE if (!msg3_transmitted) { @@ -361,7 +361,7 @@ void ra_proc::tb_decoded_ok() { // If we have a C-RNTI, tell Mux unit to append C-RNTI CE if no CCCH SDU transmission if (transmitted_crnti) { - rDebug("Appending C-RNTI MAC CE in next transmission\n"); + rInfo("Appending C-RNTI MAC CE 0x%x in next transmission\n", transmitted_crnti); mux_unit->append_crnti_ce_next_tx(transmitted_crnti); phy_h->pdcch_ul_search(SRSLTE_RNTI_USER, transmitted_crnti); phy_h->pdcch_dl_search(SRSLTE_RNTI_USER, transmitted_crnti); @@ -375,7 +375,7 @@ void ra_proc::tb_decoded_ok() { contention_resolution_timer->run(); } } else { - rDebug("Found RAR for preamble %d\n", rar_pdu_msg.get()->get_rapid()); + rInfo("Found RAR for preamble %d\n", rar_pdu_msg.get()->get_rapid()); } } } diff --git a/srsue/src/phy/phch_common.cc b/srsue/src/phy/phch_common.cc index 01121f3b3..b76b0d9ce 100644 --- a/srsue/src/phy/phch_common.cc +++ b/srsue/src/phy/phch_common.cc @@ -46,7 +46,8 @@ phch_common::phch_common(uint32_t max_mutex_) : tx_mutex(max_mutex_) radio_h = NULL; mac = NULL; max_mutex = max_mutex_; - nof_mutex = 0; + nof_mutex = 0; + rx_gain_offset = 0; bzero(&dl_metrics, sizeof(dl_metrics_t)); dl_metrics_read = true; @@ -336,7 +337,6 @@ void phch_common::reset() { cur_pusch_power = 0; p0_preamble = 0; cur_radio_power = 0; - rx_gain_offset = 0; sr_last_tx_tti = -1; cur_pusch_power = 0; avg_rsrp = 0; diff --git a/srsue/src/phy/phch_recv.cc b/srsue/src/phy/phch_recv.cc index 0449aaf9d..6c7a8c1ea 100644 --- a/srsue/src/phy/phch_recv.cc +++ b/srsue/src/phy/phch_recv.cc @@ -1093,7 +1093,7 @@ uint32_t phch_recv::measure::frame_st_idx() { } void phch_recv::measure::set_rx_gain_offset(float rx_gain_offset) { - this->rx_gain_offset = rx_gain_offset; + this->rx_gain_offset = rx_gain_offset; } phch_recv::measure::ret_code phch_recv::measure::run_subframe_sync(srslte_ue_sync_t *ue_sync, uint32_t sf_idx) @@ -1207,7 +1207,7 @@ phch_recv::measure::ret_code phch_recv::measure::run_subframe(uint32_t sf_idx) if (cnt >= nof_subframes) { // Calibrate RSRP if no gain offset measurements - if (rx_gain_offset == 0 && radio_h) { + if (fabsf(rx_gain_offset) < 1.0 && radio_h) { float temporal_offset = 0; if (radio_h->has_rssi()) { temporal_offset = mean_rssi - radio_h->get_rssi() + 30; diff --git a/srsue/src/phy/phch_worker.cc b/srsue/src/phy/phch_worker.cc index 83de10b8f..9caa0102a 100644 --- a/srsue/src/phy/phch_worker.cc +++ b/srsue/src/phy/phch_worker.cc @@ -367,7 +367,7 @@ void phch_worker::work_imp() update_measurements(); if (chest_ok) { - if (phy->avg_rsrp_dbm > -124.0 && 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)) > -30.0) { + if (phy->avg_rsrp_dbm > -130.0 && 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)) > -30.0) { log_h->debug("SNR=%.1f dB, RSRP=%.1f dBm sync=in-sync from channel estimator\n", 10*log10(srslte_chest_dl_get_snr(&ue_dl.chest)), phy->avg_rsrp_dbm); chest_loop->in_sync(); diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index 29d8d8e3c..24ccbb4c0 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -591,12 +591,7 @@ void rrc::cell_found(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp) { } } if (found) { - rrc_log->info("Updating %s cell EARFCN=%d, PCI=%d, RSRP=%.1f dBm\n", - cell_idx>=0?"neighbour":"serving", - serving_cell->earfcn, - serving_cell->phy_cell.id, - serving_cell->rsrp); - + if (!serving_cell->has_valid_sib1) { si_acquire_state = SI_ACQUIRE_SIB1; } else if (state == RRC_STATE_PLMN_SELECTION) { @@ -617,12 +612,15 @@ void rrc::cell_found(uint32_t earfcn, srslte_cell_t phy_cell, float rsrp) { set_serving_cell(earfcn, phy_cell.id); si_acquire_state = SI_ACQUIRE_SIB1; - - rrc_log->info("New Cell: PCI=%d, PRB=%d, Ports=%d, EARFCN=%d, RSRP=%.1f dBm\n", - serving_cell->phy_cell.id, serving_cell->phy_cell.nof_prb, serving_cell->phy_cell.nof_ports, - serving_cell->earfcn, serving_cell->rsrp); } } + + rrc_log->info("%s %s cell EARFCN=%d, PCI=%d, RSRP=%.1f dBm\n", + found?"Updating":"Adding", + cell_idx>=0?"neighbour":"serving", + serving_cell->earfcn, + serving_cell->phy_cell.id, + serving_cell->rsrp); } bool sort_rsrp(cell_t *u1, cell_t *u2) { @@ -2431,8 +2429,8 @@ void rrc::rrc_meas::generate_report(uint32_t meas_id) report->pcell_rsrp_result = value_to_range(RSRP, pcell_measurement.ms[RSRP]); report->pcell_rsrq_result = value_to_range(RSRQ, pcell_measurement.ms[RSRQ]); - log_h->console("MEAS: Generate report MeasId=%d, rsrp=%f rsrq=%f\n", - report->meas_id, pcell_measurement.ms[RSRP], pcell_measurement.ms[RSRQ]); + log_h->info("MEAS: Generate report MeasId=%d, nof_reports_send=%d, Pcell rsrp=%f rsrq=%f\n", + report->meas_id, m->nof_reports_sent, pcell_measurement.ms[RSRP], pcell_measurement.ms[RSRQ]); // TODO: report up to 8 best cells for (std::map::iterator cell = m->cell_values.begin(); cell != m->cell_values.end(); ++cell) @@ -2447,7 +2445,7 @@ void rrc::rrc_meas::generate_report(uint32_t meas_id) rc->meas_result.rsrp_result = value_to_range(RSRP, cell->second.ms[RSRP]); rc->meas_result.rsrq_result = value_to_range(RSRQ, cell->second.ms[RSRQ]); - log_h->info("MEAS: Add neigh=%d, pci=%d, rsrp=%f, rsrq=%f\n", + log_h->info("MEAS: Adding to report neighbour=%d, pci=%d, rsrp=%f, rsrq=%f\n", report->meas_result_neigh_cells.eutra.n_result, rc->phys_cell_id, cell->second.ms[RSRP], cell->second.ms[RSRQ]); @@ -2667,10 +2665,14 @@ void rrc::rrc_meas::remove_meas_report(uint32_t report_id) { } void rrc::rrc_meas::remove_meas_id(uint32_t measId) { - mac_timers->timer_get(active[measId].periodic_timer)->stop(); - mac_timers->timer_release_id(active[measId].periodic_timer); - log_h->info("MEAS: Removed measId=%d\n", measId); - active.erase(measId); + if (active.count(measId)) { + mac_timers->timer_get(active[measId].periodic_timer)->stop(); + mac_timers->timer_release_id(active[measId].periodic_timer); + log_h->info("MEAS: Removed measId=%d\n", measId); + active.erase(measId); + } else { + log_h->warning("MEAS: Removing unexistent measId=%d\n", measId); + } } void rrc::rrc_meas::remove_meas_id(std::map::iterator it) { @@ -2808,15 +2810,17 @@ void rrc::rrc_meas::parse_meas_config(LIBLTE_RRC_MEAS_CONFIG_STRUCT *cfg) for (uint32_t i=0;imeas_id_to_add_mod_list.N_meas_id;i++) { LIBLTE_RRC_MEAS_ID_TO_ADD_MOD_STRUCT *measId = &cfg->meas_id_to_add_mod_list.meas_id_list[i]; // Stop the timer if the entry exists or create the timer if not + bool is_new = false; if (active.count(measId->meas_id)) { mac_timers->timer_get(active[measId->meas_id].periodic_timer)->stop(); } else { + is_new = true; active[measId->meas_id].periodic_timer = mac_timers->timer_get_unique_id(); } active[measId->meas_id].object_id = measId->meas_obj_id; active[measId->meas_id].report_id = measId->rep_cnfg_id; - log_h->info("MEAS: Added measId=%d, measObjectId=%d, reportConfigId=%d\n", - measId->meas_id, measId->meas_obj_id, measId->rep_cnfg_id); + log_h->info("MEAS: %s measId=%d, measObjectId=%d, reportConfigId=%d\n", + is_new?"Added":"Updated", measId->meas_id, measId->meas_obj_id, measId->rep_cnfg_id); } }