fix scheduler issues for 6 PRBs

master
Andre Puschmann 6 years ago
parent 580ce3e298
commit 5a3fa7c305

@ -153,6 +153,7 @@ private:
rrc_interface_mac *rrc;
pthread_rwlock_t rwlock;
pthread_mutex_t sched_mutex;
cell_cfg_t cfg;
sched_args_t sched_cfg;

@ -34,6 +34,7 @@ namespace srsenb {
class dl_metric_rr : public sched::metric_dl
{
public:
//interface
void new_tti(std::map<uint16_t,sched_ue> &ue_db, uint32_t start_rbg, uint32_t nof_rbg, uint32_t nof_ctrl_symbols, uint32_t tti);
dl_harq_proc* get_user_allocation(sched_ue *user);
private:
@ -62,6 +63,7 @@ private:
class ul_metric_rr : public sched::metric_ul
{
public:
// interface
void new_tti(std::map<uint16_t,sched_ue> &ue_db, uint32_t nof_rb, uint32_t tti);
ul_harq_proc* get_user_allocation(sched_ue *user);
bool update_allocation(ul_harq_proc::ul_alloc_t alloc);

@ -64,6 +64,7 @@ sched::sched() : bc_aggr_level(0), rar_aggr_level(0), avail_rbg(0), P(0), start_
reset();
pthread_rwlock_init(&rwlock, NULL);
pthread_mutex_init(&sched_mutex, NULL);
}
sched::~sched()
@ -72,6 +73,7 @@ sched::~sched()
pthread_rwlock_wrlock(&rwlock);
pthread_rwlock_unlock(&rwlock);
pthread_rwlock_destroy(&rwlock);
pthread_mutex_destroy(&sched_mutex);
}
void sched::init(rrc_interface_mac *rrc_, srslte::log* log)
@ -773,6 +775,7 @@ int sched::dl_sched(uint32_t tti, sched_interface::dl_sched_res_t* sched_result)
rar_aggr_level = 2;
bzero(sched_result, sizeof(sched_interface::dl_sched_res_t));
pthread_mutex_lock(&sched_mutex);
pthread_rwlock_rdlock(&rwlock);
/* Schedule Broadcast data */
@ -785,6 +788,7 @@ int sched::dl_sched(uint32_t tti, sched_interface::dl_sched_res_t* sched_result)
sched_result->nof_data_elems += dl_sched_data(sched_result->data);
pthread_rwlock_unlock(&rwlock);
pthread_mutex_unlock(&sched_mutex);
/* Set CFI */
sched_result->cfi = current_cfi;
@ -822,12 +826,13 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
int nof_dci_elems = 0;
int nof_phich_elems = 0;
pthread_mutex_lock(&sched_mutex);
pthread_rwlock_rdlock(&rwlock);
// current_cfi is set in dl_sched()
bzero(sched_result, sizeof(sched_interface::ul_sched_res_t));
ul_metric->reset_allocation(cfg.cell.nof_prb);
pthread_rwlock_rdlock(&rwlock);
// Get HARQ process for this TTI
for(it_t iter=ue_db.begin(); iter!=ue_db.end(); ++iter) {
sched_ue *user = (sched_ue*) &iter->second;
@ -845,7 +850,19 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
}
}
// reserve PRBs for PRACH
if(srslte_prach_tti_opportunity_config(cfg.prach_config, tti, -1)) {
ul_harq_proc::ul_alloc_t prach = {cfg.prach_freq_offset, 6};
if(!ul_metric->update_allocation(prach)) {
log_h->warning("SCHED: Failed to allocate PRACH RBs within (%d,%d)\n", prach.RB_start, prach.RB_start + prach.L);
}
else {
log_h->debug("SCHED: Allocated PRACH RBs within (%d,%d)\n", prach.RB_start, prach.RB_start + prach.L);
}
}
// Update available allocation if there's a pending RAR
// NOTE: It has priority over PUCCH.
if (pending_msg3[tti%10].enabled) {
ul_harq_proc::ul_alloc_t msg3 = {pending_msg3[tti%10].n_prb, pending_msg3[tti%10].L};
if(ul_metric->update_allocation(msg3)) {
@ -860,14 +877,12 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
if (cfg.nrb_pucch >= 0) {
ul_harq_proc::ul_alloc_t pucch = {0, (uint32_t) cfg.nrb_pucch};
if(!ul_metric->update_allocation(pucch)) {
log_h->warning("SCHED: Failed to allocate PUCCH\n");
log_h->warning("SCHED: There was a collision with the PUCCH (%d, %d)\n", pucch.RB_start, pucch.RB_start+pucch.L);
}
pucch.RB_start = cfg.cell.nof_prb-cfg.nrb_pucch;
pucch.L = (uint32_t) cfg.nrb_pucch;
if(!ul_metric->update_allocation(pucch)) {
log_h->warning("SCHED: Failed to allocate PUCCH\n");
} else {
log_h->debug("Allocating PUCCH (%d,%d)\n", pucch.RB_start, pucch.RB_start+pucch.L);
log_h->warning("SCHED: There was a collision with the PUCCH (%d, %d)\n", pucch.RB_start, pucch.RB_start+pucch.L);
}
} else {
for(it_t iter=ue_db.begin(); iter!=ue_db.end(); ++iter) {
@ -885,17 +900,6 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
}
}
// reserve PRBs for PRACH
if(srslte_prach_tti_opportunity_config(cfg.prach_config, tti, -1)) {
ul_harq_proc::ul_alloc_t prach = {cfg.prach_freq_offset, 6};
if(!ul_metric->update_allocation(prach)) {
log_h->warning("SCHED: Failed to allocate PRACH RBs within (%d,%d)\n", prach.RB_start, prach.RB_start + prach.L);
}
else {
log_h->debug("SCHED: Allocated PRACH RBs within (%d,%d)\n", prach.RB_start, prach.RB_start + prach.L);
}
}
ul_metric->new_tti(ue_db, cfg.cell.nof_prb, current_tti);
// Now allocate PUSCH
@ -999,6 +1003,7 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
}
pthread_rwlock_unlock(&rwlock);
pthread_mutex_unlock(&sched_mutex);
sched_result->nof_dci_elems = nof_dci_elems;
sched_result->nof_phich_elems = nof_phich_elems;

@ -301,13 +301,14 @@ bool ul_metric_rr::new_allocation(uint32_t L, ul_harq_proc::ul_alloc_t* alloc)
bool ul_metric_rr::update_allocation(ul_harq_proc::ul_alloc_t alloc)
{
bool ret = false;
if(allocation_is_valid(alloc)) {
ret = true;
}
for (uint32_t n=alloc.RB_start;n<alloc.RB_start+alloc.L;n++) {
used_rb[n] = true;
}
return true;
}
return false;
return ret;
}
ul_harq_proc* ul_metric_rr::allocate_user_retx_prbs(sched_ue *user)

@ -102,6 +102,7 @@ void sched_ue::set_cfg(uint16_t rnti_, sched_interface::ue_cfg_t *cfg_, sched_in
sched::generate_cce_location(regs, &dci_locations[cfi][sf_idx], cfi+1, sf_idx, rnti);
}
}
pthread_mutex_unlock(&mutex);
for (int i=0;i<sched_interface::MAX_LC;i++) {
@ -1209,7 +1210,6 @@ int sched_ue::alloc_tbs(uint32_t nof_prb,
uint32_t max_Qm = is_ul?4:6; // Allow 16-QAM in PUSCH Only
// TODO: Compute real spectral efficiency based on PUSCH-UCI configuration
int tbs = cqi_to_tbs(cqi, nof_prb, nof_re, max_mcs, max_Qm, &sel_mcs)/8;
/* If less bytes are requested, lower the MCS */

Loading…
Cancel
Save