From ffb076b2c5a0519b0b37e79206ba4524ba14c98d Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Thu, 1 Feb 2018 16:43:56 +0100 Subject: [PATCH 01/12] Buffer is deallocated for tx_window but tx_window object is not removed from map. Next time is accessed buffer is null. --- lib/src/upper/rlc_am.cc | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index 6905151f0..d87d1240c 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -471,7 +471,7 @@ int rlc_am::build_retx_pdu(uint8_t *payload, uint32_t nof_bytes) if (!retx_queue.empty()) { retx = retx_queue.front(); } else { - log->error("In build_retx_pdu(): retx_queue is empty during sanity check\n"); + log->error("In build_retx_pdu(): retx_queue is empty during sanity check, sn=%d\n", retx.sn); return -1; } } @@ -549,7 +549,7 @@ int rlc_am::build_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_retx_t r rrc->get_rb_name(lcid).c_str(), nof_bytes, head_len); return 0; } - pdu_space = nof_bytes-head_len; + pdu_space = nof_bytes-head_len-2; if(pdu_space < (retx.so_end-retx.so_start)) retx.so_end = retx.so_start+pdu_space; @@ -568,7 +568,7 @@ int rlc_am::build_segment(uint8_t *payload, uint32_t nof_bytes, rlc_amd_retx_t r upper += old_header.li[i]; head_len = rlc_am_packed_length(&new_header); - pdu_space = nof_bytes-head_len; + pdu_space = nof_bytes-head_len-2; if(pdu_space < (retx.so_end-retx.so_start)) retx.so_end = retx.so_start+pdu_space; @@ -1014,10 +1014,11 @@ void rlc_am::handle_control_pdu(uint8_t *payload, uint32_t nof_bytes) if(it->second.buf) { pool->deallocate(it->second.buf); it->second.buf = 0; + log->info("SN=%d removed from tx_window\n", i); } + tx_window.erase(it); if(update_vt_a) { - tx_window.erase(it); vt_a = (vt_a + 1)%MOD; vt_ms = (vt_ms + 1)%MOD; } From 0d65c48105d19e74b1b1e37ebcec0bf96e82191b Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Thu, 1 Feb 2018 17:17:18 +0100 Subject: [PATCH 02/12] When RLC retx queue is empty, do not error and transmit a new tx --- lib/src/upper/rlc_am.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index d87d1240c..a5d7f19e7 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -315,8 +315,10 @@ int rlc_am::read_pdu(uint8_t *payload, uint32_t nof_bytes) // RETX if required if(retx_queue.size() > 0) { int ret = build_retx_pdu(payload, nof_bytes); - pthread_mutex_unlock(&mutex); - return ret; + if (ret) { + pthread_mutex_unlock(&mutex); + return ret; + } } // Build a PDU from SDUs @@ -471,8 +473,8 @@ int rlc_am::build_retx_pdu(uint8_t *payload, uint32_t nof_bytes) if (!retx_queue.empty()) { retx = retx_queue.front(); } else { - log->error("In build_retx_pdu(): retx_queue is empty during sanity check, sn=%d\n", retx.sn); - return -1; + log->info("In build_retx_pdu(): retx_queue is empty during sanity check, sn=%d\n", retx.sn); + return 0; } } From 8f2db5feb8c9d1534ea0b66fbcfb9f09d06fc5e2 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Sat, 3 Feb 2018 11:05:42 +0100 Subject: [PATCH 03/12] Fix as per psutton review of pull request #147 --- lib/src/upper/rlc_am.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index a5d7f19e7..261fbd082 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -315,7 +315,7 @@ int rlc_am::read_pdu(uint8_t *payload, uint32_t nof_bytes) // RETX if required if(retx_queue.size() > 0) { int ret = build_retx_pdu(payload, nof_bytes); - if (ret) { + if (ret > 0) {s pthread_mutex_unlock(&mutex); return ret; } From c64c6181940283be087eba1689a50f032f342943 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Sat, 3 Feb 2018 11:07:21 +0100 Subject: [PATCH 04/12] Fix typo in previous commit and remove printf --- lib/src/upper/rlc_am.cc | 2 +- srsue/src/upper/rrc.cc | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/src/upper/rlc_am.cc b/lib/src/upper/rlc_am.cc index 261fbd082..76eb10da4 100644 --- a/lib/src/upper/rlc_am.cc +++ b/lib/src/upper/rlc_am.cc @@ -315,7 +315,7 @@ int rlc_am::read_pdu(uint8_t *payload, uint32_t nof_bytes) // RETX if required if(retx_queue.size() > 0) { int ret = build_retx_pdu(payload, nof_bytes); - if (ret > 0) {s + if (ret > 0) { pthread_mutex_unlock(&mutex); return ret; } diff --git a/srsue/src/upper/rrc.cc b/srsue/src/upper/rrc.cc index 3e1f0ae05..29d8d8e3c 100644 --- a/srsue/src/upper/rrc.cc +++ b/srsue/src/upper/rrc.cc @@ -492,8 +492,6 @@ void rrc::set_serving_cell(uint32_t cell_idx) { // Set new serving cell serving_cell = new_serving_cell; - printf("Setting new serving cell idx=%d, PCI=%d, nof_neighbours=%d\n", - cell_idx, serving_cell->phy_cell.id, neighbour_cells.size()); rrc_log->info("Setting serving cell idx=%d, earfcn=%d, PCI=%d, nof_neighbours=%d\n", cell_idx, serving_cell->earfcn, serving_cell->phy_cell.id, neighbour_cells.size()); From c40f5e6ef80f25b3e36a9a0b1e6fbbbef27e1cb2 Mon Sep 17 00:00:00 2001 From: Paul Sutton Date: Mon, 5 Feb 2018 09:30:58 +0000 Subject: [PATCH 05/12] Fixes for RLC AM tests --- lib/test/upper/rlc_am_test.cc | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) 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 From 69895d29288cff23b9212a6f13efee8037b856cd Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Mon, 5 Feb 2018 13:05:05 +0100 Subject: [PATCH 06/12] Do not reset rx_gain_offset when PHY reset. Added log messages to debug Measurement reports --- srsue/src/mac/proc_ra.cc | 6 +++--- srsue/src/phy/phch_common.cc | 4 ++-- srsue/src/phy/phch_recv.cc | 4 ++-- srsue/src/phy/phch_worker.cc | 2 +- srsue/src/upper/rrc.cc | 42 ++++++++++++++++++++---------------- 5 files changed, 31 insertions(+), 27 deletions(-) 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); } } From 610edac8015f2d98f07b4d2632ca53ad8e78bf7d Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Mon, 5 Feb 2018 12:59:06 +0100 Subject: [PATCH 07/12] Do not append RI in RM30 if no TM3/4 --- srsue/src/phy/phch_worker.cc | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/srsue/src/phy/phch_worker.cc b/srsue/src/phy/phch_worker.cc index 9caa0102a..61c767e7a 100644 --- a/srsue/src/phy/phch_worker.cc +++ b/srsue/src/phy/phch_worker.cc @@ -940,11 +940,16 @@ void phch_worker::set_uci_aperiodic_cqi() srslte_cqi_to_str(uci_data.uci_cqi, uci_data.uci_cqi_len, cqi_str, SRSLTE_CQI_STR_MAX_CHAR); /* Set RI = 1 */ - uci_data.uci_ri = ri; - uci_data.uci_ri_len = 1; + if (phy->config->dedicated.antenna_info_explicit_value.tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_3 || + phy->config->dedicated.antenna_info_explicit_value.tx_mode == LIBLTE_RRC_TRANSMISSION_MODE_4) { + uci_data.uci_ri = ri; + uci_data.uci_ri_len = 1; + } else { + uci_data.uci_ri_len = 0; + } - Info("PUSCH: Aperiodic RM30 ri%s, CQI=%s, SNR=%.1f dB, for %d subbands\n", - (uci_data.uci_ri == 0)?"=1":"~1", cqi_str, phy->avg_snr_db, cqi_report.subband_hl.N); + Info("PUSCH: Aperiodic RM30 CQI=%s, SNR=%.1f dB, for %d subbands\n", + (uci_data.uci_ri_len)?((uci_data.uci_ri == 0)?"ri=0, ":"ri=1, "):"", cqi_str, phy->avg_snr_db, cqi_report.subband_hl.N); } break; case LIBLTE_RRC_CQI_REPORT_MODE_APERIODIC_RM31: From 4949759cdc8485f01db8deeb0f6e97e93bd1edef Mon Sep 17 00:00:00 2001 From: Xavier Arteaga Date: Tue, 6 Feb 2018 10:42:35 +0100 Subject: [PATCH 08/12] Fixed simultaneous PHICH (ACK) and CQI request. --- srsue/hdr/mac/ul_harq.h | 4 ++-- srsue/src/phy/phch_worker.cc | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/srsue/hdr/mac/ul_harq.h b/srsue/hdr/mac/ul_harq.h index 7418d23bf..b98a7497a 100644 --- a/srsue/hdr/mac/ul_harq.h +++ b/srsue/hdr/mac/ul_harq.h @@ -206,7 +206,7 @@ private: { if (ack) { if (grant) { - if (grant->ndi[0] == get_ndi()) { + if (grant->ndi[0] == get_ndi() && grant->phy_grant.ul.mcs.tbs != 0) { *ack = false; } } @@ -215,7 +215,7 @@ private: // Reset HARQ process if TB has changed if (harq_feedback && has_grant() && grant) { - if (grant->n_bytes[0] != cur_grant.n_bytes[0] && cur_grant.n_bytes[0] > 0) { + if (grant->n_bytes[0] != cur_grant.n_bytes[0] && cur_grant.n_bytes[0] > 0 && grant->n_bytes[0] > 0) { Debug("UL %d: Reset due to change of grant size last_grant=%d, new_grant=%d\n", pid, cur_grant.n_bytes[0], grant->n_bytes[0]); reset(); diff --git a/srsue/src/phy/phch_worker.cc b/srsue/src/phy/phch_worker.cc index 61c767e7a..720f0557e 100644 --- a/srsue/src/phy/phch_worker.cc +++ b/srsue/src/phy/phch_worker.cc @@ -931,7 +931,7 @@ void phch_worker::set_uci_aperiodic_cqi() int cqi_len = srslte_cqi_value_pack(&cqi_report, uci_data.uci_cqi); if (cqi_len < 0) { - Error("Error packing CQI value (Aperiodic reporting mode RM31)."); + Error("Error packing CQI value (Aperiodic reporting mode RM30)."); return; } uci_data.uci_cqi_len = (uint32_t) cqi_len; @@ -948,8 +948,8 @@ void phch_worker::set_uci_aperiodic_cqi() uci_data.uci_ri_len = 0; } - Info("PUSCH: Aperiodic RM30 CQI=%s, SNR=%.1f dB, for %d subbands\n", - (uci_data.uci_ri_len)?((uci_data.uci_ri == 0)?"ri=0, ":"ri=1, "):"", cqi_str, phy->avg_snr_db, cqi_report.subband_hl.N); + Info("PUSCH: Aperiodic RM30 CQI=%s, %sSNR=%.1f dB, for %d subbands\n", + cqi_str, (uci_data.uci_ri_len)?((uci_data.uci_ri == 0)?"ri=0, ":"ri=1, "):"", phy->avg_snr_db, cqi_report.subband_hl.N); } break; case LIBLTE_RRC_CQI_REPORT_MODE_APERIODIC_RM31: From 9dab102a7ee4b80198a643d58d7f4af9e1d0f405 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Tue, 6 Feb 2018 12:55:28 +0100 Subject: [PATCH 09/12] Removed debug printf from enb scheduler --- srsenb/src/mac/scheduler.cc | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/srsenb/src/mac/scheduler.cc b/srsenb/src/mac/scheduler.cc index fee1e5e5d..b7dc63898 100644 --- a/srsenb/src/mac/scheduler.cc +++ b/srsenb/src/mac/scheduler.cc @@ -864,16 +864,7 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched printf("SCHED: Could not schedule UL DCI rnti=0x%x, pid=%d, L=%d, sf_idx=%d\n", rnti, h->get_id(), aggr_level, sf_idx); - sched_ue::sched_dci_cce_t *loc=user->get_locations(current_cfi, sf_idx); - for (int i=0;inof_loc[aggr_level];i++) { - printf("n=%d\n", loc->cce_start[aggr_level][i]); - } - printf("used=["); - for (int i=0;ipusch[nof_dci_elems].needs_pdcch = false; + sched_result->pusch[nof_dci_elems].needs_pdcch = false; } else { sched_result->pusch[nof_dci_elems].needs_pdcch = true; } From f17cfa3ac30b0414b11f90906d0aa0cf00e7dbb6 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Tue, 6 Feb 2018 15:37:00 +0100 Subject: [PATCH 10/12] Fixed possible mod netgative SR period calculation --- lib/src/phy/ue/ue_ul.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/src/phy/ue/ue_ul.c b/lib/src/phy/ue/ue_ul.c index a0accb579..5cf913bfa 100644 --- a/lib/src/phy/ue/ue_ul.c +++ b/lib/src/phy/ue/ue_ul.c @@ -626,13 +626,12 @@ int srslte_ue_ul_sr_send_tti(uint32_t I_sr, uint32_t current_tti) { } else { return SRSLTE_ERROR; } - uint32_t sfn = current_tti/10; - uint32_t subf = current_tti%10; - if ((10*sfn+subf-sr_N_offset)%sr_periodicity==0) { - return 1; - } else { - return SRSLTE_SUCCESS; + if (current_tti >= sr_N_offset) { + if ((current_tti - sr_N_offset) % sr_periodicity == 0) { + return 1; + } } + return SRSLTE_SUCCESS; } From 8f850754f3ca6f7fd7f6a4b9dd89f171e0455702 Mon Sep 17 00:00:00 2001 From: Andre Puschmann Date: Tue, 6 Feb 2018 16:42:43 +0100 Subject: [PATCH 11/12] check malloc return value in various tests --- lib/src/phy/phch/test/pdsch_pdcch_file_test.c | 7 ++++++- lib/src/phy/phch/test/pmch_file_test.c | 12 +++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lib/src/phy/phch/test/pdsch_pdcch_file_test.c b/lib/src/phy/phch/test/pdsch_pdcch_file_test.c index 76f48b959..baab97cea 100644 --- a/lib/src/phy/phch/test/pdsch_pdcch_file_test.c +++ b/lib/src/phy/phch/test/pdsch_pdcch_file_test.c @@ -175,6 +175,10 @@ int main(int argc, char **argv) { } uint8_t *data[] = {malloc(100000)}; + if (!data[0]) { + perror("malloc"); + exit(-1); + } ret = -1; nof_frames = 0; @@ -195,7 +199,8 @@ int main(int argc, char **argv) { } while (nof_frames <= max_frames && ret == 0); base_free(); - free(data[0]); + if (data[0]) + free(data[0]); if (ret > 0) { exit(0); } else { diff --git a/lib/src/phy/phch/test/pmch_file_test.c b/lib/src/phy/phch/test/pmch_file_test.c index 1d0715caa..fa6d04092 100644 --- a/lib/src/phy/phch/test/pmch_file_test.c +++ b/lib/src/phy/phch/test/pmch_file_test.c @@ -181,13 +181,17 @@ int main(int argc, char **argv) { exit(-1); } - uint8_t *data[] = {malloc(100000)}; + uint8_t *data = malloc(100000); + if (!data) { + perror("malloc"); + exit(-1); + } ret = -1; srslte_filesource_read(&fsrc, input_buffer[0], flen); INFO("Reading %d samples sub-frame %d\n", flen, sf_idx); - ret = srslte_ue_dl_decode_mbsfn(&ue_dl, data[0], sf_idx); + ret = srslte_ue_dl_decode_mbsfn(&ue_dl, data, sf_idx); if(ret > 0) { printf("PMCH Decoded OK!\n"); } else if (ret < 0) { @@ -195,7 +199,9 @@ int main(int argc, char **argv) { } base_free(); - free(data[0]); + if (data != NULL) { + free(data); + } if (ret > 0) { exit(0); } else { From 77b3cc97cd5d6331efd02d7ae4e2bd9618412455 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Tue, 6 Feb 2018 17:46:27 +0000 Subject: [PATCH 12/12] Changing AMF value in user_db.csv to to have a separation bit of 1. --- srsepc/user_db.csv.example | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/srsepc/user_db.csv.example b/srsepc/user_db.csv.example index 89d0dedf1..4919ed6bb 100644 --- a/srsepc/user_db.csv.example +++ b/srsepc/user_db.csv.example @@ -10,4 +10,4 @@ # # Note: Lines starting by '#' are ignored ue1,001010123456789,00112233445566778899aabbccddeeff,63BFA50EE6523365FF14C1F45F88737D,9001 -ue2,001010123456780,00112233445566778899aabbccddeeaa,63BFA50EE6523365FF14C1F45F88737D,2000 +ue2,001010123456780,00112233445566778899aabbccddeeaa,63BFA50EE6523365FF14C1F45F88737D,8000