From 4e8f0de6dae75d76a6ed6ed035f8d26812c4c5b3 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Mon, 4 Sep 2017 19:07:36 +0200 Subject: [PATCH] reduce PUSCH spectral efficiency if UCI is required --- srsenb/hdr/mac/scheduler_ue.h | 5 ++++- srsenb/src/mac/scheduler.cc | 15 +++++++++++---- srsenb/src/mac/scheduler_harq.cc | 2 +- srsenb/src/mac/scheduler_metric.cc | 3 ++- srsenb/src/mac/scheduler_ue.cc | 5 +++++ 5 files changed, 23 insertions(+), 7 deletions(-) diff --git a/srsenb/hdr/mac/scheduler_ue.h b/srsenb/hdr/mac/scheduler_ue.h index b95e5dda2..b59461140 100644 --- a/srsenb/hdr/mac/scheduler_ue.h +++ b/srsenb/hdr/mac/scheduler_ue.h @@ -40,7 +40,10 @@ class sched_ue { public: // used by sched_metric - uint32_t ue_idx; + uint32_t ue_idx; + + bool has_pusch; + bool has_pucch; typedef struct { uint32_t cce_start[4][6]; diff --git a/srsenb/src/mac/scheduler.cc b/srsenb/src/mac/scheduler.cc index 12a7ea1cc..73dbc2d41 100644 --- a/srsenb/src/mac/scheduler.cc +++ b/srsenb/src/mac/scheduler.cc @@ -691,7 +691,10 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched for(std::map::iterator iter=ue_db.begin(); iter!=ue_db.end(); ++iter) { sched_ue *user = (sched_ue*) &iter->second; uint16_t rnti = (uint16_t) iter->first; - + + user->has_pusch = false; + user->has_pucch = false; + ul_harq_proc *h = user->get_ul_harq(current_tti); /* Indicate PHICH acknowledgment if needed */ @@ -717,9 +720,13 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched uint32_t prb_idx[2] = {0, 0}; uint32_t L = 0; if (user->get_pucch_sched(current_tti, prb_idx, &L)) { - for (int i=0;i<2;i++) { - ul_harq_proc::ul_alloc_t pucch = {prb_idx[i], L}; - ul_metric->update_allocation(pucch); + user->has_pucch = true; + // allocate PUCCH if no PUSCH for user + if (!user->has_pusch) { + for (int i=0;i<2;i++) { + ul_harq_proc::ul_alloc_t pucch = {prb_idx[i], L}; + ul_metric->update_allocation(pucch); + } } } } diff --git a/srsenb/src/mac/scheduler_harq.cc b/srsenb/src/mac/scheduler_harq.cc index 009872153..a6ae70d19 100644 --- a/srsenb/src/mac/scheduler_harq.cc +++ b/srsenb/src/mac/scheduler_harq.cc @@ -100,7 +100,7 @@ void harq_proc::set_ack(bool ack_) ack = ack_; ack_received = true; log_h->debug("ACK=%d received pid=%d, n_rtx=%d, max_retx=%d\n", ack_, id, n_rtx, max_retx); - if (n_rtx >= max_retx) { + if (n_rtx + 1 >= max_retx) { Warning("SCHED: discarting TB pid=%d, tti=%d, maximum number of retx exceeded (%d)\n", id, tti, max_retx); active = false; } diff --git a/srsenb/src/mac/scheduler_metric.cc b/srsenb/src/mac/scheduler_metric.cc index 2a9a4432b..309eed45a 100644 --- a/srsenb/src/mac/scheduler_metric.cc +++ b/srsenb/src/mac/scheduler_metric.cc @@ -214,7 +214,8 @@ void ul_metric_rr::new_tti(std::map &ue_db, uint32_t nof_rb_, for(std::map::iterator iter=ue_db.begin(); iter!=ue_db.end(); ++iter) { sched_ue *user = (sched_ue*) &iter->second; if (user->get_pending_ul_new_data(current_tti) || !user->get_ul_harq(current_tti)->is_empty()) { - user->ue_idx = nof_users_with_data; + user->ue_idx = nof_users_with_data; + user->has_pusch = true; nof_users_with_data++; } } diff --git a/srsenb/src/mac/scheduler_ue.cc b/srsenb/src/mac/scheduler_ue.cc index 21aa61b19..4c6d467a2 100644 --- a/srsenb/src/mac/scheduler_ue.cc +++ b/srsenb/src/mac/scheduler_ue.cc @@ -813,6 +813,11 @@ int sched_ue::alloc_tbs(uint32_t nof_prb, uint32_t max_mcs = is_ul?max_mcs_ul:max_mcs_dl; uint32_t max_Qm = is_ul?4:6; // Allow 16-QAM in PUSCH Only + // TODO: Compute real spectral efficiency based on PUSCH-UCI configuration + if (has_pucch) { + cqi-=2; + } + 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 */