fix buggy TBS function for SIB and set additional candidate for common search space
This commit is contained in:
@@ -274,72 +274,71 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, slot_t slotP, nfapi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t get_tbs(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
|
static uint32_t get_tbs_bch(NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config,
|
||||||
NR_sched_pdsch_t *pdsch,
|
NR_sched_pdsch_t *pdsch,
|
||||||
uint32_t num_total_bytes,
|
uint32_t num_total_bytes,
|
||||||
uint16_t *vrb_map)
|
uint16_t *vrb_map)
|
||||||
{
|
{
|
||||||
NR_tda_info_t *tda_info = &pdsch->tda_info;
|
NR_tda_info_t *tda_info = &pdsch->tda_info;
|
||||||
|
|
||||||
const uint16_t bwpSize = type0_PDCCH_CSS_config->num_rbs;
|
|
||||||
int rbStart = type0_PDCCH_CSS_config->cset_start_rb;
|
|
||||||
|
|
||||||
// Calculate number of PRB_DMRS
|
// Calculate number of PRB_DMRS
|
||||||
uint8_t N_PRB_DMRS = pdsch->dmrs_parms.N_PRB_DMRS;
|
uint8_t N_PRB_DMRS = pdsch->dmrs_parms.N_PRB_DMRS;
|
||||||
uint16_t dmrs_length = pdsch->dmrs_parms.N_DMRS_SLOT;
|
|
||||||
LOG_D(MAC, "dlDmrsSymbPos %x\n", pdsch->dmrs_parms.dl_dmrs_symb_pos);
|
LOG_D(MAC, "dlDmrsSymbPos %x\n", pdsch->dmrs_parms.dl_dmrs_symb_pos);
|
||||||
int mcsTableIdx = 0;
|
int mcsTableIdx = 0;
|
||||||
int rbSize = 0;
|
|
||||||
uint32_t TBS = 0;
|
uint32_t TBS = 0;
|
||||||
do {
|
const uint16_t slbitmap = SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols);
|
||||||
if (rbSize < bwpSize && !(vrb_map[rbStart + rbSize] & SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols)))
|
int bwpSize = type0_PDCCH_CSS_config->num_rbs;
|
||||||
rbSize++;
|
int bwpStart = type0_PDCCH_CSS_config->cset_start_rb;
|
||||||
|
int rbStop = bwpSize - 1;
|
||||||
|
int rbStart = 0;
|
||||||
|
uint16_t rbSize = 0;
|
||||||
|
while (rbStart < rbStop) {
|
||||||
|
if (vrb_map[rbStart + bwpStart] & slbitmap)
|
||||||
|
rbStart++;
|
||||||
else {
|
else {
|
||||||
if (pdsch->mcs < 10)
|
int max_rbSize = 0;
|
||||||
pdsch->mcs++;
|
while (rbStart + max_rbSize <= rbStop && !(vrb_map[rbStart + max_rbSize + bwpStart] & slbitmap))
|
||||||
else
|
max_rbSize++;
|
||||||
break;
|
|
||||||
}
|
|
||||||
TBS = nr_compute_tbs(nr_get_Qm_dl(pdsch->mcs, mcsTableIdx),
|
|
||||||
nr_get_code_rate_dl(pdsch->mcs, mcsTableIdx),
|
|
||||||
rbSize,
|
|
||||||
tda_info->nrOfSymbols,
|
|
||||||
N_PRB_DMRS * dmrs_length,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
1)
|
|
||||||
>> 3;
|
|
||||||
} while (TBS < num_total_bytes);
|
|
||||||
|
|
||||||
if (TBS < num_total_bytes) {
|
bool res = false;
|
||||||
for (int rb = 0; rb < bwpSize; rb++)
|
while (res == false && pdsch->mcs < 10) {
|
||||||
LOG_I(NR_MAC, "vrb_map[%d] %x\n", rbStart + rb, vrb_map[rbStart + rb]);
|
res = nr_find_nb_rb(nr_get_Qm_dl(pdsch->mcs, mcsTableIdx),
|
||||||
|
nr_get_code_rate_dl(pdsch->mcs, mcsTableIdx),
|
||||||
|
1, // no transform precoding for DL
|
||||||
|
1, // single layer
|
||||||
|
tda_info->nrOfSymbols,
|
||||||
|
pdsch->dmrs_parms.N_PRB_DMRS * pdsch->dmrs_parms.N_DMRS_SLOT,
|
||||||
|
num_total_bytes,
|
||||||
|
1, // min_rbSize
|
||||||
|
max_rbSize,
|
||||||
|
&TBS,
|
||||||
|
&rbSize);
|
||||||
|
if (!res)
|
||||||
|
pdsch->mcs++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
AssertFatal(
|
AssertFatal(TBS >= num_total_bytes,
|
||||||
TBS >= num_total_bytes,
|
"Couldn't allocate enough resources for %d bytes in SIB PDSCH (rbStart %d, rbSize %d, bwpSize %d)\n",
|
||||||
"Couldn't allocate enough resources for %d bytes in SIB PDSCH (rbStart %d, rbSize %d, bwpSize %d SLmask %x - [%d,%d])\n",
|
num_total_bytes,
|
||||||
num_total_bytes,
|
rbStart,
|
||||||
rbStart,
|
rbSize,
|
||||||
rbSize,
|
bwpSize);
|
||||||
bwpSize,
|
|
||||||
SL_to_bitmap(tda_info->startSymbolIndex, tda_info->nrOfSymbols),
|
|
||||||
tda_info->startSymbolIndex,
|
|
||||||
tda_info->nrOfSymbols);
|
|
||||||
|
|
||||||
pdsch->rbSize = rbSize;
|
pdsch->rbSize = rbSize;
|
||||||
pdsch->rbStart = 0;
|
pdsch->rbStart = rbStart;
|
||||||
|
|
||||||
LOG_D(
|
LOG_D(NR_MAC,
|
||||||
NR_MAC,
|
"mcs=%i, startSymbolIndex = %i, nrOfSymbols = %i, rbSize = %i, TBS = %i, dmrs_length %d, N_PRB_DMRS = %d, mappingtype = %d\n",
|
||||||
"mcs=%i, startSymbolIndex = %i, nrOfSymbols = %i, rbSize = %i, TBS = %i, dmrs_length %d, N_PRB_DMRS = %d, mappingtype = %d\n",
|
pdsch->mcs,
|
||||||
pdsch->mcs,
|
tda_info->startSymbolIndex,
|
||||||
tda_info->startSymbolIndex,
|
tda_info->nrOfSymbols,
|
||||||
tda_info->nrOfSymbols,
|
rbSize,
|
||||||
pdsch->rbSize,
|
TBS,
|
||||||
TBS,
|
pdsch->dmrs_parms.N_DMRS_SLOT,
|
||||||
dmrs_length,
|
N_PRB_DMRS,
|
||||||
N_PRB_DMRS,
|
tda_info->mapping_type);
|
||||||
tda_info->mapping_type);
|
|
||||||
return TBS;
|
return TBS;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,7 +381,10 @@ static uint32_t schedule_control_sib1(module_id_t module_id,
|
|||||||
|
|
||||||
AssertFatal(gNB_mac->sched_ctrlCommon->cce_index >= 0, "Could not find CCE for coreset0\n");
|
AssertFatal(gNB_mac->sched_ctrlCommon->cce_index >= 0, "Could not find CCE for coreset0\n");
|
||||||
|
|
||||||
uint32_t TBS = get_tbs(type0_PDCCH_CSS_config, &gNB_mac->sched_ctrlCommon->sched_pdsch, gNB_mac->sched_ctrlCommon->num_total_bytes, vrb_map);
|
uint32_t TBS = get_tbs_bch(type0_PDCCH_CSS_config,
|
||||||
|
&gNB_mac->sched_ctrlCommon->sched_pdsch,
|
||||||
|
gNB_mac->sched_ctrlCommon->num_total_bytes,
|
||||||
|
vrb_map);
|
||||||
|
|
||||||
// Mark the corresponding RBs as used
|
// Mark the corresponding RBs as used
|
||||||
fill_pdcch_vrb_map(gNB_mac,
|
fill_pdcch_vrb_map(gNB_mac,
|
||||||
@@ -755,7 +757,7 @@ static void other_sib_sched_control(module_id_t module_idP,
|
|||||||
uint16_t *vrb_map = cc->vrb_map[beam.idx];
|
uint16_t *vrb_map = cc->vrb_map[beam.idx];
|
||||||
uint8_t *sib_bcch_pdu = cc->other_sib_bcch_pdu[payload_idx];
|
uint8_t *sib_bcch_pdu = cc->other_sib_bcch_pdu[payload_idx];
|
||||||
int num_total_bytes = cc->other_sib_bcch_length[payload_idx];
|
int num_total_bytes = cc->other_sib_bcch_length[payload_idx];
|
||||||
uint32_t TBS = get_tbs(type0_PDCCH_CSS_config, &sched_pdsch_otherSI, num_total_bytes, vrb_map);
|
uint32_t TBS = get_tbs_bch(type0_PDCCH_CSS_config, &sched_pdsch_otherSI, num_total_bytes, vrb_map);
|
||||||
|
|
||||||
for (int rb = 0; rb < sched_pdsch_otherSI.rbSize; rb++) {
|
for (int rb = 0; rb < sched_pdsch_otherSI.rbSize; rb++) {
|
||||||
vrb_map[rb + type0_PDCCH_CSS_config->cset_start_rb] |= SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols);
|
vrb_map[rb + type0_PDCCH_CSS_config->cset_start_rb] |= SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols);
|
||||||
|
|||||||
@@ -277,7 +277,6 @@ NR_SearchSpace_t *rrc_searchspace_config(bool is_common,
|
|||||||
ss->nrofCandidates->aggregationLevel4 = num_agg_level_candidates[PDCCH_AGG_LEVEL4];
|
ss->nrofCandidates->aggregationLevel4 = num_agg_level_candidates[PDCCH_AGG_LEVEL4];
|
||||||
ss->nrofCandidates->aggregationLevel8 = num_agg_level_candidates[PDCCH_AGG_LEVEL8];
|
ss->nrofCandidates->aggregationLevel8 = num_agg_level_candidates[PDCCH_AGG_LEVEL8];
|
||||||
ss->nrofCandidates->aggregationLevel16 = num_agg_level_candidates[PDCCH_AGG_LEVEL16];
|
ss->nrofCandidates->aggregationLevel16 = num_agg_level_candidates[PDCCH_AGG_LEVEL16];
|
||||||
|
|
||||||
ss->searchSpaceType = calloc(1,sizeof(*ss->searchSpaceType));
|
ss->searchSpaceType = calloc(1,sizeof(*ss->searchSpaceType));
|
||||||
if (is_common) {
|
if (is_common) {
|
||||||
ss->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
|
ss->searchSpaceType->present = NR_SearchSpace__searchSpaceType_PR_common;
|
||||||
|
|||||||
Reference in New Issue
Block a user