sched,bugfix&refactor: set dci_format before generating the remaining dci parameters in sched_ue::generate_dl_dci_format(...)

master
Francisco 4 years ago committed by Francisco Paisana
parent 77ac69796d
commit b869b0d8e2

@ -157,6 +157,12 @@ private:
bool needs_cqi(uint32_t tti, uint32_t enb_cc_idx, bool will_send = false); bool needs_cqi(uint32_t tti, uint32_t enb_cc_idx, bool will_send = false);
int generate_format1_common(uint32_t pid,
sched_interface::dl_sched_data_t* data,
tti_point tti_tx_dl,
uint32_t enb_cc_idx,
uint32_t cfi,
const rbgmask_t& user_mask);
int generate_format1(uint32_t pid, int generate_format1(uint32_t pid,
sched_interface::dl_sched_data_t* data, sched_interface::dl_sched_data_t* data,
tti_point tti_tx_dl, tti_point tti_tx_dl,

@ -370,6 +370,13 @@ int sched_ue::generate_dl_dci_format(uint32_t pid,
srslte_dci_format_t dci_format = get_dci_format(); srslte_dci_format_t dci_format = get_dci_format();
int tbs_bytes = 0; int tbs_bytes = 0;
// Set common DCI fields
srslte_dci_dl_t* dci = &data->dci;
dci->rnti = rnti;
dci->pid = pid;
dci->ue_cc_idx = cells[enb_cc_idx].get_ue_cc_idx();
dci->format = dci_format;
switch (dci_format) { switch (dci_format) {
case SRSLTE_DCI_FORMAT1A: case SRSLTE_DCI_FORMAT1A:
tbs_bytes = generate_format1a(pid, data, tti_tx_dl, enb_cc_idx, cfi, user_mask); tbs_bytes = generate_format1a(pid, data, tti_tx_dl, enb_cc_idx, cfi, user_mask);
@ -387,14 +394,9 @@ int sched_ue::generate_dl_dci_format(uint32_t pid,
logger.error("DCI format (%d) not implemented", dci_format); logger.error("DCI format (%d) not implemented", dci_format);
} }
// Set common DCI fields // If allocation successful, encode TPC
if (tbs_bytes > 0) { if (tbs_bytes > 0) {
srslte_dci_dl_t* dci = &data->dci; dci->tpc_pucch = cells[enb_cc_idx].tpc_fsm.encode_pucch_tpc();
dci->rnti = rnti;
dci->pid = pid;
dci->ue_cc_idx = cells[enb_cc_idx].get_ue_cc_idx();
data->dci.format = dci_format;
dci->tpc_pucch = cells[enb_cc_idx].tpc_fsm.encode_pucch_tpc();
} }
return tbs_bytes; return tbs_bytes;
@ -407,8 +409,6 @@ int sched_ue::generate_format1a(uint32_t pid,
uint32_t cfi, uint32_t cfi,
const rbgmask_t& user_mask) const rbgmask_t& user_mask)
{ {
int tbs_bytes = generate_format1(pid, data, tti_tx_dl, enb_cc_idx, cfi, user_mask);
srslte_dci_dl_t* dci = &data->dci; srslte_dci_dl_t* dci = &data->dci;
dci->alloc_type = SRSLTE_RA_ALLOC_TYPE2; dci->alloc_type = SRSLTE_RA_ALLOC_TYPE2;
@ -423,28 +423,24 @@ int sched_ue::generate_format1a(uint32_t pid,
logger.warning("SCHED: Can't use distributed RA due to DCI size ambiguity"); logger.warning("SCHED: Can't use distributed RA due to DCI size ambiguity");
} }
return tbs_bytes; return generate_format1_common(pid, data, tti_tx_dl, enb_cc_idx, cfi, user_mask);
} }
// > return 0 if allocation is invalid int sched_ue::generate_format1_common(uint32_t pid,
int sched_ue::generate_format1(uint32_t pid, sched_interface::dl_sched_data_t* data,
sched_interface::dl_sched_data_t* data, tti_point tti_tx_dl,
tti_point tti_tx_dl, uint32_t enb_cc_idx,
uint32_t enb_cc_idx, uint32_t cfi,
uint32_t cfi, const rbgmask_t& user_mask)
const rbgmask_t& user_mask)
{ {
dl_harq_proc* h = &cells[enb_cc_idx].harq_ent.dl_harq_procs()[pid]; dl_harq_proc* h = &cells[enb_cc_idx].harq_ent.dl_harq_procs()[pid];
srslte_dci_dl_t* dci = &data->dci; srslte_dci_dl_t* dci = &data->dci;
dci->alloc_type = SRSLTE_RA_ALLOC_TYPE0;
dci->type0_alloc.rbg_bitmask = (uint32_t)user_mask.to_uint64();
tbs_info tbinfo; tbs_info tbinfo;
if (h->is_empty(0)) { if (h->is_empty(0)) {
tbinfo = allocate_new_dl_mac_pdu(data, h, user_mask, tti_tx_dl, enb_cc_idx, cfi, 0); tbinfo = allocate_new_dl_mac_pdu(data, h, user_mask, tti_tx_dl, enb_cc_idx, cfi, 0);
} else { } else {
h->new_retx(user_mask, 0, tti_tx_dl, &tbinfo.mcs, &tbinfo.tbs_bytes, data->dci.location.ncce); h->new_retx(user_mask, 0, tti_tx_dl, &tbinfo.mcs, &tbinfo.tbs_bytes, dci->location.ncce);
logger.debug("SCHED: Alloc format1 previous mcs=%d, tbs=%d", tbinfo.mcs, tbinfo.tbs_bytes); logger.debug("SCHED: Alloc format1 previous mcs=%d, tbs=%d", tbinfo.mcs, tbinfo.tbs_bytes);
} }
@ -459,6 +455,21 @@ int sched_ue::generate_format1(uint32_t pid,
return tbinfo.tbs_bytes; return tbinfo.tbs_bytes;
} }
int sched_ue::generate_format1(uint32_t pid,
sched_interface::dl_sched_data_t* data,
tti_point tti_tx_dl,
uint32_t enb_cc_idx,
uint32_t cfi,
const rbgmask_t& user_mask)
{
srslte_dci_dl_t* dci = &data->dci;
dci->alloc_type = SRSLTE_RA_ALLOC_TYPE0;
dci->type0_alloc.rbg_bitmask = (uint32_t)user_mask.to_uint64();
return generate_format1_common(pid, data, tti_tx_dl, enb_cc_idx, cfi, user_mask);
}
/** /**
* Based on the amount of tx data, allocated PRBs, DCI params, etc. compute a valid MCS and resulting TBS * Based on the amount of tx data, allocated PRBs, DCI params, etc. compute a valid MCS and resulting TBS
* @param enb_cc_idx user carrier index * @param enb_cc_idx user carrier index

Loading…
Cancel
Save