From c7f083b14a231793b3317d52ea7bc9487ade2b52 Mon Sep 17 00:00:00 2001 From: David Kim Date: Wed, 3 Nov 2021 22:30:28 -0700 Subject: [PATCH] Updated gNB part to handle CI test --- common/utils/LOG/log.h | 2 +- executables/nr-ue.c | 3 - nfapi/oai_integration/nfapi_vnf.c | 4 - openair1/PHY/NR_TRANSPORT/pucch_rx.c | 6 + openair1/PHY/NR_UE_TRANSPORT/nr_prach.c | 5 +- openair1/SCHED_NR/phy_procedures_nr_gNB.c | 7 + openair1/SCHED_NR_UE/phy_procedures_nr_ue.c | 10 +- openair2/LAYER2/NR_MAC_UE/config_ue.c | 3 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 52 ++- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 17 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 4 +- .../LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c | 10 +- openair2/NR_PHY_INTERFACE/NR_IF_Module.c | 316 ++++++++++++------ openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 20 +- openair2/RRC/LTE/defs_NB_IoT.h | 2 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 1 + openair2/RRC/NR/rrc_gNB_reconfig.c | 2 +- openair2/RRC/NR_UE/rrc_UE.c | 15 +- 18 files changed, 307 insertions(+), 172 deletions(-) diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index 6083d23580..ce3ada3972 100644 --- a/common/utils/LOG/log.h +++ b/common/utils/LOG/log.h @@ -426,7 +426,7 @@ int32_t write_file_matlab(const char *fname, const char *vname, void *data, int # define LOG_W(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'W', __VA_ARGS__); while (0) # define LOG_A(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'A', __VA_ARGS__); while (0) /* logs intended for analysis */ # define LOG_I(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'I', __VA_ARGS__); while (0) -# define LOG_D(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0) +# define LOG_D(COMPONENT, ...) do if (1) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0) # define LOG_T(COMPONENT, ...) do if (0) logMinimal(COMPONENT, 'T', __VA_ARGS__); while (0) # define LOG_M(FILE, VECTOR, DATA, LEN, DEC, FORMAT) ((void) 0) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index b89646d4d9..5fa314d9af 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -560,7 +560,6 @@ void processSlotTX(void *arg) { ul_indication.thread_id = proc->thread_id; ul_indication.ue_sched_mode = rxtxD->ue_sched_mode; - LOG_I(PHY,"We are here to call ul_indication\n"); UE->if_inst->ul_indication(&ul_indication); } @@ -622,7 +621,6 @@ void processSlotRX(void *arg) { } else { rxtxD->ue_sched_mode = SCHED_ALL; - LOG_I(PHY, "We are calling processSlotTX in processSlotRX \n"); processSlotTX(rxtxD); } @@ -641,7 +639,6 @@ void processSlotRX(void *arg) { } if (UE->UE_mode[gNB_id] > NOT_SYNCHED && UE->UE_mode[gNB_id] < PUSCH) { - LOG_I(PHY, "We are calling nr_ue_prach_procedures in processSlotRX\n"); nr_ue_prach_procedures(UE, proc, gNB_id); } LOG_D(PHY,"****** end TX-Chain for AbsSubframe %d.%d ******\n", proc->frame_tx, proc->nr_slot_tx); diff --git a/nfapi/oai_integration/nfapi_vnf.c b/nfapi/oai_integration/nfapi_vnf.c index 45b5434361..bc2a0353a2 100644 --- a/nfapi/oai_integration/nfapi_vnf.c +++ b/nfapi/oai_integration/nfapi_vnf.c @@ -612,8 +612,6 @@ int phy_sync_indication(struct nfapi_vnf_p7_config *config, uint8_t sync) { return(0); } -uint16_t pnf_frame; -uint16_t pnf_slot; int phy_slot_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uint16_t sfn, uint16_t slot) { static uint8_t first_time = 1; @@ -626,8 +624,6 @@ int phy_slot_indication(struct nfapi_vnf_p7_config *config, uint16_t phy_id, uin if (RC.gNB && RC.gNB[0]->configured) { // uint16_t sfn = NFAPI_SFNSF2SFN(sfn_sf); // uint16_t sf = NFAPI_SFNSF2SF(sfn_sf); - pnf_frame = sfn; - pnf_slot = slot; LOG_D(PHY,"[VNF] slot indication sfn:%d slot:%d\n", sfn, slot); wake_gNB_rxtx(RC.gNB[0], sfn, slot); // DONE: find NR equivalent } else { diff --git a/openair1/PHY/NR_TRANSPORT/pucch_rx.c b/openair1/PHY/NR_TRANSPORT/pucch_rx.c index f030c41d68..5782dd337d 100644 --- a/openair1/PHY/NR_TRANSPORT/pucch_rx.c +++ b/openair1/PHY/NR_TRANSPORT/pucch_rx.c @@ -413,6 +413,7 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, if (pucch_pdu->bit_len_harq==0) { uci_pdu->harq = NULL; uci_pdu->sr = calloc(1,sizeof(*uci_pdu->sr)); + AssertFatal ( uci_pdu->sr != NULL, "Memory allocation failed when pucch_pdu->bit_len_harq == 0\n"); uci_pdu->sr->sr_confidence_level = no_conf ? 1 : 0; uci_stats->pucch0_sr_trials++; if (xrtmag_dBtimes10>(10*gNB->measurements.n0_power_tot_dB)) { @@ -421,10 +422,13 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, } else { uci_pdu->sr->sr_indication = 0; } + LOG_I(PHY, "uci_01->harq->num_harq == 0\n"); } else if (pucch_pdu->bit_len_harq==1) { uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); + AssertFatal ( uci_pdu->harq != NULL, "Memory allocation failed when pucch_pdu->bit_len_harq == 1\n"); uci_pdu->harq->num_harq = 1; + LOG_I(PHY, "uci_01->harq->num_harq %u with uci_pdu %p harq %p\n", uci_pdu->harq->num_harq, uci_pdu, uci_pdu->harq); uci_pdu->harq->harq_confidence_level = no_conf ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(1); uci_pdu->harq->harq_list[0].harq_value = index&0x01; @@ -440,7 +444,9 @@ void nr_decode_pucch0(PHY_VARS_gNB *gNB, } else { uci_pdu->harq = calloc(1,sizeof(*uci_pdu->harq)); + AssertFatal ( uci_pdu->harq != NULL, "Memory allocation failed when pucch_pdu->bit_len_harq > 1\n"); uci_pdu->harq->num_harq = 2; + LOG_I(PHY, "uci_01->harq->num_harq %u with uci_pdu %p harq %p\n", uci_pdu->harq->num_harq, uci_pdu, uci_pdu->harq); uci_pdu->harq->harq_confidence_level = (no_conf) ? 1 : 0; uci_pdu->harq->harq_list = (nfapi_nr_harq_t*)malloc(2); uci_pdu->harq->harq_list[1].harq_value = index&0x01; diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 583c774c79..24299fd788 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -221,11 +221,8 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, uint8_t slot){ k += kbar; k *= 2; - LOG_I(PHY, "PRACH [UE %d] in slot %d, mu %d, fp->samples_per_subframe %d, prach_sequence_length %d, placing PRACH in position %d, msg1 frequency start %d (k1 %d), preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id, + LOG_I(PHY, "PRACH [UE %d] in slot %d, placing PRACH in position %d, msg1 frequency start %d (k1 %d), preamble_offset %d, first_nonzero_root_idx %d\n", Mod_id, slot, - mu, - fp->samples_per_subframe, - prach_sequence_length, k, n_ra_prb, nrUE_config->prach_config.num_prach_fd_occasions_list[fd_occasion].k1, diff --git a/openair1/SCHED_NR/phy_procedures_nr_gNB.c b/openair1/SCHED_NR/phy_procedures_nr_gNB.c index bd44a1e983..513d3e3db6 100644 --- a/openair1/SCHED_NR/phy_procedures_nr_gNB.c +++ b/openair1/SCHED_NR/phy_procedures_nr_gNB.c @@ -682,6 +682,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { offset = pucch_pdu->start_symbol_index*gNB->frame_parms.ofdm_symbol_size + (gNB->frame_parms.first_carrier_offset+pucch_pdu->prb_start*12); power_rxF = signal_energy_nodc(&gNB->common_vars.rxdataF[0][offset],12); LOG_D(PHY,"frame %d, slot %d: PUCCH signal energy %d\n",frame_rx,slot_rx,power_rxF); + LOG_D(PHY,"num_ucis = %d *expecting 0 since it is index in array also (case 0)\n",num_ucis); nr_decode_pucch0(gNB, frame_rx, @@ -691,6 +692,11 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { gNB->UL_INFO.uci_ind.num_ucis += 1; pucch->active = 0; + if (((uci_pdu_format0->pduBitmap >> 1) & 0x01)){ + LOG_I(NR_PHY, "uci_01->harq->num_harq with uci_pdu %p\n", uci_pdu_format0); + LOG_I(NR_PHY, "uci_01->harq->num_harq with uci_pdu %p harq %p\n", uci_pdu_format0, uci_pdu_format0->harq); + LOG_I(NR_PHY, "uci_01->harq->num_harq %u\n", uci_pdu_format0->harq->num_harq); + } break; case 2: num_ucis = gNB->UL_INFO.uci_ind.num_ucis; @@ -700,6 +706,7 @@ int phy_procedures_gNB_uespec_RX(PHY_VARS_gNB *gNB, int frame_rx, int slot_rx) { gNB->uci_pdu_list[num_ucis].pdu_type = NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE; gNB->uci_pdu_list[num_ucis].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_2_3_4_t); nfapi_nr_uci_pucch_pdu_format_2_3_4_t *uci_pdu_format2 = &gNB->uci_pdu_list[num_ucis].pucch_pdu_format_2_3_4; + LOG_D(PHY,"num_ucis = %d in case 1\n",num_ucis); nr_decode_pucch2(gNB, slot_rx, diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index cc7c830d8e..2d3223e635 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -2079,13 +2079,11 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t prach_resources->init_msg1 = 1; } else { + nr_prach = nr_ue_get_rach(prach_resources, &ue->prach_vars[0]->prach_pdu, mod_id, ue->CC_id, frame_tx, gNB_id, nr_slot_tx); LOG_D(PHY, "In %s:[%d.%d] getting PRACH resources : %d\n", __FUNCTION__, frame_tx, nr_slot_tx,nr_prach); } - if (nr_prach > 0) - LOG_I(PHY, "In %s: We are here with nr_prach = %u (GENERATE_PREAMBLE: 1)\n", __FUNCTION__, nr_prach); - if (nr_prach == GENERATE_PREAMBLE) { if (ue->mac_enabled == 1) { @@ -2117,9 +2115,7 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_IN); - LOG_I(PHY, "In %s: We are here to call generate_nr_prach \n", __FUNCTION__); prach_power = generate_nr_prach(ue, gNB_id, nr_slot_tx); - LOG_I(PHY, "In %s: We are here after calling generate_nr_prach \n", __FUNCTION__); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_GENERATE_PRACH, VCD_FUNCTION_OUT); @@ -2132,10 +2128,8 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t dB_fixed(prach_power), ue->prach_vars[gNB_id]->amp); - if (ue->mac_enabled == 1){ + if (ue->mac_enabled == 1) nr_Msg1_transmitted(mod_id, ue->CC_id, frame_tx, gNB_id); - LOG_I(PHY, "In %s: We are here after nr_Msg1_transmitted\n", __FUNCTION__); - } } else if (nr_prach == WAIT_CONTENTION_RESOLUTION) { LOG_D(PHY, "In %s: [UE %d] RA waiting contention resolution\n", __FUNCTION__, mod_id); diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 2220d1d7bd..d223b9ddd7 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -689,7 +689,7 @@ int nr_rrc_mac_config_req_ue( } config_control_ue(mac); if (get_softmodem_params()->nsa) { - if (cell_group_config->spCellConfig->reconfigurationWithSync) { + if (cell_group_config->spCellConfig && cell_group_config->spCellConfig->reconfigurationWithSync) { if (cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated) { ra->rach_ConfigDedicated = cell_group_config->spCellConfig->reconfigurationWithSync->rach_ConfigDedicated->choice.uplink; } @@ -707,6 +707,7 @@ int nr_rrc_mac_config_req_ue( // Setup the SSB to Rach Occasions mapping according to the config build_ssb_to_ro_map(mac); } + /* if(mac_cell_group_configP != NULL){ if(mac_cell_group_configP->drx_Config != NULL ){ diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 4cc4032c57..8accb610b6 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -550,7 +550,7 @@ 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); dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci->dci_format]; - if ((dci->rnti != mac->crnti) && (dci->rnti != mac->ra.ra_rnti) && (dci->rnti != 0xFFFF)) { + if ((dci->rnti != mac->crnti) && (dci->rnti != mac->ra.ra_rnti) && (get_softmodem_params()->nsa)) { LOG_D(MAC,"We skip for the 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); return 0; @@ -2444,7 +2444,7 @@ void nr_ue_send_sdu(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t *u VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SEND_SDU, VCD_FUNCTION_IN); - LOG_I(MAC, "In %s [%d.%d] Handling DLSCH PDU...\n", __FUNCTION__, dl_info->frame, dl_info->slot); + LOG_D(MAC, "In %s [%d.%d] Handling DLSCH PDU...\n", __FUNCTION__, dl_info->frame, dl_info->slot); // Processing MAC PDU // it parses MAC CEs subheaders, MAC CEs, SDU subheaderds and SDUs @@ -3422,7 +3422,7 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, case DL_SCH_LCID_DCCH1: // check if LCID is valid at current time. default: - { + if (get_softmodem_params()->nsa) { // check if LCID is valid at current time. if (pdu_len < sizeof(NR_MAC_SUBHEADER_SHORT)) return; @@ -3472,6 +3472,50 @@ void nr_ue_process_mac_pdu(nr_downlink_indication_t *dl_info, break; } + else + { + // check if LCID is valid at current time. + if(((NR_MAC_SUBHEADER_SHORT *)pduP)->F){ + //mac_sdu_len |= (uint16_t)(((NR_MAC_SUBHEADER_LONG *)pduP)->L2)<<8; + mac_subheader_len = 3; + mac_sdu_len = ((uint16_t)(((NR_MAC_SUBHEADER_LONG *) pduP)->L1 & 0x7f) << 8) + | ((uint16_t)((NR_MAC_SUBHEADER_LONG *) pduP)->L2 & 0xff); + + } else { + mac_sdu_len = (uint16_t)((NR_MAC_SUBHEADER_SHORT *)pduP)->L; + mac_subheader_len = 2; + } + + LOG_D(MAC, "[UE %d] Frame %d : DLSCH -> DL-DTCH %d (gNB %d, %d bytes)\n", module_idP, frameP, rx_lcid, gNB_index, mac_sdu_len); + + #if defined(ENABLE_MAC_PAYLOAD_DEBUG) + LOG_T(MAC, "[UE %d] First 32 bytes of DLSCH : \n", module_idP); + + for (i = 0; i < 32; i++) + LOG_T(MAC, "%x.", (pduP + mac_subheader_len)[i]); + + LOG_T(MAC, "\n"); + #endif + + if (rx_lcid < NB_RB_MAX && rx_lcid >= DL_SCH_LCID_DCCH) { + + mac_rlc_data_ind(module_idP, + mac->crnti, + gNB_index, + frameP, + ENB_FLAG_NO, + MBMS_FLAG_NO, + rx_lcid, + (char *) (pduP + mac_subheader_len), + mac_sdu_len, + 1, + NULL); + } else { + LOG_E(MAC, "[UE %d] Frame %d : unknown LCID %d (gNB %d)\n", module_idP, frameP, rx_lcid, gNB_index); + } + + break; + } } pduP += ( mac_subheader_len + mac_ce_len + mac_sdu_len ); pdu_len -= ( mac_subheader_len + mac_ce_len + mac_sdu_len ); @@ -3651,7 +3695,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t if ((mac->crnti == ra->t_crnti) && (get_softmodem_params()->nsa)) { - LOG_I(MAC, "Discarding the received RAR.\n"); + LOG_D(MAC, "Discarding the received RAR.\n"); return -1; } while (1) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 2455e47b11..9e57abcd35 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -1866,7 +1866,6 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s else { ul_config = &mac->ul_config_request[0]; } - LOG_I(NR_MAC, "We are here to check calling nr_ue_prach_scheduler\n"); fapi_nr_ul_config_prach_pdu *prach_config_pdu; fapi_nr_config_request_t *cfg = &mac->phy_config.config_req; @@ -1897,8 +1896,6 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s &prach_occasion_info_p); if (is_nr_prach_slot && ra->ra_state == RA_UE_IDLE) { - LOG_I(NR_MAC, "We are here to see is_nr_prach_slot = %d, ra->ra_state = %d (RA_UE_IDLE: 0)\n", - is_nr_prach_slot, ra->ra_state); AssertFatal(NULL != prach_occasion_info_p,"PRACH Occasion Info not returned in a valid NR Prach Slot\n"); ra->generate_nr_prach = GENERATE_PREAMBLE; @@ -1906,8 +1903,6 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s format = prach_occasion_info_p->format; format0 = format & 0xff; // single PRACH format format1 = (format >> 8) & 0xff; // dual PRACH format - LOG_I(NR_MAC,"We are here with format0 %u, format1 %u, %s %d\n", - format0, format1, __FUNCTION__, __LINE__); AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]), "Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus); @@ -1932,7 +1927,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s prach_config_pdu->restricted_set = prach_config->restricted_set_config; prach_config_pdu->freq_msg1 = prach_config->num_prach_fd_occasions_list[prach_occasion_info_p->fdm].k1; - LOG_I(NR_MAC,"Selected RO Frame %u, Slot %u, Symbol %u, Fdm %u\n", frameP, prach_config_pdu->prach_slot, prach_config_pdu->prach_start_symbol, prach_config_pdu->num_ra); + LOG_D(NR_MAC,"Selected RO Frame %u, Slot %u, Symbol %u, Fdm %u\n", frameP, prach_config_pdu->prach_slot, prach_config_pdu->prach_start_symbol, prach_config_pdu->num_ra); // Search which SSB is mapped in the RO (among all the SSBs mapped to this RO) for (prach_config_pdu->ssb_nb_in_ro=0; prach_config_pdu->ssb_nb_in_ronb_mapped_ssb; prach_config_pdu->ssb_nb_in_ro++) { @@ -1940,8 +1935,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s break; } AssertFatal(prach_config_pdu->ssb_nb_in_ronb_mapped_ssb, "%u not found in the mapped SSBs to the PRACH occasion", selected_gnb_ssb_idx); - LOG_I(NR_MAC,"We are here Before set prach_config_pdu->prach_format %x, %s %d\n", - prach_config_pdu->prach_format, __FUNCTION__, __LINE__); + if (format1 != 0xff) { switch(format0) { // dual PRACH format case 0xa1: @@ -1995,18 +1989,11 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s AssertFatal(1 == 0, "Invalid PRACH format"); } } // if format1 - LOG_I(NR_MAC,"We are here After set prach_config_pdu->prach_format %x, %s %d\n", - prach_config_pdu->prach_format, __FUNCTION__, __LINE__); fill_scheduled_response(&scheduled_response, NULL, ul_config, NULL, module_idP, 0 /*TBR fix*/, frameP, slotP, thread_id); if(mac->if_module != NULL && mac->if_module->scheduled_response != NULL) mac->if_module->scheduled_response(&scheduled_response); } // is_nr_prach_slot - else - LOG_I(NR_MAC, "We are here to see is_nr_prach_slot = %d, ra->ra_state = %d (RA_UE_IDLE: 0)\n", - is_nr_prach_slot, ra->ra_state); } // if is_nr_UL_slot - else - LOG_I(NR_MAC, "We are here It is not is_nr_UL_slot\n"); } // This function schedules the reception of SIB1 after initial sync and before going to real time state diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 1e84199c89..a3f26aa101 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -535,7 +535,9 @@ void nr_initiate_ra_proc(module_id_t module_idP, if (ra->state == RA_IDLE) { for(int j = 0; j < ra->preambles.num_preambles; j++) { //check if the preamble received correspond to one of the listed or configured preambles - if (preamble_index == ra->preambles.preamble_list[j] && ra->rnti != 0) { + if (preamble_index == ra->preambles.preamble_list[j]) { + if (ra->rnti == 0 && get_softmodem_params()->nsa) + continue; pr_found=1; break; } diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c index 5df7e3d707..f23f7968a8 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_uci.c @@ -1081,6 +1081,11 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, if (((uci_01->pduBitmap >> 1) & 0x01)) { // iterate over received harq bits + + LOG_I(NR_MAC, "uci_01 %p \n", uci_01); + LOG_I(NR_MAC, "uci_01->harq %p \n", uci_01->harq); + LOG_I(NR_MAC, "uci_01->harq->num_harq %u \n", uci_01->harq->num_harq); + for (int harq_bit = 0; harq_bit < uci_01->harq->num_harq; harq_bit++) { const uint8_t harq_value = uci_01->harq->harq_list[harq_bit].harq_value; const uint8_t harq_confidence = uci_01->harq->harq_confidence_level; @@ -1094,7 +1099,10 @@ void handle_nr_uci_pucch_0_1(module_id_t mod_id, remove_front_nr_list(&sched_ctrl->feedback_dl_harq); /* According to nfapi_nr_interface_scf.h, harq_value = 0 is a pass (The check below was for harq_value == 1 in the develop branch) */ - handle_dl_harq(mod_id, UE_id, pid, harq_value == 0 && harq_confidence == 0); + if (get_softmodem_params()->nsa) + handle_dl_harq(mod_id, UE_id, pid, harq_value == 0 && harq_confidence == 0); + else + handle_dl_harq(mod_id, UE_id, pid, harq_value == 1 && harq_confidence == 0); if (harq_confidence == 1) UE_info->mac_stats[UE_id].pucch0_DTX++; } } diff --git a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c index aa10ca0116..27619bfa90 100644 --- a/openair2/NR_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_PHY_INTERFACE/NR_IF_Module.c @@ -63,18 +63,35 @@ extern uint16_t sl_ahead; void handle_nr_rach(NR_UL_IND_t *UL_info) { - if (gnb_rach_ind_queue.num_items ==0) - return; - LOG_I(NR_MAC, "gnb_rach_ind_queue size = %zu\n", gnb_rach_ind_queue.num_items); - nfapi_nr_rach_indication_t *rach_ind = get_queue(&gnb_rach_ind_queue); + if(NFAPI_MODE == NFAPI_MODE_PNF) { + if (UL_info->rach_ind.number_of_pdus>0) { + LOG_D(PHY,"UL_info->UL_info->rach_ind.number_of_pdus:%d SFN/Slot:%d.%d \n", UL_info->rach_ind.number_of_pdus, UL_info->rach_ind.sfn,UL_info->rach_ind.slot); + oai_nfapi_nr_rach_indication(&UL_info->rach_ind); + UL_info->rach_ind.number_of_pdus = 0; + } + return; + } NR_UL_IND_t UL_INFO; - UL_INFO.rach_ind = *rach_ind; - UL_INFO.frame = rach_ind->sfn; - UL_INFO.slot = rach_ind->slot; - UL_INFO.module_id = UL_info->module_id; - UL_INFO.CC_id = UL_info->CC_id; + nfapi_nr_rach_indication_t *rach_ind = NULL; + if (get_softmodem_params()->nsa) + { + if (gnb_rach_ind_queue.num_items ==0) + return; + LOG_I(NR_MAC, "gnb_rach_ind_queue size = %zu\n", gnb_rach_ind_queue.num_items); + rach_ind = get_queue(&gnb_rach_ind_queue); - int frame_diff = UL_info->frame - rach_ind->sfn; + UL_INFO.rach_ind = *rach_ind; + UL_INFO.module_id = UL_info->module_id; + UL_INFO.CC_id = UL_info->CC_id; + } + else + { + UL_INFO.rach_ind = UL_info->rach_ind; + UL_INFO.module_id = UL_info->module_id; + UL_INFO.CC_id = UL_info->CC_id; + } + + int frame_diff = UL_info->frame - UL_INFO.rach_ind.sfn; if (frame_diff < 0) { frame_diff += 1024; @@ -101,28 +118,53 @@ void handle_nr_rach(NR_UL_IND_t *UL_info) UL_INFO.rach_ind.pdu_list[i].preamble_list[0].timing_advance); } } - if (rach_ind && rach_ind->number_of_pdus > 0) + if (get_softmodem_params()->nsa) { - for(int i = 0; i < rach_ind->number_of_pdus; i++) - free(rach_ind->pdu_list[i].preamble_list); - free(rach_ind->pdu_list); + if (rach_ind && rach_ind->number_of_pdus > 0) + { + for(int i = 0; i < rach_ind->number_of_pdus; i++) + { + free(rach_ind->pdu_list[i].preamble_list); + rach_ind->pdu_list[i].preamble_list = NULL; + } + free(rach_ind->pdu_list); + rach_ind->pdu_list = NULL; + } + free(rach_ind); + rach_ind = NULL; } - free(rach_ind); } void handle_nr_uci(NR_UL_IND_t *UL_info) { - if (gnb_uci_ind_queue.num_items ==0) - return; - LOG_I(NR_MAC, "gnb_uci_ind_queue size = %zu\n", gnb_uci_ind_queue.num_items); - nfapi_nr_uci_indication_t *uci_ind = get_queue(&gnb_uci_ind_queue); + if(NFAPI_MODE == NFAPI_MODE_PNF) { + if (UL_info->uci_ind.num_ucis>0) { + LOG_D(PHY,"PNF Sending UL_info->num_ucis:%d PDU_type: %d, SFN/SF:%d.%d \n", UL_info->uci_ind.num_ucis, UL_info->uci_ind.uci_list[0].pdu_type ,UL_info->frame, UL_info->slot); + oai_nfapi_nr_uci_indication(&UL_info->uci_ind); + UL_info->uci_ind.num_ucis = 0; + } + return; + } + NR_UL_IND_t UL_INFO; - UL_INFO.uci_ind = *uci_ind; + nfapi_nr_uci_indication_t *uci_ind = NULL; + if (get_softmodem_params()->nsa) + { + if (gnb_uci_ind_queue.num_items ==0) + return; + LOG_I(NR_MAC, "gnb_uci_ind_queue size = %zu\n", gnb_uci_ind_queue.num_items); + uci_ind = get_queue(&gnb_uci_ind_queue); + UL_INFO.uci_ind = *uci_ind; + } + else + { + UL_INFO.uci_ind = UL_info->uci_ind; + } const module_id_t mod_id = UL_info->module_id; - const frame_t frame = UL_INFO.uci_ind.sfn; - const sub_frame_t slot = UL_INFO.uci_ind.slot; + const frame_t frame = UL_INFO.uci_ind.sfn;//TODO: Need to check to use UL_info->frame; + const sub_frame_t slot = UL_INFO.uci_ind.slot;//TODO: Need to check to use UL_info->slot; int num_ucis = UL_INFO.uci_ind.num_ucis; nfapi_nr_uci_t *uci_list = UL_INFO.uci_ind.uci_list; @@ -149,23 +191,30 @@ void handle_nr_uci(NR_UL_IND_t *UL_info) } } - for (int i = 0; i < num_ucis; i++) { - switch (uci_list[i].pdu_type) { - case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: - free(uci_list[i].pucch_pdu_format_0_1.harq->harq_list); - free(uci_list[i].pucch_pdu_format_0_1.harq); - break; + if (get_softmodem_params()->nsa) + { + for (int i = 0; i < num_ucis; i++) { + switch (uci_list[i].pdu_type) { + case NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE: + free(uci_list[i].pucch_pdu_format_0_1.harq->harq_list); + free(uci_list[i].pucch_pdu_format_0_1.harq); + break; - case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: - free(uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload); - free(uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload); - free(uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload); - break; + case NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE: + free(uci_list[i].pucch_pdu_format_2_3_4.harq.harq_payload); + free(uci_list[i].pucch_pdu_format_2_3_4.csi_part1.csi_part1_payload); + free(uci_list[i].pucch_pdu_format_2_3_4.csi_part2.csi_part2_payload); + break; + } } + if (uci_ind && num_ucis > 0) + free(uci_list); + free(uci_ind); + } + else + { + UL_info->uci_ind.num_ucis = 0; } - if (uci_ind && num_ucis > 0) - free(uci_list); - free(uci_ind); } static bool crc_sfn_slot_matcher(void *wanted, void *candidate) @@ -190,39 +239,70 @@ static bool crc_sfn_slot_matcher(void *wanted, void *candidate) void handle_nr_ulsch(NR_UL_IND_t *UL_info) { - nfapi_nr_rx_data_indication_t *rx_ind = get_queue(&gnb_rx_ind_queue); - if (!rx_ind) - { - LOG_D(NR_PHY, "No rx data indication (empty gnb_rx_ind_queue)\n"); - return; - } - int sfn_slot = NFAPI_SFNSLOT2HEX(rx_ind->sfn, rx_ind->slot); - - nfapi_nr_crc_indication_t *crc_ind = unqueue_matching(&gnb_crc_ind_queue, - MAX_QUEUE_SIZE, - crc_sfn_slot_matcher, - &sfn_slot); - if (!crc_ind) - { - LOG_D(NR_PHY, "No crc indication with the same SFN SLOT of rx indication %u %u\n", rx_ind->sfn, rx_ind->slot); - put_queue(&gnb_rx_ind_queue, rx_ind); + if(NFAPI_MODE == NFAPI_MODE_PNF) { + if (UL_info->crc_ind.number_crcs>0) { + LOG_D(PHY,"UL_info->UL_info->crc_ind.number_crcs:%d CRC_IND:SFN/Slot:%d.%d\n", UL_info->crc_ind.number_crcs, UL_info->crc_ind.sfn, UL_info->crc_ind.slot); + oai_nfapi_nr_crc_indication(&UL_info->crc_ind); + UL_info->crc_ind.number_crcs = 0; + } + + if (UL_info->rx_ind.number_of_pdus>0) { + LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/Slot:%d.%d \n", UL_info->rx_ind.number_of_pdus, UL_info->rx_ind.sfn, UL_info->rx_ind.slot); + oai_nfapi_nr_rx_data_indication(&UL_info->rx_ind); + UL_info->rx_ind.number_of_pdus = 0; + } return; } NR_UL_IND_t UL_INFO; - UL_INFO.rx_ind = *rx_ind; - UL_INFO.crc_ind = *crc_ind; - UL_INFO.frame = rx_ind->sfn; - UL_INFO.slot = rx_ind->slot; + nfapi_nr_rx_data_indication_t *rx_ind = NULL; + nfapi_nr_crc_indication_t *crc_ind = NULL; + if (get_softmodem_params()->nsa) + { + rx_ind = get_queue(&gnb_rx_ind_queue); + if (!rx_ind) + { + LOG_D(NR_PHY, "No rx data indication (empty gnb_rx_ind_queue)\n"); + return; + } + + int sfn_slot = NFAPI_SFNSLOT2HEX(rx_ind->sfn, rx_ind->slot); + + crc_ind = unqueue_matching(&gnb_crc_ind_queue, + MAX_QUEUE_SIZE, + crc_sfn_slot_matcher, + &sfn_slot); + if (!crc_ind) + { + LOG_D(NR_PHY, "No crc indication with the same SFN SLOT of rx indication %u %u\n", rx_ind->sfn, rx_ind->slot); + put_queue(&gnb_rx_ind_queue, rx_ind); + return; + } + + UL_INFO.rx_ind = *rx_ind; + UL_INFO.crc_ind = *crc_ind; + UL_INFO.module_id = UL_info->module_id; + UL_INFO.CC_id = UL_info->CC_id; + } + else + { + UL_INFO.rx_ind = UL_info->rx_ind; + UL_INFO.crc_ind = UL_info->crc_ind; + UL_INFO.module_id = UL_info->module_id; + UL_INFO.CC_id = UL_info->CC_id; + } + + UL_INFO.frame = UL_INFO.rx_ind.sfn;//TODO: Need to check to use UL_info->frame; + UL_INFO.slot = UL_INFO.rx_ind.slot;//TODO: Need to check to use UL_info->slot; UL_INFO.module_id = UL_info->module_id; UL_INFO.CC_id = UL_info->CC_id; - LOG_I(NR_MAC, " UL_info frame slot vs rx_ind frame slot vs crc_ind slot frame slot = %u %u vs %u %u vs %u %u\n", + LOG_D(NR_MAC, " UL_info frame slot vs rx_ind frame slot vs crc_ind slot frame slot = %u %u vs %u %u vs %u %u\n", UL_info->frame, UL_info->slot, - rx_ind->sfn, rx_ind->slot, - crc_ind->sfn, crc_ind->slot + UL_INFO.rx_ind.sfn, UL_INFO.rx_ind.slot, + UL_INFO.crc_ind.sfn, UL_INFO.crc_ind.slot ); - if (rx_ind && UL_INFO.rx_ind.number_of_pdus > 0 && crc_ind && UL_INFO.crc_ind.number_crcs > 0) { + if (UL_INFO.rx_ind.number_of_pdus > 0 && UL_INFO.crc_ind.number_crcs > 0) { for (int i = 0; i < UL_INFO.rx_ind.number_of_pdus; i++) { int j; for (j = 0; j < UL_INFO.crc_ind.number_crcs; j++) { @@ -264,58 +344,68 @@ void handle_nr_ulsch(NR_UL_IND_t *UL_info) handle_nr_ul_harq(UL_INFO.CC_id, UL_INFO.module_id, UL_INFO.frame, UL_INFO.slot, crc); break; } // for (j=0;jnsa) { - crc_ind->crc_list[j] = crc_ind->crc_list[last]; - UL_INFO.crc_ind.number_crcs--; - } - else if (j == last) - { - UL_INFO.crc_ind.number_crcs--; - } + int last = UL_INFO.crc_ind.number_crcs - 1; + if (j < last) + { + crc_ind->crc_list[j] = crc_ind->crc_list[last]; + UL_INFO.crc_ind.number_crcs--; + } + else if (j == last) + { + UL_INFO.crc_ind.number_crcs--; + } - last = UL_INFO.rx_ind.number_of_pdus - 1; - if (i < last) - { - rx_ind->pdu_list[i] = rx_ind->pdu_list[last]; - UL_INFO.rx_ind.number_of_pdus--; - i--; - } - else if (i == last) - { - UL_INFO.rx_ind.number_of_pdus--; + last = UL_INFO.rx_ind.number_of_pdus - 1; + if (i < last) + { + rx_ind->pdu_list[i] = rx_ind->pdu_list[last]; + UL_INFO.rx_ind.number_of_pdus--; + i--; + } + else if (i == last) + { + UL_INFO.rx_ind.number_of_pdus--; + } } } // for (i=0;insa) + { + if (UL_INFO.crc_ind.number_crcs > 0) + { + crc_ind->number_crcs = UL_INFO.crc_ind.number_crcs; + requeue(&gnb_crc_ind_queue, crc_ind); + } - if (UL_INFO.crc_ind.number_crcs > 0) - { - crc_ind->number_crcs = UL_INFO.crc_ind.number_crcs; - requeue(&gnb_crc_ind_queue, crc_ind); - } + if (UL_INFO.rx_ind.number_of_pdus > 0) + { + rx_ind->number_of_pdus = UL_INFO.rx_ind.number_of_pdus; + requeue(&gnb_rx_ind_queue, rx_ind); + } - if (UL_INFO.rx_ind.number_of_pdus > 0) - { - rx_ind->number_of_pdus = UL_INFO.rx_ind.number_of_pdus; - requeue(&gnb_rx_ind_queue, rx_ind); + if (UL_INFO.crc_ind.number_crcs == 0) + { + free(crc_ind->crc_list); + crc_ind->crc_list = NULL; + free(crc_ind); + crc_ind = NULL; + } + if (UL_INFO.rx_ind.number_of_pdus == 0) + { + free(rx_ind->pdu_list); + rx_ind->pdu_list = NULL; + free(rx_ind); + rx_ind = NULL; + } } - - if (UL_INFO.crc_ind.number_crcs == 0) + else { - free(crc_ind->crc_list); - crc_ind->crc_list = NULL; - free(crc_ind); - crc_ind = NULL; + UL_INFO.crc_ind.number_crcs = 0; + UL_INFO.rx_ind.number_of_pdus = 0; } - if (UL_INFO.rx_ind.number_of_pdus == 0) - { - free(rx_ind->pdu_list); - rx_ind->pdu_list = NULL; - free(rx_ind); - rx_ind = NULL; - } - } else if ((rx_ind && UL_INFO.rx_ind.number_of_pdus != 0) - || (crc_ind && UL_INFO.crc_ind.number_crcs != 0)) { + } else if ((UL_INFO.rx_ind.number_of_pdus != 0) + || (UL_INFO.crc_ind.number_crcs != 0)) { LOG_E(NR_PHY, "hoping not to have mis-match between CRC ind and RX ind - " "hopefully the missing message is coming shortly " @@ -343,6 +433,18 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { UL_info->frame,UL_info->slot, module_id,CC_id, gnb_rach_ind_queue.num_items, gnb_rx_ind_queue.num_items, gnb_crc_ind_queue.num_items); +/* + LOG_I(MAC, "uci_01->harq->num_harq %u with uci_pdu %p harq %p\n", + UL_info->uci_ind.uci_list->pucch_pdu_format_0_1.harq->num_harq, + &UL_info->uci_ind.uci_list->pucch_pdu_format_0_1, + UL_info->uci_ind.uci_list->pucch_pdu_format_0_1.harq); +*/ + handle_nr_rach(UL_info); + + handle_nr_uci(UL_info); + // clear UL DCI prior to handling ULSCH + mac->UL_dci_req[CC_id].numPdus = 0; + handle_nr_ulsch(UL_info); if (NFAPI_MODE != NFAPI_MODE_PNF) { @@ -356,14 +458,6 @@ void NR_UL_indication(NR_UL_IND_t *UL_info) { ifi->CC_mask |= (1<UL_dci_req[CC_id].numPdus = 0; - handle_nr_ulsch(UL_info); - if (ifi->CC_mask == ((1<rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid = g_harq_pid; + if (get_softmodem_params()->nsa) + dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.harq_pid = g_harq_pid; update_harq_status(dl_info, pdu_id); if(dl_info->rx_ind->rx_indication_body[pdu_id].pdsch_pdu.ack_nack) @@ -844,7 +845,6 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ if (ul_info->ue_sched_mode == ONLY_PUSCH) { ret = nr_ue_scheduler(NULL, ul_info); - LOG_I(NR_MAC, "In nr_ue_ul_indication: We are to return due to ul_info->ue_sched_mode == ONLY_PUSCH\n"); return 0; } if (ul_info->ue_sched_mode == SCHED_ALL) { @@ -857,10 +857,7 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon = mac->scc != NULL ? mac->scc->tdd_UL_DL_ConfigurationCommon : mac->scc_SIB->tdd_UL_DL_ConfigurationCommon; if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) && !get_softmodem_params()->phy_test) - { - LOG_I(NR_MAC, "In nr_ue_ul_indication: We are here to call nr_ue_prach_scheduler \n"); nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); - } if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type)) nr_ue_pucch_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx, ul_info->thread_id); @@ -905,11 +902,14 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ dl_info->slot, dl_info->dci_ind->dci_list+i); - fapi_nr_dci_indication_pdu_t *dci_index = dl_info->dci_ind->dci_list+i; - dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci_index->dci_format]; - g_harq_pid = def_dci_pdu_rel15->harq_pid; - LOG_D(NR_MAC, "Setting harq_pid = %d and dci_index = %d (based on format)\n", g_harq_pid, dci_index->dci_format); - memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15)); + if (get_softmodem_params()->nsa) + { + fapi_nr_dci_indication_pdu_t *dci_index = dl_info->dci_ind->dci_list+i; + dci_pdu_rel15_t *def_dci_pdu_rel15 = &mac->def_dci_pdu_rel15[dci_index->dci_format]; + g_harq_pid = def_dci_pdu_rel15->harq_pid; + LOG_D(NR_MAC, "Setting harq_pid = %d and dci_index = %d (based on format)\n", g_harq_pid, dci_index->dci_format); + memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15)); + } ret_mask |= (ret << FAPI_NR_DCI_IND); if (ret >= 0) { diff --git a/openair2/RRC/LTE/defs_NB_IoT.h b/openair2/RRC/LTE/defs_NB_IoT.h index 37a26086b5..3907d2321d 100644 --- a/openair2/RRC/LTE/defs_NB_IoT.h +++ b/openair2/RRC/LTE/defs_NB_IoT.h @@ -148,7 +148,7 @@ typedef struct UE_RRC_INFO_NB_IoT_s { //Measurement Report not supported in NB-IoT #define PAYLOAD_SIZE_MAX 1024 -#define RRC_BUF_SIZE 512 +#define RRC_BUF_SIZE 8192 #define UNDEF_SECURITY_MODE 0xff #define NO_SECURITY_MODE 0x20 diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 6e91410411..d58e60dfbb 100755 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -1034,6 +1034,7 @@ void fill_initial_SpCellConfig(rnti_t rnti, NR_PUCCH_Resource_t *pucchres0=calloc(1,sizeof(*pucchres0)); pucchres0->pucch_ResourceId=0; pucchres0->startingPRB=0;//(8+rnti) % curr_bwp; + //pucchres0->startingPRB = (8+rnti) % curr_bwp; LOG_D(NR_RRC, "pucchres0->startPRB %ld rnti %d curr_bwp %d\n", pucchres0->startingPRB, rnti, curr_bwp); pucchres0->intraSlotFrequencyHopping=NULL; pucchres0->secondHopPRB=NULL; diff --git a/openair2/RRC/NR/rrc_gNB_reconfig.c b/openair2/RRC/NR/rrc_gNB_reconfig.c index ebe6af57fd..be4f2ef78e 100644 --- a/openair2/RRC/NR/rrc_gNB_reconfig.c +++ b/openair2/RRC/NR/rrc_gNB_reconfig.c @@ -945,7 +945,7 @@ void fill_default_secondaryCellGroup(NR_ServingCellConfigCommon_t *servingcellco long *delay[8]; for (int i=0;i<8;i++) { delay[i] = calloc(1,sizeof(*delay[i])); - *delay[i] = i + 6; + *delay[i] = (i<6) ? (i+2) : 0;//TODO: Needs to check to use i + 6; ASN_SEQUENCE_ADD(&pucch_Config->dl_DataToUL_ACK->list,delay[i]); } pucch_Config->spatialRelationInfoToAddModList = calloc(1,sizeof(*pucch_Config->spatialRelationInfoToAddModList)); diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 10c2109477..03af93e59b 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -248,17 +248,20 @@ int8_t nr_rrc_ue_process_rrcReconfiguration(const module_id_t module_id, NR_RRCR if(NR_UE_rrc_inst[module_id].radio_bearer_config == NULL){ NR_UE_rrc_inst[module_id].radio_bearer_config = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig; }else{ - protocol_ctxt_t ctxt; - NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_id, ENB_FLAG_YES, mac->crnti, 0, 0, 0); + //protocol_ctxt_t ctxt; + //NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); + //PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_id, ENB_FLAG_YES, mac->crnti, 0, 0, 0); struct NR_RadioBearerConfig *RadioBearerConfig = rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->radioBearerConfig; - xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)RadioBearerConfig); + //xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void*)RadioBearerConfig); LOG_D(NR_RRC, "Calling fill_default_rbconfig_ue at %d with: e_rab_id = %ld, drbID = %ld, cipher_algo = %ld, key = %ld \n", __LINE__, RadioBearerConfig->drb_ToAddModList->list.array[0]->cnAssociation->choice.eps_BearerIdentity, RadioBearerConfig->drb_ToAddModList->list.array[0]->drb_Identity, RadioBearerConfig->securityConfig->securityAlgorithmConfig->cipheringAlgorithm, *RadioBearerConfig->securityConfig->keyToUse); - nr_rrc_ue_process_RadioBearerConfig(&ctxt, 0, RadioBearerConfig); + //nr_rrc_ue_process_RadioBearerConfig(&ctxt, 0, RadioBearerConfig); + if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { + xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *) RadioBearerConfig); + } } } if(rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->secondaryCellGroup != NULL){ @@ -408,11 +411,9 @@ void process_nsa_message(NR_UE_RRC_INST_t *rrc, nsa_message_t nsa_message_type, SEQUENCE_free( &asn_DEF_NR_RadioBearerConfig, RadioBearerConfig, 1 ); return; } -#if 0 if ( LOG_DEBUGFLAG(DEBUG_ASN1) ) { xer_fprint(stdout, &asn_DEF_NR_RadioBearerConfig, (const void *) RadioBearerConfig); } -#endif #if 0 protocol_ctxt_t ctxt; NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);