From 72927faf06cd7d6f2926a503f17453e22a871665 Mon Sep 17 00:00:00 2001 From: francescomani Date: Sun, 4 Jun 2023 09:43:21 +0200 Subject: [PATCH 1/5] some refactoring in dci configuration --- .../NR_MAC_UE/nr_ue_dci_configuration.c | 141 +++++++++--------- 1 file changed, 71 insertions(+), 70 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index b3389df86a..8b99818508 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -96,9 +96,6 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, const NR_SearchSpace_t *ss) { - uint16_t monitoringSymbolsWithinSlot = 0; - int sps = 0; - const NR_UE_DL_BWP_t *current_DL_BWP = &mac->current_DL_BWP; const NR_UE_UL_BWP_t *current_UL_BWP = &mac->current_UL_BWP; NR_BWP_Id_t dl_bwp_id = current_DL_BWP ? current_DL_BWP->bwp_id : 0; @@ -187,70 +184,72 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, mac->cg, &mac->def_dci_pdu_rel15[dl_config->slot][dci_format], dci_format, - NR_RNTI_TC, + rnti_type, coreset, dl_bwp_id, ss->searchSpaceType->present, mac->type0_PDCCH_CSS_config.num_rbs, alt_size); - - rel15->BWPStart = coreset_id == 0 ? mac->type0_PDCCH_CSS_config.cset_start_rb : current_DL_BWP->BWPStart; - rel15->BWPSize = coreset_id == 0 ? mac->type0_PDCCH_CSS_config.num_rbs : current_DL_BWP->BWPSize; - - switch(rnti_type) { - case NR_RNTI_C: - // we use DL BWP dedicated - sps = current_DL_BWP->cyclicprefix ? 12 : 14; - // for SPS=14 8 MSBs in positions 13 down to 6 - monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); - rel15->rnti = mac->crnti; - rel15->SubcarrierSpacing = current_DL_BWP->scs; - break; - case NR_RNTI_RA: - // we use the initial DL BWP - sps = current_DL_BWP->cyclicprefix == NULL ? 14 : 12; - monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); - rel15->rnti = mac->ra.ra_rnti; - rel15->SubcarrierSpacing = current_DL_BWP->scs; - break; - case NR_RNTI_P: - break; - case NR_RNTI_CS: - break; - case NR_RNTI_TC: - // we use the initial DL BWP - sps = current_DL_BWP->cyclicprefix == NULL ? 14 : 12; - monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); - rel15->rnti = mac->ra.t_crnti; - rel15->SubcarrierSpacing = current_DL_BWP->scs; - break; - case NR_RNTI_SP_CSI: - break; - case NR_RNTI_SI: - sps=14; - // for SPS=14 8 MSBs in positions 13 down to 6 - monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); - - rel15->rnti = SI_RNTI; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values - - rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; - if(mac->frequency_range == FR2) - rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2; - break; - case NR_RNTI_SFI: - break; - case NR_RNTI_INT: - break; - case NR_RNTI_TPC_PUSCH: - break; - case NR_RNTI_TPC_PUCCH: - break; - case NR_RNTI_TPC_SRS: - break; - default: - break; - } } + + rel15->BWPStart = coreset_id == 0 ? mac->type0_PDCCH_CSS_config.cset_start_rb : current_DL_BWP->BWPStart; + rel15->BWPSize = coreset_id == 0 ? mac->type0_PDCCH_CSS_config.num_rbs : current_DL_BWP->BWPSize; + + uint16_t monitoringSymbolsWithinSlot = 0; + int sps = 0; + + switch(rnti_type) { + case NR_RNTI_C: + // we use DL BWP dedicated + sps = current_DL_BWP->cyclicprefix ? 12 : 14; + // for SPS=14 8 MSBs in positions 13 down to 6 + monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + rel15->rnti = mac->crnti; + rel15->SubcarrierSpacing = current_DL_BWP->scs; + break; + case NR_RNTI_RA: + // we use the initial DL BWP + sps = current_DL_BWP->cyclicprefix == NULL ? 14 : 12; + monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + rel15->rnti = mac->ra.ra_rnti; + rel15->SubcarrierSpacing = current_DL_BWP->scs; + break; + case NR_RNTI_P: + break; + case NR_RNTI_CS: + break; + case NR_RNTI_TC: + // we use the initial DL BWP + sps = current_DL_BWP->cyclicprefix == NULL ? 14 : 12; + monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + rel15->rnti = mac->ra.t_crnti; + rel15->SubcarrierSpacing = current_DL_BWP->scs; + break; + case NR_RNTI_SP_CSI: + break; + case NR_RNTI_SI: + sps=14; + // for SPS=14 8 MSBs in positions 13 down to 6 + monitoringSymbolsWithinSlot = (ss->monitoringSymbolsWithinSlot->buf[0]<<(sps-8)) | (ss->monitoringSymbolsWithinSlot->buf[1]>>(16-sps)); + rel15->rnti = SI_RNTI; // SI-RNTI - 3GPP TS 38.321 Table 7.1-1: RNTI values + rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon; + if(mac->frequency_range == FR2) + rel15->SubcarrierSpacing = mac->mib->subCarrierSpacingCommon + 2; + break; + case NR_RNTI_SFI: + break; + case NR_RNTI_INT: + break; + case NR_RNTI_TPC_PUSCH: + break; + case NR_RNTI_TPC_PUCCH: + break; + case NR_RNTI_TPC_SRS: + break; + default: + break; + } + for (int i = 0; i < sps; i++) { if ((monitoringSymbolsWithinSlot >> (sps - 1 - i)) & 1) { rel15->coreset.StartSymbolIndex = i; @@ -263,15 +262,17 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fill_dci_search_candidates(ss, rel15, Y); #ifdef DEBUG_DCI - LOG_D(MAC, "[DCI_CONFIG] Configure DCI PDU: rnti_type %d BWPSize %d BWPStart %d rel15->SubcarrierSpacing %d rel15->dci_format %d rel15->dci_length %d sps %d monitoringSymbolsWithinSlot %d \n", - rnti_type, - rel15->BWPSize, - rel15->BWPStart, - rel15->SubcarrierSpacing, - rel15->dci_format_options[0], - rel15->dci_length_options[0], - sps, - monitoringSymbolsWithinSlot); + for (int i = 0; i < rel15->num_dci_options; i++) { + LOG_D(MAC, "[DCI_CONFIG] Configure DCI PDU: rnti_type %d BWPSize %d BWPStart %d rel15->SubcarrierSpacing %d rel15->dci_format %d rel15->dci_length %d sps %d monitoringSymbolsWithinSlot %d \n", + rnti_type, + rel15->BWPSize, + rel15->BWPStart, + rel15->SubcarrierSpacing, + rel15->dci_format_options[i], + rel15->dci_length_options[i], + sps, + monitoringSymbolsWithinSlot); + } #endif // add DCI dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DCI; From 409df4bb982e516602490aac8dca0170ca838f2a Mon Sep 17 00:00:00 2001 From: francescomani Date: Sun, 4 Jun 2023 09:51:00 +0200 Subject: [PATCH 2/5] remove unnecessary part of dci scehduler for RA --- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index b60e0199a2..b1be2a6190 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -951,7 +951,7 @@ void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info) nr_scheduled_response_t scheduled_response; nr_dcireq_t dcireq; - if(mac->state == UE_CONNECTED) { + if(mac->state > UE_NOT_SYNC) { dcireq.module_id = mod_id; dcireq.gNB_index = gNB_index; @@ -964,8 +964,10 @@ void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info) if(mac->ul_time_alignment.ta_apply) schedule_ta_command(dl_config, &mac->ul_time_alignment); - nr_schedule_csirs_reception(mac, rx_frame, rx_slot); - nr_schedule_csi_for_im(mac, rx_frame, rx_slot); + if(mac->state == UE_CONNECTED) { + nr_schedule_csirs_reception(mac, rx_frame, rx_slot); + nr_schedule_csi_for_im(mac, rx_frame, rx_slot); + } dcireq.dl_config_req = *dl_config; fill_scheduled_response(&scheduled_response, &dcireq.dl_config_req, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->phy_data); @@ -974,19 +976,6 @@ void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info) mac->if_module->scheduled_response(&scheduled_response); } } - else if (mac->state == UE_PERFORMING_RA) { - // this is for Msg2/Msg4 - if (mac->ra.ra_state >= WAIT_RAR) { - if(mac->ul_time_alignment.ta_apply) - schedule_ta_command(dl_config, &mac->ul_time_alignment); - config_dci_pdu(mac, dl_config, mac->ra.ra_state == WAIT_RAR ? NR_RNTI_RA : NR_RNTI_TC , rx_slot, mac->ra_SS); - dl_config->number_pdus = 1; - LOG_D(MAC,"mac->cg %p: Calling fill_scheduled_response for type0_pdcch, num_pdus %d\n", mac->cg, dl_config->number_pdus); - fill_scheduled_response(&scheduled_response, dl_config, NULL, NULL, mod_id, cc_id, rx_frame, rx_slot, dl_info->phy_data); - if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) - mac->if_module->scheduled_response(&scheduled_response); - } - } else dl_config->number_pdus = 0; } From 8c2c89491c50aeb375547e369365273e899a778a Mon Sep 17 00:00:00 2001 From: francescomani Date: Tue, 6 Jun 2023 12:40:34 +0200 Subject: [PATCH 3/5] fix for not initialized pduBitmap --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 6c8a0f337f..4bd00691df 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -653,6 +653,8 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.rnti = rnti; fapi_nr_dl_config_dlsch_pdu_rel15_t *dlsch_config_pdu_1_0 = &dl_config->dl_config_list[dl_config->number_pdus].dlsch_config_pdu.dlsch_config_rel15; + dlsch_config_pdu_1_0->pduBitmap = 0; + NR_PDSCH_Config_t *pdsch_config = current_DL_BWP ? current_DL_BWP->pdsch_Config : NULL; if (dci_ind->ss_type == NR_SearchSpace__searchSpaceType_PR_common) { dlsch_config_pdu_1_0->BWPSize = mac->type0_PDCCH_CSS_config.num_rbs ? mac->type0_PDCCH_CSS_config.num_rbs : current_DL_BWP->initial_BWPSize; From 1da7cada4858ad0bcbbe36dca151512fbc0e8b42 Mon Sep 17 00:00:00 2001 From: francescomani Date: Wed, 7 Jun 2023 19:10:47 +0200 Subject: [PATCH 4/5] solution to L2 failure -> handling switch to 1_0 --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 26 ++++++++++++-------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 4bd00691df..1f1bdd402b 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -443,13 +443,14 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in LOG_D(MAC,"Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n", dci->rnti,dci->dci_format,dci->n_CCE,dci->payloadSize,*(unsigned long long*)dci->payloadBits); - int8_t ret = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, dci->ss_type, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15, slot); - if ((ret&1) == 1) return -1; + int ret = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, dci->ss_type, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15, slot); + if ((ret&1) == 1) + return -1; else if (ret == 2) { - dci->dci_format = NR_UL_DCI_FORMAT_0_0; + dci->dci_format = (dci->dci_format == NR_UL_DCI_FORMAT_0_0) ? NR_DL_DCI_FORMAT_1_0 : NR_UL_DCI_FORMAT_0_0; def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[slot][dci->dci_format]; } - int8_t ret_proc = nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci); + int ret_proc = nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci); return ret_proc; } @@ -2849,7 +2850,7 @@ static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, dci_pdu_rel15_t *dci_pdu_rel15, int slot) { - + LOG_D(MAC,"nr_extract_dci_info : dci_pdu %lx, size %d, format %d\n", *dci_pdu, dci_size, dci_format); int pos = 0; int fsize = 0; int rnti_type = get_rnti_type(mac, rnti); @@ -2866,7 +2867,7 @@ static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, current_DL_BWP->initial_BWPSize); else N_RB = mac->type0_PDCCH_CSS_config.num_rbs; - LOG_D(MAC,"nr_extract_dci_info : dci_pdu %lx, size %d\n",*dci_pdu,dci_size); + switch(dci_format) { case NR_DL_DCI_FORMAT_1_0: @@ -2916,7 +2917,7 @@ static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, //switch to DCI_0_0 if (dci_pdu_rel15->format_indicator == 0) { dci_pdu_rel15 = &mac->def_dci_pdu_rel15[slot][NR_UL_DCI_FORMAT_0_0]; - return 2+nr_extract_dci_info(mac, NR_UL_DCI_FORMAT_0_0, dci_size, rnti, ss_type, dci_pdu, dci_pdu_rel15, slot); + return 2 + nr_extract_dci_info(mac, NR_UL_DCI_FORMAT_0_0, dci_size, rnti, ss_type, dci_pdu, dci_pdu_rel15, slot); } #ifdef DEBUG_EXTRACT_DCI LOG_D(MAC,"Format indicator %d (%d bits) N_RB_BWP %d => %d (0x%lx)\n",dci_pdu_rel15->format_indicator,1,N_RB,dci_size-pos,*dci_pdu); @@ -3107,7 +3108,7 @@ static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, //switch to DCI_0_0 if (dci_pdu_rel15->format_indicator == 0) { dci_pdu_rel15 = &mac->def_dci_pdu_rel15[slot][NR_UL_DCI_FORMAT_0_0]; - return 2+nr_extract_dci_info(mac, NR_UL_DCI_FORMAT_0_0, dci_size, rnti, ss_type, dci_pdu, dci_pdu_rel15, slot); + return 2 + nr_extract_dci_info(mac, NR_UL_DCI_FORMAT_0_0, dci_size, rnti, ss_type, dci_pdu, dci_pdu_rel15, slot); } // Freq domain assignment 0-16 bit @@ -3248,8 +3249,13 @@ static uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, #ifdef DEBUG_EXTRACT_DCI LOG_I(MAC,"Format indicator %d (%d bits)=> %d (0x%lx)\n",dci_pdu_rel15->format_indicator,1,dci_size-pos,*dci_pdu); #endif - if (dci_pdu_rel15->format_indicator == 1) - return 1; // discard dci, format indicator not corresponding to dci_format + + //switch to DCI_1_0 + if (dci_pdu_rel15->format_indicator == 1) { + dci_pdu_rel15 = &mac->def_dci_pdu_rel15[slot][NR_DL_DCI_FORMAT_1_0]; + return 2 + nr_extract_dci_info(mac, NR_DL_DCI_FORMAT_1_0, dci_size, rnti, ss_type, dci_pdu, dci_pdu_rel15, slot); + } + fsize = dci_pdu_rel15->frequency_domain_assignment.nbits; pos+=fsize; dci_pdu_rel15->frequency_domain_assignment.val = (*dci_pdu>>(dci_size-pos))&((1< Date: Tue, 27 Jun 2023 19:20:34 +0200 Subject: [PATCH 5/5] review --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 7 +++---- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 1f1bdd402b..b1e0c17cc8 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -443,15 +443,14 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in LOG_D(MAC,"Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n", dci->rnti,dci->dci_format,dci->n_CCE,dci->payloadSize,*(unsigned long long*)dci->payloadBits); - int ret = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, dci->ss_type, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15, slot); - if ((ret&1) == 1) + const int ret = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, dci->ss_type, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15, slot); + if ((ret & 1) == 1) return -1; else if (ret == 2) { dci->dci_format = (dci->dci_format == NR_UL_DCI_FORMAT_0_0) ? NR_DL_DCI_FORMAT_1_0 : NR_UL_DCI_FORMAT_0_0; def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[slot][dci->dci_format]; } - int ret_proc = nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci); - return ret_proc; + return nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci); } int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, frame_t frame, int slot, dci_pdu_rel15_t *dci, fapi_nr_dci_indication_pdu_t *dci_ind) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index b1be2a6190..51c4d6f184 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -951,7 +951,7 @@ void nr_ue_dl_scheduler(nr_downlink_indication_t *dl_info) nr_scheduled_response_t scheduled_response; nr_dcireq_t dcireq; - if(mac->state > UE_NOT_SYNC) { + if(mac->state > UE_NOT_SYNC) { dcireq.module_id = mod_id; dcireq.gNB_index = gNB_index;