diff --git a/srsenb/src/mac/mac.cc b/srsenb/src/mac/mac.cc index 580201add..d16279f15 100644 --- a/srsenb/src/mac/mac.cc +++ b/srsenb/src/mac/mac.cc @@ -464,10 +464,6 @@ int mac::rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv) { log_h->step(tti); - int ret = -1; - - pthread_rwlock_rdlock(&rwlock); - // Find empty slot for pending rars uint32_t ra_id=0; while(pending_rars[ra_id].temp_crnti && ra_idconfig(last_rnti, cell.nof_prb, &scheduler, rrc_h, rlc_h, log_h); @@ -486,6 +484,9 @@ int mac::rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv) if (pcap) { ue_db[last_rnti]->start_pcap(pcap); } + + pthread_rwlock_unlock(&rwlock); + // Save RA info pending_rars[ra_id].preamble_idx = preamble_idx; pending_rars[ra_id].ta_cmd = 2*time_adv; @@ -499,7 +500,7 @@ int mac::rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv) // Release pending RAR bzero(&pending_rars[ra_id], sizeof(pending_rar_t)); Error("Registering new user rnti=0x%x to SCHED\n", last_rnti); - goto unlock; + return -1; } // Register new user in RRC @@ -517,11 +518,7 @@ int mac::rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv) if (last_rnti >= 60000) { last_rnti = 70; } - ret = 0; - -unlock: - pthread_rwlock_unlock(&rwlock); - return ret; + return 0; } int mac::get_dl_sched(uint32_t tti, dl_sched_t *dl_sched_res) diff --git a/srsenb/src/mac/scheduler.cc b/srsenb/src/mac/scheduler.cc index 026c85559..4bebfb3d9 100644 --- a/srsenb/src/mac/scheduler.cc +++ b/srsenb/src/mac/scheduler.cc @@ -975,6 +975,10 @@ void sched::generate_cce_location(srslte_regs_t *regs_, sched_ue::sched_dci_cce_ bool sched::generate_dci(srslte_dci_location_t *sched_location, sched_ue::sched_dci_cce_t *locations, uint32_t aggr_level, sched_ue *user) { + if (!locations->nof_loc[aggr_level]) { + Error("In generate_dci(): No locations for aggr_level=%d\n", aggr_level); + return false; + } uint32_t nof_cand = 0; uint32_t test_cand = rand()%locations->nof_loc[aggr_level]; bool allocated=false; diff --git a/srsenb/src/mac/scheduler_ue.cc b/srsenb/src/mac/scheduler_ue.cc index d96cbdda2..c4cc38e48 100644 --- a/srsenb/src/mac/scheduler_ue.cc +++ b/srsenb/src/mac/scheduler_ue.cc @@ -990,7 +990,6 @@ bool sched_ue::is_sr_triggered() void sched_ue::reset_timeout_dl_harq(uint32_t tti) { for (int i=0;iinfo("SCHED: pid=%d is empty\n", i); if (srslte_tti_interval(tti, dl_harq[i].get_tti()) > 50) { log_h->info("SCHED: pid=%d is old. tti_pid=%d, now is %d, resetting\n", i, dl_harq[i].get_tti(), tti); dl_harq[i].reset(0);