symbol level occupation for ULSCH and msg3
This commit is contained in:
@@ -729,6 +729,8 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t
|
||||
int scs = scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.subcarrierSpacing;
|
||||
int fh = 0;
|
||||
int startSymbolAndLength = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->startSymbolAndLength;
|
||||
int StartSymbolIndex, NrOfSymbols;
|
||||
SLIV2SL(startSymbolAndLength, &StartSymbolIndex, &NrOfSymbols);
|
||||
int mappingtype = scc->uplinkConfigCommon->initialUplinkBWP->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[ra->Msg3_tda_id]->mappingType;
|
||||
|
||||
uint16_t *vrb_map_UL = &RC.nrmac[module_idP]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE];
|
||||
@@ -737,7 +739,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t
|
||||
int BWPSize = nr_mac->type0_PDCCH_CSS_config[ra->beam_id].num_rbs;
|
||||
int rbStart = 0;
|
||||
for (int i = 0; (i < ra->msg3_nb_rb) && (rbStart <= (BWPSize - ra->msg3_nb_rb)); i++) {
|
||||
if (vrb_map_UL[rbStart + BWPStart + i]) {
|
||||
if (vrb_map_UL[rbStart + BWPStart + i]&startandlength_to_bitmat(StartSymbolIndex, NrOfSymbols)) {
|
||||
rbStart += i;
|
||||
i = 0;
|
||||
}
|
||||
@@ -842,7 +844,7 @@ void nr_generate_Msg3_retransmission(module_id_t module_idP, int CC_id, frame_t
|
||||
|
||||
// Mark the corresponding RBs as used
|
||||
for (int rb = 0; rb < ra->msg3_nb_rb; rb++) {
|
||||
vrb_map_UL[rbStart + BWPStart + rb] = 1;
|
||||
vrb_map_UL[rbStart + BWPStart + rb] |= startandlength_to_bitmat(StartSymbolIndex, NrOfSymbols);
|
||||
}
|
||||
|
||||
// reset state to wait msg3
|
||||
@@ -891,6 +893,8 @@ void nr_get_Msg3alloc(module_id_t module_id,
|
||||
ra->Msg3_slot = temp_slot%nr_slots_per_frame[mu];
|
||||
if (is_xlsch_in_slot(RC.nrmac[module_id]->ulsch_slot_bitmap[ra->Msg3_slot / 64], ra->Msg3_slot)) {
|
||||
ra->Msg3_tda_id = i;
|
||||
ra->msg3_startsymb = StartSymbolIndex;
|
||||
ra->msg3_nrsymb = NrOfSymbols;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -938,11 +942,12 @@ void nr_get_Msg3alloc(module_id_t module_id,
|
||||
while (rbSize < msg3_nb_rb) {
|
||||
rbStart += rbSize; /* last iteration rbSize was not enough, skip it */
|
||||
rbSize = 0;
|
||||
while (rbStart < bwpSize && vrb_map_UL[rbStart + bwpStart])
|
||||
while (rbStart < bwpSize &&
|
||||
(vrb_map_UL[rbStart + bwpStart]&startandlength_to_bitmat(StartSymbolIndex, NrOfSymbols)))
|
||||
rbStart++;
|
||||
AssertFatal(rbStart < bwpSize - msg3_nb_rb, "no space to allocate Msg 3 for RA!\n");
|
||||
while (rbStart + rbSize < bwpSize
|
||||
&& !vrb_map_UL[rbStart + bwpStart + rbSize]
|
||||
&& !(vrb_map_UL[rbStart + bwpStart + rbSize]&startandlength_to_bitmat(StartSymbolIndex, NrOfSymbols))
|
||||
&& rbSize < msg3_nb_rb)
|
||||
rbSize++;
|
||||
}
|
||||
@@ -1039,7 +1044,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
|
||||
i + ra->msg3_first_rb,
|
||||
ra->Msg3_frame,
|
||||
ra->Msg3_slot);
|
||||
vrb_map_UL[i + ra->msg3_first_rb + ra->msg3_bwp_start] = 1;
|
||||
vrb_map_UL[i + ra->msg3_first_rb + ra->msg3_bwp_start] |= startandlength_to_bitmat(ra->msg3_startsymb, ra->msg3_nrsymb);
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC, "[gNB %d][RAPROC] Frame %d, Slot %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot);
|
||||
|
||||
@@ -473,9 +473,8 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
|
||||
uint16_t *vrb_map_UL =
|
||||
&RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[sched_slot * MAX_BWP_SIZE];
|
||||
const uint16_t symb = ((1 << ps->nrOfSymbols) - 1) << ps->startSymbolIndex;
|
||||
for (int i = rbStart; i < rbStart + rbSize; ++i) {
|
||||
if ((vrb_map_UL[i+BWPStart] & symb) != 0) {
|
||||
if ((vrb_map_UL[i+BWPStart] & startandlength_to_bitmat(ps->startSymbolIndex, ps->nrOfSymbols)) != 0) {
|
||||
LOG_E(MAC,
|
||||
"%s(): %4d.%2d RB %d is already reserved, cannot schedule UE\n",
|
||||
__func__,
|
||||
@@ -544,6 +543,6 @@ bool nr_ul_preprocessor_phytest(module_id_t module_id, frame_t frame, sub_frame_
|
||||
|
||||
/* mark the corresponding RBs as used */
|
||||
for (int rb = rbStart; rb < rbStart + rbSize; rb++)
|
||||
vrb_map_UL[rb+BWPStart] = 1;
|
||||
vrb_map_UL[rb+BWPStart] |= startandlength_to_bitmat(ps->startSymbolIndex, ps->nrOfSymbols);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -938,13 +938,6 @@ bool allocate_ul_retransmission(module_id_t module_id,
|
||||
LOG_D(NR_MAC,"retInfo->time_domain_allocation = %d, tda = %d\n", retInfo->time_domain_allocation, tda);
|
||||
LOG_D(NR_MAC,"num_dmrs_cdm_grps_no_data %d, tbs %d\n",num_dmrs_cdm_grps_no_data, retInfo->tb_size);
|
||||
if (tda == retInfo->time_domain_allocation) {
|
||||
/* Check the resource is enough for retransmission */
|
||||
while (rbStart < bwpSize && !rballoc_mask[rbStart])
|
||||
rbStart++;
|
||||
if (rbStart + retInfo->rbSize > bwpSize) {
|
||||
LOG_W(NR_MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE_id, UE_info->rnti[UE_id], rbStart, retInfo->rbSize, bwpSize);
|
||||
return false;
|
||||
}
|
||||
/* check whether we need to switch the TDA allocation since tha last
|
||||
* (re-)transmission */
|
||||
NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static;
|
||||
@@ -955,18 +948,30 @@ bool allocate_ul_retransmission(module_id_t module_id,
|
||||
|| ps->dci_format != dci_format
|
||||
|| ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data)
|
||||
nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps);
|
||||
|
||||
/* Check the resource is enough for retransmission */
|
||||
while (rbStart < bwpSize &&
|
||||
!(rballoc_mask[rbStart]&startandlength_to_bitmat(ps->startSymbolIndex, ps->nrOfSymbols)))
|
||||
rbStart++;
|
||||
if (rbStart + retInfo->rbSize > bwpSize) {
|
||||
LOG_W(NR_MAC, "cannot allocate retransmission of UE %d/RNTI %04x: no resources (rbStart %d, retInfo->rbSize %d, bwpSize %d\n", UE_id, UE_info->rnti[UE_id], rbStart, retInfo->rbSize, bwpSize);
|
||||
return false;
|
||||
}
|
||||
|
||||
LOG_D(NR_MAC, "%s(): retransmission keeping TDA %d and TBS %d\n", __func__, tda, retInfo->tb_size);
|
||||
} else {
|
||||
/* the retransmission will use a different time domain allocation, check
|
||||
* that we have enough resources */
|
||||
while (rbStart < bwpSize && !rballoc_mask[rbStart])
|
||||
rbStart++;
|
||||
int rbSize = 0;
|
||||
while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize])
|
||||
rbSize++;
|
||||
NR_pusch_semi_static_t temp_ps;
|
||||
int dci_format = get_dci_format(sched_ctrl);
|
||||
nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp,ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, &temp_ps);
|
||||
/* the retransmission will use a different time domain allocation, check
|
||||
* that we have enough resources */
|
||||
while (rbStart < bwpSize &&
|
||||
!(rballoc_mask[rbStart]&startandlength_to_bitmat(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols)))
|
||||
rbStart++;
|
||||
int rbSize = 0;
|
||||
while (rbStart + rbSize < bwpSize &&
|
||||
(rballoc_mask[rbStart + rbSize]&startandlength_to_bitmat(temp_ps.startSymbolIndex, temp_ps.nrOfSymbols)))
|
||||
rbSize++;
|
||||
uint32_t new_tbs;
|
||||
uint16_t new_rbSize;
|
||||
bool success = nr_find_nb_rb(retInfo->Qm,
|
||||
@@ -1022,7 +1027,7 @@ bool allocate_ul_retransmission(module_id_t module_id,
|
||||
/* Mark the corresponding RBs as used */
|
||||
n_rb_sched -= sched_pusch->rbSize;
|
||||
for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++)
|
||||
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] = 0;
|
||||
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] -= startandlength_to_bitmat(sched_ctrl->pusch_semi_static.startSymbolIndex, sched_ctrl->pusch_semi_static.nrOfSymbols);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1121,14 +1126,6 @@ void pf_ul(module_id_t module_id,
|
||||
if (max_num_ue < 0)
|
||||
return;
|
||||
|
||||
LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart);
|
||||
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
|
||||
if (rbStart + min_rb >= bwpSize) {
|
||||
LOG_W(NR_MAC, "cannot allocate continuous UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n",
|
||||
UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Save PUSCH field */
|
||||
/* we want to avoid a lengthy deduction of DMRS and other parameters in
|
||||
* every TTI if we can save it, so check whether dci_format, TDA, or
|
||||
@@ -1140,6 +1137,17 @@ void pf_ul(module_id_t module_id,
|
||||
|| ps->dci_format != dci_format
|
||||
|| ps->num_dmrs_cdm_grps_no_data != num_dmrs_cdm_grps_no_data)
|
||||
nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps);
|
||||
|
||||
LOG_D(NR_MAC,"Looking for min_rb %d RBs, starting at %d\n", min_rb, rbStart);
|
||||
while (rbStart < bwpSize &&
|
||||
!(rballoc_mask[rbStart]&startandlength_to_bitmat(ps->startSymbolIndex, ps->nrOfSymbols)))
|
||||
rbStart++;
|
||||
if (rbStart + min_rb >= bwpSize) {
|
||||
LOG_W(NR_MAC, "cannot allocate continuous UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n",
|
||||
UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
return;
|
||||
}
|
||||
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
sched_pusch->mcs = 9;
|
||||
update_ul_ue_R_Qm(sched_pusch, ps);
|
||||
@@ -1158,7 +1166,7 @@ void pf_ul(module_id_t module_id,
|
||||
/* Mark the corresponding RBs as used */
|
||||
n_rb_sched -= sched_pusch->rbSize;
|
||||
for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++)
|
||||
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] = 0;
|
||||
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] -= startandlength_to_bitmat(ps->startSymbolIndex, ps->nrOfSymbols);
|
||||
|
||||
continue;
|
||||
}
|
||||
@@ -1215,19 +1223,6 @@ void pf_ul(module_id_t module_id,
|
||||
NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch;
|
||||
NR_pusch_semi_static_t *ps = &sched_ctrl->pusch_semi_static;
|
||||
|
||||
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
|
||||
sched_pusch->rbStart = rbStart;
|
||||
uint16_t max_rbSize = 1;
|
||||
while (rbStart + max_rbSize < bwpSize && rballoc_mask[rbStart + max_rbSize])
|
||||
max_rbSize++;
|
||||
|
||||
if (rbStart + min_rb >= bwpSize) {
|
||||
LOG_W(NR_MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n",
|
||||
UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
return;
|
||||
}
|
||||
else LOG_D(NR_MAC,"allocating UL data for UE %d/RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d\n",UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
|
||||
/* Save PUSCH field */
|
||||
/* we want to avoid a lengthy deduction of DMRS and other parameters in
|
||||
* every TTI if we can save it, so check whether dci_format, TDA, or
|
||||
@@ -1241,6 +1236,23 @@ void pf_ul(module_id_t module_id,
|
||||
nr_set_pusch_semi_static(scc, sched_ctrl->active_ubwp, ubwpd, dci_format, tda, num_dmrs_cdm_grps_no_data, ps);
|
||||
update_ul_ue_R_Qm(sched_pusch, ps);
|
||||
|
||||
while (rbStart < bwpSize &&
|
||||
!(rballoc_mask[rbStart]&startandlength_to_bitmat(ps->startSymbolIndex, ps->nrOfSymbols)))
|
||||
rbStart++;
|
||||
sched_pusch->rbStart = rbStart;
|
||||
uint16_t max_rbSize = 1;
|
||||
while (rbStart + max_rbSize < bwpSize &&
|
||||
(rballoc_mask[rbStart + max_rbSize]&&startandlength_to_bitmat(ps->startSymbolIndex, ps->nrOfSymbols)))
|
||||
max_rbSize++;
|
||||
|
||||
if (rbStart + min_rb >= bwpSize) {
|
||||
LOG_W(NR_MAC, "cannot allocate UL data for UE %d/RNTI %04x: no resources (rbStart %d, min_rb %d, bwpSize %d\n",
|
||||
UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
return;
|
||||
}
|
||||
else LOG_D(NR_MAC,"allocating UL data for UE %d/RNTI %04x (rbStsart %d, min_rb %d, bwpSize %d\n",UE_id, UE_info->rnti[UE_id],rbStart,min_rb,bwpSize);
|
||||
|
||||
|
||||
/* Calculate the current scheduling bytes and the necessary RBs */
|
||||
const int B = cmax(sched_ctrl->estimated_ul_buffer - sched_ctrl->sched_ul_bytes, 0);
|
||||
uint16_t rbSize = 0;
|
||||
@@ -1261,7 +1273,7 @@ void pf_ul(module_id_t module_id,
|
||||
/* Mark the corresponding RBs as used */
|
||||
n_rb_sched -= sched_pusch->rbSize;
|
||||
for (int rb = 0; rb < sched_ctrl->sched_pusch.rbSize; rb++)
|
||||
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] = 0;
|
||||
rballoc_mask[rb + sched_ctrl->sched_pusch.rbStart] -= startandlength_to_bitmat(ps->startSymbolIndex, ps->nrOfSymbols);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1330,11 +1342,9 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength;
|
||||
int startSymbolIndex, nrOfSymbols;
|
||||
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
|
||||
const uint16_t symb = ((1 << nrOfSymbols) - 1) << startSymbolIndex;
|
||||
const uint16_t symb = startandlength_to_bitmat(startSymbolIndex, nrOfSymbols);
|
||||
|
||||
int st = 0, e = 0, len = 0;
|
||||
for (int i = 0; i < bwpSize; i++)
|
||||
if (RC.nrmac[module_id]->ulprbbl[i] == 1) vrb_map_UL[i]=symb;
|
||||
|
||||
for (int i = 0; i < bwpSize; i++) {
|
||||
while ((vrb_map_UL[bwpStart + i] & symb) != 0 && i < bwpSize)
|
||||
@@ -1355,7 +1365,7 @@ bool nr_fr1_ulsch_preprocessor(module_id_t module_id, frame_t frame, sub_frame_t
|
||||
|
||||
/* Calculate mask: if any RB in vrb_map_UL is blocked (1), the current RB will be 0 */
|
||||
for (int i = 0; i < bwpSize; i++)
|
||||
rballoc_mask[i] = i >= st && i <= e;
|
||||
rballoc_mask[i] = (i >= st && i <= e)*startandlength_to_bitmat(startSymbolIndex, nrOfSymbols);
|
||||
|
||||
/* proportional fair scheduling algorithm */
|
||||
pf_ul(module_id,
|
||||
|
||||
@@ -157,6 +157,8 @@ typedef struct {
|
||||
uint8_t msg3_round;
|
||||
/// Flag to indicate if Msg3 carries a DCCH or DTCH message
|
||||
bool msg3_dcch_dtch;
|
||||
int msg3_startsymb;
|
||||
int msg3_nrsymb;
|
||||
/// TBS used for Msg4
|
||||
int msg4_TBsize;
|
||||
/// MCS used for Msg4
|
||||
|
||||
Reference in New Issue
Block a user