Fixed incorrect scheduling with PUCCH

master
Ismael Gomez 7 years ago
parent 7c081c695a
commit cc6546db18

@ -113,9 +113,6 @@ public:
private: private:
void log_step_ul(uint32_t tti);
void log_step_dl(uint32_t tti);
static const int MAX_LOCATIONS = 20; static const int MAX_LOCATIONS = 20;
static const uint32_t cfi = 3; static const uint32_t cfi = 3;
srslte_dci_location_t locations[MAX_LOCATIONS]; srslte_dci_location_t locations[MAX_LOCATIONS];

@ -42,7 +42,6 @@ public:
// used by sched_metric // used by sched_metric
uint32_t ue_idx; uint32_t ue_idx;
bool has_pusch;
bool has_pucch; bool has_pucch;
typedef struct { typedef struct {
@ -116,7 +115,7 @@ public:
bool needs_cqi(uint32_t tti, bool will_send = false); bool needs_cqi(uint32_t tti, bool will_send = false);
uint32_t get_max_retx(); uint32_t get_max_retx();
bool get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2], uint32_t *L); bool get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2]);
bool pucch_sr_collision(uint32_t current_tti, uint32_t n_cce); bool pucch_sr_collision(uint32_t current_tti, uint32_t n_cce);
uint32_t get_pending_ul_old_data(); uint32_t get_pending_ul_old_data();

@ -403,7 +403,7 @@ int mac::rach_detected(uint32_t tti, uint32_t preamble_idx, uint32_t time_adv)
int mac::get_dl_sched(uint32_t tti, dl_sched_t *dl_sched_res) int mac::get_dl_sched(uint32_t tti, dl_sched_t *dl_sched_res)
{ {
log_step_dl(tti); log_h->step(tti);
if (!started) { if (!started) {
return 0; return 0;
@ -545,7 +545,7 @@ uint8_t* mac::assemble_si(uint32_t index)
int mac::get_ul_sched(uint32_t tti, ul_sched_t *ul_sched_res) int mac::get_ul_sched(uint32_t tti, ul_sched_t *ul_sched_res)
{ {
log_step_ul(tti); log_h->step(tti);
if (!started) { if (!started) {
return 0; return 0;
@ -602,24 +602,6 @@ int mac::get_ul_sched(uint32_t tti, ul_sched_t *ul_sched_res)
return SRSLTE_SUCCESS; return SRSLTE_SUCCESS;
} }
void mac::log_step_ul(uint32_t tti)
{
int tti_ul = tti-8;
if (tti_ul < 0) {
tti_ul += 10240;
}
log_h->step(tti_ul);
}
void mac::log_step_dl(uint32_t tti)
{
int tti_dl = tti-4;
if (tti_dl < 0) {
tti_dl += 10240;
}
log_h->step(tti_dl);
}
void mac::tti_clock() void mac::tti_clock()
{ {
timers_thread.tti_clock(); timers_thread.tti_clock();

@ -700,7 +700,6 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
sched_ue *user = (sched_ue*) &iter->second; sched_ue *user = (sched_ue*) &iter->second;
uint16_t rnti = (uint16_t) iter->first; uint16_t rnti = (uint16_t) iter->first;
user->has_pusch = false;
user->has_pucch = false; user->has_pucch = false;
ul_harq_proc *h = user->get_ul_harq(current_tti); ul_harq_proc *h = user->get_ul_harq(current_tti);
@ -726,18 +725,15 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
sched_ue *user = (sched_ue*) &iter->second; sched_ue *user = (sched_ue*) &iter->second;
uint16_t rnti = (uint16_t) iter->first; uint16_t rnti = (uint16_t) iter->first;
uint32_t prb_idx[2] = {0, 0}; uint32_t prb_idx[2] = {0, 0};
uint32_t L = 0; if (user->get_pucch_sched(current_tti, prb_idx)) {
if (user->get_pucch_sched(current_tti, prb_idx, &L)) {
user->has_pucch = true; user->has_pucch = true;
// allocate PUCCH if no PUSCH for user // allocate PUCCH
if (!user->has_pusch) {
for (int i=0;i<2;i++) { for (int i=0;i<2;i++) {
ul_harq_proc::ul_alloc_t pucch = {prb_idx[i], L}; ul_harq_proc::ul_alloc_t pucch = {prb_idx[i], 1};
ul_metric->update_allocation(pucch); ul_metric->update_allocation(pucch);
} }
} }
} }
}
// Now allocate PUSCH // Now allocate PUSCH
for(std::map<uint16_t, sched_ue>::iterator iter=ue_db.begin(); iter!=ue_db.end(); ++iter) { for(std::map<uint16_t, sched_ue>::iterator iter=ue_db.begin(); iter!=ue_db.end(); ++iter) {
@ -807,22 +803,22 @@ int sched::ul_sched(uint32_t tti, srsenb::sched_interface::ul_sched_res_t* sched
user->unset_sr(); user->unset_sr();
} }
log_h->info("SCHED: %s %s rnti=0x%x, pid=%d, dci=%d,%d, grant=%d,%d, n_rtx=%d, tbs=%d, bsr=%d (%d-%d)\n", log_h->info("SCHED: %s %s rnti=0x%x, pid=%d, dci=%d,%d, grant=(%d,%d), n_rtx=%d, tbs=%d, bsr=%d (%d-%d)\n",
is_rar?"RAR":"UL", is_rar?"RAR":"UL",
is_newtx?"tx":"retx", is_newtx?"tx":"retx",
rnti, h->get_id(), rnti, h->get_id(),
sched_result->pusch[nof_dci_elems].dci_location.L, sched_result->pusch[nof_dci_elems].dci_location.ncce, sched_result->pusch[nof_dci_elems].dci_location.L, sched_result->pusch[nof_dci_elems].dci_location.ncce,
alloc.RB_start, alloc.L, h->nof_retx(), sched_result->pusch[nof_dci_elems].tbs, alloc.RB_start, alloc.RB_start+alloc.L, h->nof_retx(), sched_result->pusch[nof_dci_elems].tbs,
user->get_pending_ul_new_data(current_tti),pending_data_before, user->get_pending_ul_old_data()); user->get_pending_ul_new_data(current_tti),pending_data_before, user->get_pending_ul_old_data());
nof_dci_elems++; nof_dci_elems++;
} else { } else {
log_h->warning("SCHED: Error %s %s rnti=0x%x, pid=%d, dci=%d,%d, grant=%d,%d, tbs=%d, bsr=%d\n", log_h->warning("SCHED: Error %s %s rnti=0x%x, pid=%d, dci=%d,%d, grant=(%d,%d), tbs=%d, bsr=%d\n",
is_rar?"RAR":"UL", is_rar?"RAR":"UL",
is_newtx?"tx":"retx", is_newtx?"tx":"retx",
rnti, h->get_id(), rnti, h->get_id(),
sched_result->pusch[nof_dci_elems].dci_location.L, sched_result->pusch[nof_dci_elems].dci_location.ncce, sched_result->pusch[nof_dci_elems].dci_location.L, sched_result->pusch[nof_dci_elems].dci_location.ncce,
alloc.RB_start, alloc.L, sched_result->pusch[nof_dci_elems].tbs, alloc.RB_start, alloc.RB_start+alloc.L, sched_result->pusch[nof_dci_elems].tbs,
user->get_pending_ul_new_data(current_tti)); user->get_pending_ul_new_data(current_tti));
} }
} }

@ -25,8 +25,7 @@
*/ */
#include <string.h> #include <string.h>
#include "mac/scheduler_harq.h"
#include "srslte/srslte.h"
#include "mac/scheduler_metric.h" #include "mac/scheduler_metric.h"
#define Error(fmt, ...) log_h->error_line(__FILE__, __LINE__, fmt, ##__VA_ARGS__) #define Error(fmt, ...) log_h->error_line(__FILE__, __LINE__, fmt, ##__VA_ARGS__)
@ -215,7 +214,6 @@ void ul_metric_rr::new_tti(std::map<uint16_t,sched_ue> &ue_db, uint32_t nof_rb_,
sched_ue *user = (sched_ue*) &iter->second; sched_ue *user = (sched_ue*) &iter->second;
if (user->get_pending_ul_new_data(current_tti) || !user->get_ul_harq(current_tti)->is_empty()) { 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++; nof_users_with_data++;
} }
} }

@ -28,6 +28,7 @@
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
#include <srslte/interfaces/sched_interface.h> #include <srslte/interfaces/sched_interface.h>
#include <srslte/phy/phch/pucch.h> #include <srslte/phy/phch/pucch.h>
#include <srslte/srslte.h>
#include "srslte/srslte.h" #include "srslte/srslte.h"
#include "srslte/common/pdu.h" #include "srslte/common/pdu.h"
@ -232,7 +233,7 @@ bool sched_ue::pucch_sr_collision(uint32_t current_tti, uint32_t n_cce)
} }
} }
bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2], uint32_t *L) bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2])
{ {
if (!phy_config_dedicated_enabled) { if (!phy_config_dedicated_enabled) {
return false; return false;
@ -254,10 +255,8 @@ bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2], uint32
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_1A, n_pucch, cell.nof_prb, cell.cp, i); prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_1A, n_pucch, cell.nof_prb, cell.cp, i);
} }
} }
if (L) { Info("SCHED: Reserved Format1A PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d, ncce=%d, has_sr=%d, n_pucch_1=%d\n",
*L = 1; rnti, prb_idx[0], prb_idx[1], n_pucch, dl_harq[i].get_n_cce(), has_sr, pucch_sched.N_pucch_1);
}
Debug("SCHED: Reserved Format1A PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d\n", rnti, prb_idx[0], prb_idx[1], n_pucch);
return true; return true;
} }
} }
@ -268,10 +267,7 @@ bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2], uint32
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_1, cfg.sr_N_pucch, cell.nof_prb, cell.cp, i); prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_1, cfg.sr_N_pucch, cell.nof_prb, cell.cp, i);
} }
} }
if (L) { Info("SCHED: Reserved Format1 PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d\n", rnti, prb_idx[0], prb_idx[1], cfg.sr_N_pucch);
*L = 1;
}
Debug("SCHED: Reserved Format1 PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d\n", rnti, prb_idx[0], prb_idx[1], cfg.sr_N_pucch);
return true; return true;
} }
// Finally check Format2 (periodic CQI) // Finally check Format2 (periodic CQI)
@ -281,10 +277,7 @@ bool sched_ue::get_pucch_sched(uint32_t current_tti, uint32_t prb_idx[2], uint32
prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_2, cfg.cqi_pucch, cell.nof_prb, cell.cp, i); prb_idx[i] = srslte_pucch_n_prb(&cfg.pucch_cfg, SRSLTE_PUCCH_FORMAT_2, cfg.cqi_pucch, cell.nof_prb, cell.cp, i);
} }
} }
if(L) { Info("SCHED: Reserved Format2 PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d, pmi_idx=%d\n",
*L = 2;
}
Debug("SCHED: Reserved Format2 PUCCH for rnti=0x%x, n_prb=%d,%d, n_pucch=%d, pmi_idx=%d\n",
rnti, prb_idx[0], prb_idx[1], cfg.cqi_pucch, cfg.cqi_idx); rnti, prb_idx[0], prb_idx[1], cfg.cqi_pucch, cfg.cqi_idx);
return true; return true;
} }

@ -24,9 +24,10 @@
* *
*/ */
#include <srslte/interfaces/sched_interface.h> #include "srslte/interfaces/sched_interface.h"
#include <srslte/asn1/liblte_rrc.h> #include "srslte/asn1/liblte_rrc.h"
#include <upper/rrc.h> #include "upper/rrc.h"
#include "srslte/srslte.h"
#include "srslte/asn1/liblte_mme.h" #include "srslte/asn1/liblte_mme.h"
#include "upper/rrc.h" #include "upper/rrc.h"
@ -1177,6 +1178,7 @@ void rrc::ue::send_connection_setup(bool is_setup)
sched_cfg.pucch_cfg.delta_pucch_shift = liblte_rrc_delta_pucch_shift_num[parent->sib2.rr_config_common_sib.pucch_cnfg.delta_pucch_shift%LIBLTE_RRC_DELTA_PUCCH_SHIFT_N_ITEMS]; sched_cfg.pucch_cfg.delta_pucch_shift = liblte_rrc_delta_pucch_shift_num[parent->sib2.rr_config_common_sib.pucch_cnfg.delta_pucch_shift%LIBLTE_RRC_DELTA_PUCCH_SHIFT_N_ITEMS];
sched_cfg.pucch_cfg.N_cs = parent->sib2.rr_config_common_sib.pucch_cnfg.n_cs_an; sched_cfg.pucch_cfg.N_cs = parent->sib2.rr_config_common_sib.pucch_cnfg.n_cs_an;
sched_cfg.pucch_cfg.n_rb_2 = parent->sib2.rr_config_common_sib.pucch_cnfg.n_rb_cqi; sched_cfg.pucch_cfg.n_rb_2 = parent->sib2.rr_config_common_sib.pucch_cnfg.n_rb_cqi;
sched_cfg.pucch_cfg.n1_pucch_an = parent->sib2.rr_config_common_sib.pucch_cnfg.n1_pucch_an;
// Configure MAC // Configure MAC
parent->mac->ue_cfg(rnti, &sched_cfg); parent->mac->ue_cfg(rnti, &sched_cfg);

Loading…
Cancel
Save