Commit 23199abe authored by francescomani's avatar francescomani Committed by Laurent THOMAS

extending improvements for DCI10 in common search space to RA

parent 66b0ab10
......@@ -1191,22 +1191,20 @@ static void nr_generate_Msg2(module_id_t module_idP,
if ((ra->Msg2_frame == frameP) && (ra->Msg2_slot == slotP)) {
int mcsIndex = -1; // initialization value
int rbStart = 0;
int rbSize = 8;
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
NR_SearchSpace_t *ss = ra->ra_ss;
long BWPStart = 0;
long BWPSize = 0;
int rbSize = 8;
int rbStop = 0;
int rbStart = 0;
get_start_stop_allocation(nr_mac, sc_info, dl_bwp, ss, &rbStart, &rbStop);
int alloc_start = rbStart;
long BWPStart = dl_bwp->BWPStart;
long BWPSize = dl_bwp->BWPSize;
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = NULL;
if(*ss->controlResourceSetId != 0) {
BWPStart = dl_bwp->BWPStart;
BWPSize = sc_info->initial_dl_BWPSize;
} else {
if(*ss->controlResourceSetId == 0) {
type0_PDCCH_CSS_config = &nr_mac->type0_PDCCH_CSS_config[ra->beam_id];
BWPStart = type0_PDCCH_CSS_config->cset_start_rb;
BWPSize = type0_PDCCH_CSS_config->num_rbs;
}
NR_ControlResourceSet_t *coreset = ra->coreset;
......@@ -1225,14 +1223,14 @@ static void nr_generate_Msg2(module_id_t module_idP,
false);
uint16_t *vrb_map = cc[CC_id].vrb_map;
for (int i = 0; (i < rbSize) && (rbStart <= (BWPSize - rbSize)); i++) {
if (vrb_map[BWPStart + rbStart + i]&SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols)) {
for (int i = 0; (i < rbSize) && (rbStart <= (rbStop - rbSize)); i++) {
if (vrb_map[BWPStart + rbStart + i] & SL_to_bitmap(tda_info.startSymbolIndex, tda_info.nrOfSymbols)) {
rbStart += i;
i = 0;
}
}
if (rbStart > (BWPSize - rbSize)) {
if (rbStart > (rbStop - rbSize)) {
LOG_E(NR_MAC, "%s(): cannot find free vrb_map for RA RNTI %04x!\n", __func__, ra->RA_rnti);
return;
}
......@@ -1360,10 +1358,11 @@ static void nr_generate_Msg2(module_id_t module_idP,
dci_pdu_rel15_t dci_payload;
dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->rbStart,
BWPSize);
pdsch_pdu_rel15->rbStart - alloc_start,
rbStop - alloc_start);
LOG_D(NR_MAC,"Msg2 rbSize.rbStart.BWPsize %d.%d.%ld\n",pdsch_pdu_rel15->rbSize,
LOG_D(NR_MAC,"Msg2 rbSize.rbStart.BWPsize %d.%d.%ld\n",
pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->rbStart,
BWPSize);
......@@ -1510,26 +1509,15 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac,
NR_COMMON_channels_t *cc = &nr_mac->common_channels[CC_id];
NR_ServingCellConfigCommon_t *scc = cc->ServingCellConfigCommon;
long BWPStart = 0;
long BWPSize = 0;
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = NULL;
NR_SearchSpace_t *ss = ra->ra_ss;
if(*ss->controlResourceSetId!=0) {
BWPStart = dl_bwp->BWPStart;
BWPSize = dl_bwp->BWPSize;
} else {
type0_PDCCH_CSS_config = &nr_mac->type0_PDCCH_CSS_config[ra->beam_id];
BWPStart = type0_PDCCH_CSS_config->cset_start_rb;
BWPSize = type0_PDCCH_CSS_config->num_rbs;
}
int mcsTableIdx = dl_bwp->mcsTableIdx;
pdsch_pdu_rel15->pduBitmap = 0;
pdsch_pdu_rel15->rnti = rnti;
pdsch_pdu_rel15->pduIndex = pduindex;
pdsch_pdu_rel15->BWPSize = BWPSize;
pdsch_pdu_rel15->BWPStart = BWPStart;
pdsch_pdu_rel15->BWPSize = dl_bwp->BWPSize;
pdsch_pdu_rel15->BWPStart = dl_bwp->BWPStart;
pdsch_pdu_rel15->SubcarrierSpacing = dl_bwp->scs;
pdsch_pdu_rel15->CyclicPrefix = 0;
pdsch_pdu_rel15->NrOfCodewords = 1;
......@@ -1581,9 +1569,12 @@ static void prepare_dl_pdus(gNB_MAC_INST *nr_mac,
dci_pdu->powerControlOffsetSS = 1;
dci_pdu_rel15_t dci_payload;
int alloc_start = 0;
int alloc_stop = 0;
get_start_stop_allocation(nr_mac, &ra->sc_info, dl_bwp, ss, &alloc_start, &alloc_stop);
dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu_rel15->rbSize,
pdsch_pdu_rel15->rbStart,
BWPSize);
pdsch_pdu_rel15->rbStart - alloc_start,
alloc_stop - alloc_start);
dci_payload.format_indicator = 1;
dci_payload.time_domain_assignment.val = time_domain_assignment;
......@@ -1703,17 +1694,8 @@ static void nr_generate_Msg4(module_id_t module_idP,
mac_sdu_length = srb_status.bytes_in_buffer;
}
long BWPStart = 0;
long BWPSize = 0;
long BWPStart = BWPStart = dl_bwp->BWPStart;
NR_Type0_PDCCH_CSS_config_t *type0_PDCCH_CSS_config = NULL;
if(*ss->controlResourceSetId!=0) {
BWPStart = dl_bwp->BWPStart;
BWPSize = dl_bwp->BWPSize;
} else {
type0_PDCCH_CSS_config = &nr_mac->type0_PDCCH_CSS_config[ra->beam_id];
BWPStart = type0_PDCCH_CSS_config->cset_start_rb;
BWPSize = type0_PDCCH_CSS_config->num_rbs;
}
// get CCEindex, needed also for PUCCH and then later for PDCCH
uint8_t aggregation_level;
......@@ -1757,6 +1739,8 @@ static void nr_generate_Msg4(module_id_t module_idP,
uint8_t mcsIndex = 0;
int rbStart = 0;
int rbSize = 0;
int rbStop = 0;
get_start_stop_allocation(nr_mac, &ra->sc_info, dl_bwp, ss, &rbStart, &rbStop);
uint8_t tb_scaling = 0;
uint32_t tb_size = 0;
uint16_t pdu_length;
......@@ -1770,9 +1754,9 @@ static void nr_generate_Msg4(module_id_t module_idP,
pdu_length = mac_sdu_length + subheader_len + 7; //7 is contetion resolution length
}
// increase PRBs until we get to BWPSize or TBS is bigger than MAC PDU size
// increase PRBs until we get to max size or TBS is bigger than MAC PDU size
do {
if(rbSize < BWPSize)
if(rbSize < (rbStop - rbStart))
rbSize++;
else
mcsIndex++;
......@@ -1786,16 +1770,16 @@ static void nr_generate_Msg4(module_id_t module_idP,
int i = 0;
uint16_t *vrb_map = cc[CC_id].vrb_map;
while ((i < rbSize) && (rbStart + rbSize <= BWPSize)) {
if (vrb_map[BWPStart + rbStart + i]&SL_to_bitmap(msg4_tda.startSymbolIndex, msg4_tda.nrOfSymbols)) {
rbStart += i+1;
while ((i < rbSize) && (rbStart + rbSize <= rbStop)) {
if (vrb_map[BWPStart + rbStart + i] & SL_to_bitmap(msg4_tda.startSymbolIndex, msg4_tda.nrOfSymbols)) {
rbStart += i + 1;
i = 0;
} else {
i++;
}
}
if (rbStart > (BWPSize - rbSize)) {
if (rbStart > (rbStop - rbSize)) {
LOG_E(NR_MAC, "%s(): cannot find free vrb_map for RNTI %04x!\n", __func__, ra->rnti);
return;
}
......
......@@ -380,13 +380,13 @@ void abort_nr_dl_harq(NR_UE_info_t* UE, int8_t harq_pid)
}
static void get_start_stop_allocation(gNB_MAC_INST *mac,
NR_UE_info_t *UE,
void get_start_stop_allocation(gNB_MAC_INST *mac,
NR_UE_ServingCell_Info_t *sc_info,
NR_UE_DL_BWP_t *dl_bwp,
NR_SearchSpace_t *ss,
int *rbStart,
int *rbStop)
{
NR_UE_DL_BWP_t *dl_bwp = &UE->current_DL_BWP;
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
// UE is scheduled in a set of contiguously allocated resource blocks within the active bandwidth part of size N_BWP PRBs
// except for the case when DCI format 1_0 is decoded in any common search space
// in which case the size of CORESET 0 shall be used if CORESET 0 is configured for the cell
......@@ -394,15 +394,15 @@ static void get_start_stop_allocation(gNB_MAC_INST *mac,
// TS 38.214 Section 5.1.2.2.2
*rbStop = dl_bwp->BWPSize;
*rbStart = 0; // start wrt BWPstart
if (sched_ctrl->search_space->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common &&
if (ss->searchSpaceType->present == NR_SearchSpace__searchSpaceType_PR_common &&
dl_bwp->dci_format == NR_DL_DCI_FORMAT_1_0) {
if (mac->cset0_bwp_size != 0) {
*rbStart = mac->cset0_bwp_start;
*rbStop = *rbStart + mac->cset0_bwp_size;
}
else {
*rbStart = UE->sc_info.initial_dl_BWPStart;
*rbStop = *rbStart + UE->sc_info.initial_dl_BWPSize;
*rbStart = sc_info->initial_dl_BWPStart;
*rbStop = *rbStart + sc_info->initial_dl_BWPSize;
}
}
}
......@@ -435,7 +435,7 @@ static bool allocate_dl_retransmission(module_id_t module_id,
int rbStop = 0;
int rbStart = 0;
get_start_stop_allocation(nr_mac, UE, &rbStart, &rbStop);
get_start_stop_allocation(nr_mac, &UE->sc_info, dl_bwp, sched_ctrl->search_space, &rbStart, &rbStop);
int rbSize = 0;
const int tda = get_dl_tda(nr_mac, scc, slot);
......@@ -778,7 +778,7 @@ static void pf_dl(module_id_t module_id,
int rbStop = 0;
int rbStart = 0;
get_start_stop_allocation(mac, iterator->UE, &rbStart, &rbStop);
get_start_stop_allocation(mac, &iterator->UE->sc_info, dl_bwp, sched_ctrl->search_space, &rbStart, &rbStop);
// Freq-demain allocation
while (rbStart < rbStop && (rballoc_mask[rbStart] & slbitmap) != slbitmap)
rbStart++;
......@@ -1163,7 +1163,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
// TS 38.214 Section 5.1.2.2.2
int rbStop = 0;
int rbStart = 0;
get_start_stop_allocation(gNB_mac, UE, &rbStart, &rbStop);
get_start_stop_allocation(gNB_mac, &UE->sc_info, current_BWP, sched_ctrl->search_space, &rbStart, &rbStop);
dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(pdsch_pdu->rbSize,
pdsch_pdu->rbStart - rbStart,
rbStop - rbStart);
......
......@@ -46,6 +46,13 @@ void nr_mac_send_f1_setup_req(void);
void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, const nr_mac_config_t *mac_config);
void nr_mac_configure_sib1(gNB_MAC_INST *nrmac, const f1ap_plmn_t *plmn, uint64_t cellID, int tac);
void get_start_stop_allocation(gNB_MAC_INST *mac,
NR_UE_ServingCell_Info_t *sc_info,
NR_UE_DL_BWP_t *dl_bwp,
NR_SearchSpace_t *ss,
int *rbStart,
int *rbStop);
bool nr_mac_add_test_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup);
bool nr_mac_prepare_ra_ue(gNB_MAC_INST *nrmac, uint32_t rnti, NR_CellGroupConfig_t *CellGroup);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment