diff --git a/lib/src/phy/phch/pdsch.c b/lib/src/phy/phch/pdsch.c index 6479b5abd..1b3a3859d 100644 --- a/lib/src/phy/phch/pdsch.c +++ b/lib/src/phy/phch/pdsch.c @@ -555,11 +555,6 @@ static int srslte_pdsch_codeword_encode(srslte_pdsch_t *q, srslte_pdsch_cfg_t *c valid_inputs = false; } - if (!data) { - ERROR("Error encoding (TB%d -> CW%d), data=NULL", tb_idx, codeword_idx); - valid_inputs = false; - } - if (nbits->nof_bits && valid_inputs) { INFO("Encoding PDSCH SF: %d (TB%d -> CW%d), Mod %s, NofBits: %d, NofSymbols: %d, NofBitsE: %d, rv_idx: %d\n", cfg->sf_idx, tb_idx, codeword_idx, srslte_mod_string(mcs->mod), mcs->tbs, diff --git a/srsenb/src/mac/mac.cc b/srsenb/src/mac/mac.cc index 69ed37728..80c5e1ddf 100644 --- a/srsenb/src/mac/mac.cc +++ b/srsenb/src/mac/mac.cc @@ -476,10 +476,10 @@ int mac::get_dl_sched(uint32_t tti, dl_sched_t *dl_sched_res) memcpy(&dl_sched_res->sched_grants[n].location, &sched_result.data[i].dci_location, sizeof(srslte_dci_location_t)); for (uint32_t tb = 0; tb < SRSLTE_MAX_TB; tb++) { - if (sched_result.data[i].dci.tb_en[tb] && sched_result.data[i].nof_pdu_elems[tb] > 0) { - dl_sched_res->sched_grants[n].softbuffers[tb] = - ue_db[rnti]->get_tx_softbuffer(sched_result.data[i].dci.harq_process, tb); + dl_sched_res->sched_grants[n].softbuffers[tb] = + ue_db[rnti]->get_tx_softbuffer(sched_result.data[i].dci.harq_process, tb); + if (sched_result.data[i].nof_pdu_elems[tb] > 0) { /* Get PDU if it's a new transmission */ dl_sched_res->sched_grants[n].data[tb] = ue_db[rnti]->generate_pdu(sched_result.data[i].pdu[tb], sched_result.data[i].nof_pdu_elems[tb], @@ -496,12 +496,7 @@ int mac::get_dl_sched(uint32_t tti, dl_sched_t *dl_sched_res) } else { /* TB not enabled OR no data to send: set pointers to NULL */ - dl_sched_res->sched_grants[n].softbuffers[tb] = NULL; dl_sched_res->sched_grants[n].data[tb] = NULL; - if (sched_result.data[i].dci.tb_en[tb]) { - Warning("Transport block without PDU elements (rnti: %04x)\n", rnti); - sched_result.data[i].dci.tb_en[tb] = false; - } } } n++; diff --git a/srsenb/src/mac/scheduler_ue.cc b/srsenb/src/mac/scheduler_ue.cc index 1d84031a1..44c3d3185 100644 --- a/srsenb/src/mac/scheduler_ue.cc +++ b/srsenb/src/mac/scheduler_ue.cc @@ -513,6 +513,16 @@ int sched_ue::generate_format2a(dl_harq_proc *h, h->new_tx(tb, tti, mcs, tbs, data->dci_location.ncce); + int rem_tbs = tbs; + int x = 0; + do { + x = alloc_pdu(rem_tbs, &data->pdu[tb][data->nof_pdu_elems[tb]]); + rem_tbs -= x; + if (x) { + data->nof_pdu_elems[tb]++; + } + } while (rem_tbs > 0 && x > 0); + Debug("SCHED: Alloc format2/2a new mcs=%d, tbs=%d, nof_prb=%d, req_bytes=%d\n", mcs, tbs, nof_prb, req_bytes); } else { h->new_retx(tb, tti, &mcs, &tbs); @@ -520,19 +530,8 @@ int sched_ue::generate_format2a(dl_harq_proc *h, } } - int rem_tbs = tbs; - int x = 0; - do { - x = alloc_pdu(rem_tbs, &data->pdu[tb][data->nof_pdu_elems[tb]]); - rem_tbs -= x; - if (x) { - data->nof_pdu_elems[tb]++; - } - } while (rem_tbs > 0 && x > 0); - - data->rnti = rnti; - - if (tbs > 0 && data->nof_pdu_elems[tb]) { + /* Fill DCI TB dedicated fields */ + if (tbs > 0) { if (tb == 0) { dci->mcs_idx = (uint32_t) mcs; dci->rv_idx = sched::get_rvidx(h->nof_retx(tb)); @@ -556,6 +555,8 @@ int sched_ue::generate_format2a(dl_harq_proc *h, } } + /* Fill common fields */ + data->rnti = rnti; dci->harq_process = h->get_id(); dci->tpc_pucch = (uint8_t) next_tpc_pucch; next_tpc_pucch = 1;