From 4133b6bb60fd248be1a41c5f73f7c933490b2530 Mon Sep 17 00:00:00 2001 From: "Deokseong \"David\" Kim" Date: Mon, 9 Aug 2021 23:46:31 +0000 Subject: [PATCH] Added crnti checking in nrUE and update in gNB --- executables/nr-ue.c | 11 +---- nfapi/oai_integration/nfapi_vnf.c | 1 - openair1/SCHED_NR/phy_procedures_nr_gNB.c | 6 ++- openair1/SCHED_NR_UE/fapi_nr_ue_l1.c | 4 +- openair2/LAYER2/NR_MAC_UE/config_ue.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 23 +++------- openair2/LAYER2/NR_MAC_gNB/config.c | 3 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 33 +++++--------- .../LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c | 6 --- .../NR_MAC_gNB/gNB_scheduler_primitives.c | 15 +------ .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 4 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c | 45 ++----------------- .../LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c | 2 +- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 9 +++- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 19 +++----- 16 files changed, 47 insertions(+), 138 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index c0040abeec..eb032335fe 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -246,9 +246,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) continue; sfn_slot = *sfn_slot_p; - LOG_D(NR_MAC, "We have successfully dequeued snf slot = %d.%d, qsize = %zu\n", - NFAPI_SFNSLOT2SFN(sfn_slot), NFAPI_SFNSLOT2SLOT(sfn_slot), nr_sfn_slot_queue.num_items); - if (sfn_slot == last_sfn_slot) { LOG_D(NR_MAC, "repeated sfn_sf = %d.%d\n", @@ -330,7 +327,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) nfapi_nr_rach_indication_t *rach_ind = unqueue_matching(&nr_rach_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot); nfapi_nr_rx_data_indication_t *rx_ind = unqueue_matching(&nr_rx_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot); nfapi_nr_crc_indication_t *crc_ind = unqueue_matching(&nr_crc_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot); - LOG_D(NR_MAC, "Checking queues with crc_ind = %p\n", crc_ind); + if (rach_ind && rach_ind->number_of_pdus > 0) { NR_UL_IND_t UL_INFO = { @@ -357,15 +354,9 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) NR_UL_IND_t UL_INFO = { .crc_ind = *crc_ind, }; - for (int j = 0; j < crc_ind->number_crcs; j++) - { - LOG_D(NR_PHY, "Sending crc_ind.harq_id = %d for %d index SFN SLot %u %u with rnti %x\n", - crc_ind->crc_list[j].harq_id, j, crc_ind->sfn, crc_ind->slot, crc_ind->crc_list[j].rnti); - } send_nsa_standalone_msg(&UL_INFO, crc_ind->header.message_id); free(crc_ind->crc_list); } - LOG_D(NR_MAC, "Ready for handling next SFN SLOT\n"); } return NULL; } diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 55c08cf592..bed5648039 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -1365,7 +1365,6 @@ void set_thread_priority(int priority); void *vnf_nr_p7_thread_start(void *ptr) { set_thread_priority(79); - LOG_I(MAC, "Clearing Queues\n"); init_queue(&gnb_rach_ind_queue); init_queue(&gnb_rx_ind_queue); init_queue(&gnb_crc_ind_queue); diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index 24c633c1f0..ecf01dcbe6 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -624,8 +624,10 @@ void phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) AssertFatal(ulsch_harq!=NULL,"harq_pid %d is not allocated\n",harq_pid); //printf("ulsch_harq->frame = %d, frame_rx = %d \n", ulsch_harq->frame, frame_rx); if (NFAPI_MODE == NFAPI_MODE_PNF) - ulsch_harq->frame = frame_rx; - if ((ulsch_harq->status == NR_ACTIVE) && + { + ulsch_harq->frame = frame_rx; + } + if ((ulsch_harq->status == NR_ACTIVE) && (ulsch_harq->frame == frame_rx) && (ulsch_harq->slot == slot_rx) && (ulsch_harq->handled == 0)){ diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 38033b2005..69da2416a3 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -61,7 +61,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response "Too many ul_config pdus %d", ul_config->number_pdus); for (int i = 0; i < ul_config->number_pdus; ++i) { - LOG_D(PHY, "In %s: processing type %d PDU of %d total UL PDUs (ul_config %p) \n", + LOG_I(PHY, "In %s: processing type %d PDU of %d total UL PDUs (ul_config %p) \n", __FUNCTION__, ul_config->ul_config_list[i].pdu_type, ul_config->number_pdus, ul_config); uint8_t pdu_type = ul_config->ul_config_list[i].pdu_type; @@ -107,7 +107,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response { crc_ind->crc_list[j].handle = pusch_config_pdu->handle; crc_ind->crc_list[j].harq_id = pusch_config_pdu->pusch_data.harq_process_id; - LOG_I(NR_MAC, "This is the harq pid %d for crc_list[%d] rnti %x\n", crc_ind->crc_list[j].harq_id, j, pusch_config_pdu->rnti); + LOG_I(NR_MAC, "This is the harq pid %d for crc_list[%d]\n", crc_ind->crc_list[j].harq_id, j); LOG_I(NR_MAC, "This is sched sfn/sl [%d %d] and crc sfn/sl [%d %d]\n", scheduled_response->frame, scheduled_response->slot, crc_ind->sfn, crc_ind->slot); crc_ind->crc_list[j].num_cb = pusch_config_pdu->pusch_data.num_cb; diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 1e8326a961..b8b24f9b7c 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -538,7 +538,7 @@ int nr_rrc_mac_config_req_ue( mac->ul_config_request = calloc(num_slots, sizeof(*mac->ul_config_request)); config_common_ue(mac,module_id,cc_idP); mac->crnti = cell_group_config->spCellConfig->reconfigurationWithSync->newUE_Identity; - LOG_I(MAC,"Configuring CRNTI %x, with module_id = %d\n",mac->crnti, (int)module_id); + LOG_I(MAC,"Configuring CRNTI %x\n",mac->crnti); } // Setup the SSB to Rach Occasions mapping according to the config diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 3effafa90f..865db8c81c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -737,7 +737,7 @@ void nr_ra_succeeded(module_id_t mod_id, frame_t frame, int slot){ if (ra->cfra) { - LOG_I(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CF-RA: RAR successfully received, t_crnti = %x\n", mod_id, frame, slot, ra->t_crnti); + LOG_I(MAC, "[UE %d][%d.%d][RAPROC] RA procedure succeeded. CF-RA: RAR successfully received.\n", mod_id, frame, slot); ra->RA_window_cnt = -1; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index d74b2d3b67..1ccac25d0c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -82,8 +82,7 @@ int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti){ } else if (rnti == 0xFFFF) { rnti_type = NR_RNTI_SI; } else { - AssertFatal(1 == 0, "In %s: Not identified/handled rnti %x [ra->ra_rnti %x, mac->crnti %x, ra->t_crnti %x]\n", - __FUNCTION__, rnti, ra->ra_rnti, mac->crnti, ra->t_crnti); + AssertFatal(1 == 0, "In %s: Not identified/handled rnti %d \n", __FUNCTION__, rnti); } LOG_D(MAC, "In %s: returning rnti_type %s \n", __FUNCTION__, rnti_types[rnti_type]); @@ -447,22 +446,15 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); - LOG_D(MAC,"Received dci indication (rnti %4x, dci format %d,n_CCE %d, payloadSize %d, payload %llx)\n\n\n\n", + 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); if ((dci->rnti == mac->crnti) || (dci->rnti == mac->ra.ra_rnti)) { - LOG_D(MAC,"Received dci indication rnti %4x mac->crnti %4x frame slot %4d.%2d RA state %d\n", - dci->rnti, mac->crnti, frame, slot, mac->ra.ra_state); uint32_t dci_format = nr_extract_dci_info(mac, dci->dci_format, dci->payloadSize, dci->rnti, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15); return (nr_ue_process_dci(module_id, cc_id, gNB_index, frame, slot, def_dci_pdu_rel15, dci->rnti, dci_format)); } - else - { - LOG_D(MAC,"We skip for the received dci indication rnti %4x != mac->crnti %4x frame slot %4d.%2d\n", - dci->rnti, mac->crnti, frame, slot); - return 0; - } + return 0; } 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, uint16_t rnti, uint8_t dci_format){ @@ -483,10 +475,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr const uint16_t n_RB_DLBWP = (ra->ra_state == WAIT_RAR) ? NRRIV2BW(mac->scc->downlinkConfigCommon->initialDownlinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE) : NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); - LOG_I(MAC, "In %s: Processing received DCI format %s (DL BWP %d) harq_pid %d\n", - __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP, dci->harq_pid); - - + LOG_I(MAC, "In %s: Processing received DCI format %s (DL BWP %d)\n", __FUNCTION__, dci_formats[dci_format], n_RB_DLBWP); switch(dci_format){ case NR_UL_DCI_FORMAT_0_0: { @@ -2170,7 +2159,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t if( mac->crnti == ra->t_crnti ) { - LOG_I(MAC, "Discarding the received RAR.\n"); + LOG_D(MAC, "Discarding the received RAR.\n"); return -1; } while (1) { @@ -2185,7 +2174,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t LOG_D(MAC, "[UE %d][RAPROC] Got BI RAR subPDU %d\n", mod_id, ra->RA_backoff_indicator); } if (rarh->RAPID == preamble_index) { - LOG_I(MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d, CRNTI %x, t_crnti = %x\n", mod_id, frame, slot, rarh->RAPID, mac->crnti, ra->t_crnti); + LOG_I(MAC, "[UE %d][RAPROC][%d.%d] Found RAR with the intended RAPID %d\n", mod_id, frame, slot, rarh->RAPID); rar = (NR_MAC_RAR *) (dlsch_buffer + n_subheaders + (n_subPDUs - 1) * sizeof(NR_MAC_RAR)); ra->RA_RAPID_found = 1; break; diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c index feb58f379a..bce0719556 100644 --- a/openair2/LAYER2/NR_MAC_gNB/config.c +++ b/openair2/LAYER2/NR_MAC_gNB/config.c @@ -434,8 +434,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, } } } - LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup, ra_index %u, rnti %x\n", - rnti, ra_index, cc->ra[ra_index].rnti); + LOG_I(PHY,"Added new RA process for UE RNTI %04x with initial secondaryCellGroup\n", rnti); } else { // secondaryCellGroup has been updated const int UE_id = find_nr_UE_id(Mod_idP,rnti); UE_info->secondaryCellGroup[UE_id] = secondaryCellGroup; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 1e9b634cb7..91cd26cc90 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -531,14 +531,12 @@ void nr_initiate_ra_proc(module_id_t module_idP, VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_INITIATE_RA_PROC, 1); LOG_I(MAC, - "[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Initiating RA procedure for preamble index %d, rnti %x, ra_index %d\n", + "[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Initiating RA procedure for preamble index %d\n", module_idP, CC_id, frameP, slotP, - preamble_index, - ra->rnti, - i); + preamble_index); uint8_t beam_index = ssb_index_from_prach(module_idP, frameP, slotP, preamble_index, freq_index, symbol); @@ -729,7 +727,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t vrb_map_UL[i + ra->msg3_first_rb] = 1; } - LOG_I(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d), crnti %x\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot, ra->rnti); + LOG_I(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot); nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[CC_id][ra->Msg3_slot]; AssertFatal(future_ul_tti_req->SFN == ra->Msg3_frame @@ -751,7 +749,7 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t AssertFatal(ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count == 1, "downlinkBWP_ToAddModList has %d BWP!\n", ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->downlinkBWP_ToAddModList->list.count); NR_BWP_Uplink_t *ubwp = ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id - 1]; - LOG_D(MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %x\n", + LOG_D(MAC, "Frame %d, Subframe %d Adding Msg3 UL Config Request for (%d,%d) : (%d,%d,%d) for rnti: %d\n", frameP, slotP, ra->Msg3_frame, @@ -928,18 +926,11 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra dl_req->nPDUs+=1; nfapi_nr_dl_tti_pdsch_pdu_rel15_t *pdsch_pdu_rel15 = &dl_tti_pdsch_pdu->pdsch_pdu.pdsch_pdu_rel15; - LOG_I(MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RAR DCI, state %d, rnti %x\n", - module_idP, - CC_id, - frameP, - slotP, - ra->state, - ra->rnti - ); + LOG_I(MAC,"[gNB %d] [RAPROC] CC_id %d Frame %d, slotP %d: Generating RAR DCI, state %d\n", module_idP, CC_id, frameP, slotP, ra->state); NR_BWP_Uplink_t *ubwp=ra->secondaryCellGroup->spCellConfig->spCellConfigDedicated->uplinkConfig->uplinkBWP_ToAddModList->list.array[ra->bwp_id-1]; - LOG_I(MAC, "[RAPROC] Scheduling common search space DCI type 1 dlBWP BW %d, rnti %x\n", dci10_bw, ra->rnti); + LOG_I(MAC, "[RAPROC] Scheduling common search space DCI type 1 dlBWP BW %d\n", dci10_bw); // Qm>2 not allowed for RAR if (get_softmodem_params()->do_ra) @@ -1042,14 +1033,13 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra const int rnti_type = NR_RNTI_RA; LOG_I(MAC, - "[RAPROC] DCI params: RA rnti %x, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d, crnti %x\n", + "[RAPROC] DCI params: rnti %d, rnti_type %d, dci_format %d coreset params: FreqDomainResource %llx, start_symbol %d n_symb %d\n", pdcch_pdu_rel15->dci_pdu[0].RNTI, rnti_type, dci_format, (unsigned long long)pdcch_pdu_rel15->FreqDomainResource, pdcch_pdu_rel15->StartSymbolIndex, - pdcch_pdu_rel15->DurationSymbols, - ra->rnti); + pdcch_pdu_rel15->DurationSymbols); fill_dci_pdu_rel15(scc, ra->secondaryCellGroup, @@ -1072,10 +1062,10 @@ void nr_generate_Msg2(module_id_t module_idP, int CC_id, frame_t frameP, sub_fra // Program UL processing for Msg3 nr_get_Msg3alloc(module_idP, CC_id, scc, ubwp, slotP, frameP, ra); - LOG_I(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d, crnti %x\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot, ra->rnti); + LOG_I(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); nr_add_msg3(module_idP, CC_id, frameP, slotP, ra, (uint8_t *) &tx_req->TLVs[0].value.direct[0]); ra->state = WAIT_Msg3; - LOG_I(MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d, crnti %x\n", module_idP, frameP, slotP, ra->state, ra->rnti); + LOG_I(MAC,"[gNB %d][RAPROC] Frame %d, Subframe %d: RA state %d\n", module_idP, frameP, slotP, ra->state); x_Overhead = 0; nr_get_tbs_dl(&dl_tti_pdsch_pdu->pdsch_pdu, x_Overhead, pdsch_pdu_rel15->numDmrsCdmGrpsNoData, dci_payload.tb_scaling); @@ -1165,8 +1155,7 @@ void nr_fill_rar(uint8_t Mod_idP, // TC-RNTI rar->TCRNTI_1 = (uint8_t) (ra->rnti >> 8); // 8 MSBs of rnti rar->TCRNTI_2 = (uint8_t) (ra->rnti & 0xff); // 8 LSBs of rnti - LOG_D(MAC, "[gNB] Generate RAR MAC PDU frame %d slot %d preamble index %u TA command %d with rnti = %x\n", - ra->Msg2_frame, ra-> Msg2_slot, ra->preamble_index, ra->timing_offset, ra->rnti); + // UL grant ra->msg3_TPC = tpc_command; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c index eec9ae6487..c7c860930f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_dlsch.c @@ -721,12 +721,6 @@ void nr_schedule_ue_spec(module_id_t module_id, if (current_harq_pid < 0) { /* PP has not selected a specific HARQ Process, get a new one */ current_harq_pid = sched_ctrl->available_dl_harq.head; - //TODO:: Need to remove this if condition after debug. - if (current_harq_pid < 0) - { - LOG_D(MAC,"no free dl HARQ process available for UE %d\n",UE_id); - return; - } AssertFatal(current_harq_pid >= 0, "no free HARQ process available for UE %d\n", UE_id); diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c index 5d93e027bf..2f1bf9a3a6 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c @@ -520,8 +520,6 @@ void config_uldci(const NR_BWP_Uplink_t *ubwp, dci_pdu_rel15->ndi = pusch_pdu->pusch_data.new_data_indicator; dci_pdu_rel15->rv = pusch_pdu->pusch_data.rv_index; dci_pdu_rel15->harq_pid = pusch_pdu->pusch_data.harq_process_id; - LOG_D(MAC,"config_uldci harq id check dci_pdu_rel15->harq_pid %d pusch_pdu->pusch_data.harq_process_id %d\n", - dci_pdu_rel15->harq_pid, pusch_pdu->pusch_data.harq_process_id); dci_pdu_rel15->tpc = tpc; AssertFatal(ubwp->bwp_Dedicated->pusch_Config->choice.setup->resourceAllocation == NR_PUSCH_Config__resourceAllocation_resourceAllocationType1, "Only frequency resource allocation type 1 is currently supported\n"); @@ -1251,13 +1249,6 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, case NR_UL_DCI_FORMAT_0_1: switch (rnti_type) { case NR_RNTI_C: -#if 0 - harq_pid_ul = (harq_pid_ul + 1) % 16; - if (harq_pid_ul == 0) - flag = !flag; - dci_pdu_rel15->ndi = flag; -#endif - // Indicating a DL DCI format 1bit pos = 1; *dci_pdu |= ((uint64_t)dci_pdu_rel15->format_indicator & 0x1) << (dci_size - pos); @@ -1291,10 +1282,6 @@ void fill_dci_pdu_rel15(const NR_ServingCellConfigCommon_t *scc, // HARQ process number 4bit pos += 4; *dci_pdu |= ((uint64_t)dci_pdu_rel15->harq_pid & 0xf) << (dci_size - pos); - LOG_D(MAC,"fill_dci_pdu_rel15 dci_format %d shift %d hard_pid_ul %d\n", - dci_format, dci_size - pos, dci_pdu_rel15->harq_pid ); - LOG_D(MAC,"fill_dci_pdu_rel15 dci_size, pos, shift, harq_id = %u %u %d %lu\n", - dci_size, pos, dci_size - pos, (*dci_pdu >> (dci_size - pos)) & 0xf); // 1st Downlink assignment index pos += dci_pdu_rel15->dai[0].nbits; *dci_pdu |= ((uint64_t)dci_pdu_rel15->dai[0].val & ((1 << dci_pdu_rel15->dai[0].nbits) - 1)) << (dci_size - pos); @@ -1459,7 +1446,7 @@ int extract_length(int startSymbolAndLength) { void dump_nr_list(NR_list_t *listP) { for (int j = listP->head; j >= 0; j = listP->next[j]) - LOG_I(MAC, "NR list node %d => %d\n", j, listP->next[j]); + LOG_T(MAC, "NR list node %d => %d\n", j, listP->next[j]); } /* diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 6bbd22169d..921f5c42d4 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -558,15 +558,13 @@ int nr_acknack_scheduling(int mod_id, * scheduled a lot and used all AckNacks, pucch->frame might have been * wrapped around to next frame */ if (frame != pucch->frame || pucch->ul_slot < first_ul_slot_tdd) { - //TODO:: This comment should be removed later. - /* + pucch->dai_c = 0; AssertFatal(pucch->sr_flag + pucch->dai_c == 0, "expected no SR/AckNack for UE %d in %4d.%2d, but has %d/%d for %4d.%2d\n", UE_id, frame, slot, pucch->sr_flag, pucch->dai_c, pucch->frame, pucch->ul_slot); AssertFatal(frame + 1 != pucch->frame, "frame wrap around not handled in %s() yet\n", __func__); - */ pucch->frame = frame; pucch->ul_slot = first_ul_slot_tdd; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c index 89efb1db1c..f2c20bf088 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c @@ -344,12 +344,10 @@ void handle_nr_ul_harq(module_id_t mod_id, LOG_D(NR_MAC, "Comparing crc_pdu->harq_id vs feedback harq_pid = %d %d\n",crc_pdu->harq_id, harq_pid); while (crc_pdu->harq_id != harq_pid || harq_pid < 0) { LOG_W(MAC, - "Unexpected ULSCH HARQ PID in crc pdu %d (feedback have %d) for RNTI %04x SFN/SLOT %4d.%2d (ignore this warning for RA)\n", + "Unexpected ULSCH HARQ PID in crc pdu %d (feedback have %d) for RNTI %04x (ignore this warning for RA)\n", crc_pdu->harq_id, harq_pid, - crc_pdu->rnti, - frame, slot - ); + crc_pdu->rnti); if (harq_pid < 0) return; @@ -372,7 +370,7 @@ void handle_nr_ul_harq(module_id_t mod_id, harq->ndi ^= 1; harq->round = 0; LOG_D(MAC, - "Ulharq id %d crc passed for RNTI %4x\n", + "Ulharq id %d crc passed for RNTI %04x\n", harq_pid, crc_pdu->rnti); add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid); @@ -502,10 +500,6 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP, nr_clear_ra_proc(gnb_mod_idP, CC_idP, frameP); } else { - LOG_D(NR_MAC, - "expected TC_RNTI %04x to match current RNTI %04x\n", - ra->rnti, - current_rnti); // random access pusch with TC-RNTI if (ra->rnti != current_rnti) { LOG_W(NR_MAC, @@ -988,11 +982,7 @@ void nr_schedule_ulsch(module_id_t module_id, * every TTI are pre-populated by the preprocessor and used below */ NR_sched_pusch_t *sched_pusch = &sched_ctrl->sched_pusch; if (sched_pusch->rbSize <= 0) - { - LOG_D(NR_MAC, "UE id %d was skipped due to sched_pusch->rbSize <= 0\n", UE_id); continue; - } - struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) == -1) @@ -1032,13 +1022,6 @@ void nr_schedule_ulsch(module_id_t module_id, if (vnf_pnf_sfnslot_delta < 0 || time_diff_in_ms < 4 * (sfnslot_delta / 10) || time_diff_in_ms > 6 * (sfnslot_delta / 10)) { - LOG_D(NR_MAC, "%s() SFN/SLOT DELTA between Proxy and gNB. UEID %d, rnti %x Delta %3d. gNB:%4d.%-2d " - "slot_diff %4d time_diff %d : %lu.%06lu vs %lu.%06lu --> Skip\n\n\n\n\n\n\n\n\n", - __func__, UE_id, UE_info->rnti[UE_id], - vnf_pnf_sfnslot_delta, - frame, slot, sfnslot_delta, time_diff_in_ms, - ts.tv_sec, ts.tv_nsec / 1000, - prev_sched[UE_id].ts.tv_sec, prev_sched[UE_id].ts.tv_nsec / 1000); continue; } else @@ -1051,11 +1034,7 @@ void nr_schedule_ulsch(module_id_t module_id, } uint16_t rnti = UE_info->rnti[UE_id]; - LOG_D(NR_MAC, "nr_schedule_ulsch UE_id_checking UE_id = %d, rnti = %x, sfn slot = %d.%d \n", - UE_id, rnti, frame, slot); - LOG_D(NR_MAC, "Before consume harq id:"); - dump_nr_list(&sched_ctrl->available_ul_harq); int8_t harq_id = sched_pusch->ul_harq_pid; if (harq_id < 0) { /* PP has not selected a specific HARQ Process, get a new one */ @@ -1064,32 +1043,21 @@ void nr_schedule_ulsch(module_id_t module_id, "no free HARQ process available for UE %d\n", UE_id); remove_front_nr_list(&sched_ctrl->available_ul_harq); - LOG_D(NR_MAC, "Consumed harq id -------------------------> %d", harq_id); sched_pusch->ul_harq_pid = harq_id; } else { /* PP selected a specific HARQ process. Check whether it will be a new * transmission or a retransmission, and remove from the corresponding * list */ if (sched_ctrl->ul_harq_processes[harq_id].round == 0) - { remove_nr_list(&sched_ctrl->available_ul_harq, harq_id); - LOG_D(NR_MAC, "Consumed harq id%d", harq_id); - } else - { remove_nr_list(&sched_ctrl->retrans_ul_harq, harq_id); - LOG_D(NR_MAC, "Retran harq id %d for round %d\n", harq_id, sched_ctrl->ul_harq_processes[harq_id].round); - } } - LOG_D(NR_MAC, "After consume harq id:"); - dump_nr_list(&sched_ctrl->available_ul_harq); NR_UE_ul_harq_t *cur_harq = &sched_ctrl->ul_harq_processes[harq_id]; DevAssert(!cur_harq->is_waiting); add_tail_nr_list(&sched_ctrl->feedback_ul_harq, harq_id); cur_harq->feedback_slot = sched_pusch->slot; cur_harq->is_waiting = true; - LOG_D(NR_MAC, "Updated Feedback ul harq id list:"); - dump_nr_list(&sched_ctrl->feedback_ul_harq); int rnti_types[2] = { NR_RNTI_C, 0 }; @@ -1238,7 +1206,6 @@ void nr_schedule_ulsch(module_id_t module_id, pusch_pdu->pusch_data.new_data_indicator = cur_harq->ndi; pusch_pdu->pusch_data.tb_size = sched_pusch->tb_size; pusch_pdu->pusch_data.num_cb = 0; //CBG not supported - LOG_D(NR_MAC,"Setting harq_id pusch_pdu->pusch_data.harq_process_id %2d for UE_id(%d) rnti %4x sfn slot %4d.%2d\n", harq_id, UE_id, rnti, frame, slot); /* TRANSFORM PRECODING --------------------------------------------------------*/ @@ -1294,8 +1261,7 @@ void nr_schedule_ulsch(module_id_t module_id, pdcch_pdu_bwp_coreset[bwpid][coresetid] = pdcch_pdu; } - LOG_D(NR_MAC,"Configuring ULDCI/PDCCH in %d.%d rnti %x UE id %d pusch harq_id %d sched_pusch->ul_harq_pid %d\n", - frame,slot, rnti, UE_id, pusch_pdu->pusch_data.harq_process_id, sched_pusch->ul_harq_pid); + LOG_D(NR_MAC,"Configuring ULDCI/PDCCH in %d.%d\n", frame,slot); /* Fill PDCCH DL DCI PDU */ nfapi_nr_dl_dci_pdu_t *dci_pdu = &pdcch_pdu->dci_pdu[pdcch_pdu->numDlDci]; @@ -1326,9 +1292,6 @@ void nr_schedule_ulsch(module_id_t module_id, UE_info->UE_sched_ctrl[UE_id].tpc0, n_ubwp, sched_ctrl->active_bwp->bwp_Id); - - LOG_D(NR_MAC,"After config_uldci in %d.%d rnti %x UE id %d uldci payload harq_id %d pusch harq_id %d sched_pusch->ul_harq_pid %d\n", - frame,slot, rnti, UE_id, uldci_payload.harq_pid, pusch_pdu->pusch_data.harq_process_id, sched_pusch->ul_harq_pid); fill_dci_pdu_rel15(scc, secondaryCellGroup, dci_pdu, diff --git a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c index 5f20215fa7..ac287515df 100644 --- a/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c +++ b/openair2/LAYER2/nr_pdcp/nr_pdcp_entity_drb_am.c @@ -47,7 +47,7 @@ void nr_pdcp_entity_drb_am_recv_pdu(nr_pdcp_entity_t *_entity, char *buffer, int if (entity->common.has_ciphering) entity->common.cipher(entity->common.security_context, (unsigned char *)buffer+3, size-3, entity->rb_id, sn, entity->common.is_gnb ? 0 : 1); - LOG_I(RLC, "Melissa Elkadi, calling deliver SDU to send to PDCP from RLC %s\n", __FUNCTION__); + LOG_I(RLC, "Melissa Elkadi, calling deliver SDU to send to GTP from PDCP %s\n", __FUNCTION__); entity->common.deliver_sdu(entity->common.deliver_sdu_data, (nr_pdcp_entity_t *)entity, buffer+3, size-3); } diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index bf1b575f79..a560b554ea 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -73,7 +73,14 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) UL_INFO.module_id = UL_info->module_id; UL_INFO.CC_id = UL_info->CC_id; - if (UL_INFO.rach_ind.number_of_pdus>0) { + int frame_diff = UL_info->frame - rach_ind->sfn; + if (frame_diff < 0) + { + frame_diff += 1024; + } + bool in_timewindow = frame_diff == 0 || (frame_diff == 1 && UL_info->slot < 7); + + if (UL_INFO.rach_ind.number_of_pdus>0 && in_timewindow) { LOG_I(MAC,"UL_info[Frame %d, Slot %d] Calling initiate_ra_proc RACH:SFN/SLOT:%d/%d\n", UL_info->frame, UL_info->slot, UL_INFO.rach_ind.sfn, UL_INFO.rach_ind.slot); int npdus = UL_INFO.rach_ind.number_of_pdus; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index b6f32b6bfb..314ca0471e 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -327,8 +327,6 @@ static void copy_ul_dci_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n { nfapi_nr_ul_dci_request_pdus_t *pdu_list = &ul_dci_req->ul_dci_pdu_list[i]; AssertFatal(pdu_list->PDUType == 0, "ul_dci_req pdu type != PUCCH"); - //if (pdu_list->pdcch_pdu.pdcch_pdu_rel15.dci_pdu->RNTI != get_mac_inst(0)->crnti) - // continue; LOG_I(NR_PHY, "[%d %d] PUCCH PDU in ul_dci for rnti %x\n", ul_dci_req->SFN, ul_dci_req->Slot, pdu_list->pdcch_pdu.pdcch_pdu_rel15.dci_pdu->RNTI); uint16_t num_dci = pdu_list->pdcch_pdu.pdcch_pdu_rel15.numDlDci; if (num_dci > 0) @@ -343,7 +341,6 @@ static void copy_ul_dci_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n nfapi_nr_dl_dci_pdu_t *dci_pdu_list = &pdu_list->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[j]; if (dci_pdu_list->RNTI != mac->crnti) { - LOG_I(NR_MAC, "ul_dci_req Skip: dci_pdu_list->RNTI %x != mac->crnti %x\n", dci_pdu_list->RNTI, get_mac_inst(dl_info->module_id)->crnti); continue; } int num_bytes = (dci_pdu_list->PayloadSizeBits + 7) / 8; @@ -608,11 +605,8 @@ void *nrue_standalone_pnf_task(void *context) if (!put_queue(&nr_sfn_slot_queue, &sfn_slot_pool[sfn_slot_id])) { - LOG_D(NR_MAC, "put_queue failed for sfn slot.\n"); + LOG_E(NR_PHY, "put_queue failed for sfn slot.\n"); } - LOG_D(NR_MAC, "We have successfully queued snf slot %d.%d, with id %u, qsize %zu\n", - sfn_slot_pool[sfn_slot_id]>> 6, sfn_slot_pool[sfn_slot_id] & 0x3F, - sfn_slot_id, nr_sfn_slot_queue.num_items); sfn_slot_id = (sfn_slot_id + 1) % 512; @@ -635,11 +629,8 @@ void *nrue_standalone_pnf_task(void *context) if (!put_queue(&nr_sfn_slot_queue, &sfn_slot_pool[sfn_slot_id])) { - LOG_D(NR_MAC, "put_queue failed for sfn slot.\n"); + LOG_E(NR_PHY, "put_queue failed for sfn slot.\n"); } - LOG_D(NR_MAC, "We have successfully queued snf slot %d.%d, with id %u, qsize %zu\n", - sfn_slot_pool[sfn_slot_id]>> 6, sfn_slot_pool[sfn_slot_id] & 0x3F, - sfn_slot_id, nr_sfn_slot_queue.num_items); sfn_slot_id = (sfn_slot_id + 1) % 512; @@ -650,7 +641,7 @@ void *nrue_standalone_pnf_task(void *context) } sfn = NFAPI_SFNSLOT2SFN(ch_info.sfn_slot); slot = NFAPI_SFNSLOT2SLOT(ch_info.sfn_slot); - LOG_I(MAC, "Received_SINR = %f, sfn:slot %d:%d\n", ch_info.sinr, sfn, slot); + LOG_I(NR_PHY, "Received_SINR = %f, sfn:slot %d:%d\n", ch_info.sinr, sfn, slot); } else { @@ -703,11 +694,11 @@ void *nrue_standalone_pnf_task(void *context) delta = NFAPI_SFNSLOT2DEC(sfn, slot) - NFAPI_SFNSLOT2DEC(ul_dci_request.SFN, ul_dci_request.Slot); if (delta < -NFAPI_SFNSLOT2DEC(512, 0)) { - delta += NFAPI_SFNSLOT2DEC(1024, 0); + delta += NFAPI_SFNSLOT2DEC(1024, 0); } if (delta < 6) { - check_and_process_dci(NULL, NULL, &ul_dci_request, NULL); + check_and_process_dci(NULL, NULL, &ul_dci_request, NULL); } break; case NFAPI_NR_PHY_MSG_TYPE_UL_TTI_REQUEST: