From 1dec9dd9f6624436dc108e77615accf35e83c0d2 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Fri, 29 Oct 2021 13:49:56 -0700 Subject: [PATCH 01/29] First attempt at receiving MIB and SIB in SA mode --- .../gnb.band78.sa.fr1.106PRB.usrpn310.conf | 30 +++++++----- common/utils/LOG/log.h | 2 +- executables/nr-ue.c | 16 +++++-- executables/nr-uesoftmodem.c | 5 +- executables/nr-uesoftmodem.h | 1 + executables/softmodem-common.h | 4 ++ openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 7 +-- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 2 + .../LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 5 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 16 +++++-- openair2/RRC/NR/rrc_gNB.c | 13 +++-- openair2/RRC/NR_UE/rrc_UE.c | 5 +- openair2/RRC/NR_UE/rrc_proto.h | 2 + .../gnb.sa.band78.fr1.106PRB.usrpb210.conf | 48 +++++++------------ 14 files changed, 89 insertions(+), 67 deletions(-) diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf index 1cca2c9268..740313abfc 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -205,7 +205,7 @@ gNBs = ////////// AMF parameters: - amf_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; + amf_ip_address = ( { ipv4 = "192.168.61.195"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -215,10 +215,10 @@ gNBs = NETWORK_INTERFACES : { - GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "CI_GNB_IP_ADDR"; - GNB_INTERFACE_NAME_FOR_NGU = "eth0"; - GNB_IPV4_ADDRESS_FOR_NGU = "CI_GNB_IP_ADDR"; + GNB_INTERFACE_NAME_FOR_NG_AMF = "lo:"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "127.0.0.2"; + GNB_INTERFACE_NAME_FOR_NGU = "lo:"; + GNB_IPV4_ADDRESS_FOR_NGU = "127.0.0.2"; GNB_PORT_FOR_NGU = 2152; # Spec 2152 }; @@ -226,14 +226,18 @@ gNBs = ); MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - pusch_TargetSNRx10 = 200; - pucch_TargetSNRx10 = 150; - ulsch_max_slots_inactivity = 10; - } + { + num_cc = 1; + local_s_if_name = "lo:"; + remote_s_address = "127.0.0.1"; // pnf addr [!] + local_s_address = "127.0.0.2"; // vnf addr + local_s_portc = 50601; // vnf p5 port + remote_s_portc = 50600; // pnf p5 port [!] + local_s_portd = 50611; // vnf p7 port [!] + remote_s_portd = 50610; // pnf p7 port [!] + tr_s_preference = "nfapi"; + tr_n_preference = "local_RRC"; + } ); L1s = ( 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 fc69cf2722..e1c04bc1a9 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -314,13 +314,15 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot) { LOG_E(NR_MAC, "[%d %d] No corresponding tx_data_request for given dl_tti_request sfn/slot\n", NFAPI_SFNSLOT2SFN(dl_tti_sfn_slot), NFAPI_SFNSLOT2SLOT(dl_tti_sfn_slot)); - save_nr_measurement_info(dl_tti_request); + if (get_softmodem_params()->nsa) + save_nr_measurement_info(dl_tti_request); free(dl_tti_request); dl_tti_request = NULL; } else if (dl_tti_request->dl_tti_request_body.nPDUs > 0 && tx_data_request->Number_of_PDUs > 0) { - save_nr_measurement_info(dl_tti_request); + if (get_softmodem_params()->nsa) + save_nr_measurement_info(dl_tti_request); check_and_process_dci(dl_tti_request, tx_data_request, NULL, NULL); } else @@ -432,9 +434,15 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) module_id_t mod_id = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); - if (mac->scc == NULL) + if (mac->scc == NULL || mac->scc_SIB == NULL) //Melissa TODO this isnt correct { - LOG_D(MAC, "mac->scc == NULL!\n"); + if (get_softmodem_params()->sa && get_softmodem_params()->emulate_l2) + { + LOG_D(NR_MAC, "We haven't gotten MIB or SIB yet. Lets see if we received it\n"); + nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); + process_queued_nr_nfapi_msgs(mac, sfn_slot); + } + LOG_D(MAC, "mac->scc == NULL or mac->scc_SIB == NULL!\n"); continue; } diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index fc72eb51dc..3e279f6108 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -493,7 +493,10 @@ int main( int argc, char **argv ) { exit(-1); } - if (!get_softmodem_params()->nsa) { + if (get_softmodem_params()->emulate_l2) + start_oai_nrue_threads(); + + if (!get_softmodem_params()->nsa && !get_softmodem_params()->emulate_l2) { for (int CC_id=0; CC_iddef_dci_pdu_rel15[dci->dci_format]; - if ((dci->rnti != mac->crnti) && (dci->rnti != mac->ra.ra_rnti)) { + if ((dci->rnti != mac->crnti) && (dci->rnti != mac->ra.ra_rnti) && (dci->rnti != 0xffff)) { 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; @@ -2512,7 +2512,8 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, N_RB_UL = NRRIV2BW(mac->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); } - LOG_D(MAC,"nr_extract_dci_info : dci_pdu %lx, size %d\n",*dci_pdu,dci_size); + LOG_D(MAC,"nr_extract_dci_info : dci_pdu %lx, size %d, rnti_type %d, dci_format %d\n", + *dci_pdu, dci_size, rnti_type, dci_format); switch(dci_format) { case NR_DL_DCI_FORMAT_1_0: @@ -2568,7 +2569,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, dci_pdu_rel15 = &mac->def_dci_pdu_rel15[NR_UL_DCI_FORMAT_0_0]; return 2+nr_extract_dci_info(mac, NR_UL_DCI_FORMAT_0_0, dci_size, rnti, dci_pdu, dci_pdu_rel15); } -#ifdef DEBUG_EXTRACT_DCI +#if 1 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); #endif diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index bfdb07a61c..24da89763c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -887,8 +887,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in nr_scheduled_response_t scheduled_response; nr_dcireq_t dcireq; + LOG_D(MAC,"Melissa we got herre %s():%d\n", __FUNCTION__, __LINE__); if(mac->cg != NULL){ // we have a cg + LOG_D(MAC,"Melissa we got herre %s():%d\n", __FUNCTION__, __LINE__); dcireq.module_id = mod_id; dcireq.gNB_index = gNB_index; dcireq.cc_id = cc_id; diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index 79f6dbee1b..a4a7e18a3f 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -396,8 +396,9 @@ uint32_t schedule_control_sib1(module_id_t module_id, rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3; } while (TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); - AssertFatal(TBS>=gNB_mac->sched_ctrlCommon->num_total_bytes,"Couldn't allocate enough resources for %d bytes in SIB1 PDSCH\n", - gNB_mac->sched_ctrlCommon->num_total_bytes); + AssertFatal(TBS>=gNB_mac->sched_ctrlCommon->num_total_bytes, + "Couldn't allocate (TBS = %d) enough resources for %d bytes in SIB1 PDSCH\n", + TBS, gNB_mac->sched_ctrlCommon->num_total_bytes); gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize = rbSize; gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart = 0; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index ed33aa58f9..ad1d68028e 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -271,6 +271,7 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ { 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) && + (dci_pdu_list->RNTI != 0xffff) && ((dci_pdu_list->RNTI != mac->ra.ra_rnti) || mac->ra.RA_RAPID_found)) { LOG_D(NR_MAC, "We are filtering PDCCH DCI pdu because RNTI doesnt match!\n"); @@ -341,7 +342,12 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi for (int i = 0; i < num_pdus; i++) { nfapi_nr_pdu_t *pdu_list = &tx_data_request->pdu_list[i]; - if(mac->ra.ra_state <= WAIT_RAR) + if (dl_info->dci_ind->number_of_dcis > 0 && dl_info->dci_ind->dci_list[i].rnti == 0xffff) //Melissa this is bad find a better way + { + fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_SIB); + pdu_idx++; + } + else if(mac->ra.ra_state <= WAIT_RAR) { fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_RAR); pdu_idx++; @@ -548,7 +554,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, int slot = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(0); - if (mac->scc == NULL) + if (mac->scc == NULL) //Melissa, if we comment this out, we see the SIB! { return; } @@ -734,10 +740,11 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea ul_tti_request->SFN, ul_tti_request->Slot); if (nr_uci_ind_queue.num_items > 0) //TODO: In the future UL_TTIs can be for ULSCH and SRS. { - LOG_I(NR_MAC, "Melissa, we added UL_TTI_REQ to queue for sfn slot %d %d\n", + LOG_D(NR_MAC, "We added UL_TTI_REQ to queue for sfn slot %d %d\n", ul_tti_request->SFN, ul_tti_request->Slot); if (!put_queue(&nr_ul_tti_req_queue, ul_tti_request)) { + LOG_D(NR_PHY, "put_queue failed for nr_ul_tti_req_queue.\n"); reset_queue(&nr_ul_tti_req_queue); if (!put_queue(&nr_ul_tti_req_queue, ul_tti_request)) { @@ -754,10 +761,11 @@ static void enqueue_nr_nfapi_msg(void *buffer, ssize_t len, nfapi_p7_message_hea mitigate proxy timing issues. */ else if (nr_uci_ind_queue.num_items == 0) { - LOG_I(NR_MAC, "Melissa, we added UL_TTI_REQ to queue for sfn slot %d %d\n", + LOG_D(NR_MAC, "We added UL_TTI_REQ to wait queue for sfn slot %d %d\n", ul_tti_request->SFN, ul_tti_request->Slot); if (!put_queue(&nr_wait_ul_tti_req_queue, ul_tti_request)) { + LOG_D(NR_PHY, "put_queue failed for nr_wait_ul_tti_req_queue.\n"); reset_queue(&nr_wait_ul_tti_req_queue); if (!put_queue(&nr_wait_ul_tti_req_queue, ul_tti_request)) { diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 2c05528a57..071d61ec1d 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -214,16 +214,19 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) { LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { + if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type) || get_softmodem_params()->emulate_l2) { rrc->carrier.MIB = (uint8_t *) malloc16(4); rrc->carrier.sizeof_MIB = do_MIB_NR(rrc,0); } - if((get_softmodem_params()->sa) && ( (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)))) { - rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier,configuration); + if(get_softmodem_params()->sa && + ((NODE_IS_DU(rrc->node_type) || + NODE_IS_MONOLITHIC(rrc->node_type) || + get_softmodem_params()->emulate_l2))) { + rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier, configuration); } - if (!NODE_IS_DU(rrc->node_type)) { + else if (!NODE_IS_DU(rrc->node_type)) { rrc->carrier.SIB23 = (uint8_t *) malloc16(100); AssertFatal(rrc->carrier.SIB23 != NULL, "cannot allocate memory for SIB"); rrc->carrier.sizeof_SIB23 = do_SIB23_NR(&rrc->carrier, configuration); @@ -233,7 +236,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration LOG_I(NR_RRC,"Done init_NR_SI\n"); - if (NODE_IS_MONOLITHIC(rrc->node_type)){ + if (NODE_IS_MONOLITHIC(rrc->node_type) || get_softmodem_params()->emulate_l2){ rrc_mac_config_req_gNB(rrc->module_id, rrc->carrier.ssb_SubcarrierOffset, rrc->carrier.pdsch_AntennaPorts, diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 6a45794e16..d6b1e00336 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -201,8 +201,6 @@ extern rlc_op_status_t nr_rrc_rlc_config_asn1_req (const protocol_ctxt_t * con const LTE_PMCH_InfoList_r9_t * const pmch_InfoList_r9_pP, struct NR_CellGroupConfig__rlc_BearerToAddModList *rlc_bearer2add_list); -static void start_oai_nrue_threads(void); - // from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded) int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const module_id_t module_id, const uint8_t *buffer, @@ -2767,7 +2765,8 @@ void *recv_msgs_from_lte_ue(void *args_p) } return NULL; } -static void start_oai_nrue_threads() + +void start_oai_nrue_threads() { init_queue(&nr_rach_ind_queue); init_queue(&nr_rx_ind_queue); diff --git a/openair2/RRC/NR_UE/rrc_proto.h b/openair2/RRC/NR_UE/rrc_proto.h index 3c074b04ef..f13ad8805d 100644 --- a/openair2/RRC/NR_UE/rrc_proto.h +++ b/openair2/RRC/NR_UE/rrc_proto.h @@ -169,6 +169,8 @@ void init_connections_with_lte_ue(void); void nsa_sendmsg_to_lte_ue(const void *message, size_t msg_len, MessagesIds msg_type); +void start_oai_nrue_threads(void); + /**\brief RRC UE generate RRCSetupRequest message. \param module_id module id \param gNB_index gNB index */ diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 9c0427789d..7412b79b23 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -205,7 +205,7 @@ gNBs = ////////// MME parameters: - amf_ip_address = ( { ipv4 = "192.168.70.132"; + amf_ip_address = ( { ipv4 = "192.168.16.195"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -215,10 +215,10 @@ gNBs = NETWORK_INTERFACES : { - GNB_INTERFACE_NAME_FOR_NG_AMF = "demo-oai"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.70.129/24"; - GNB_INTERFACE_NAME_FOR_NGU = "demo-oai"; - GNB_IPV4_ADDRESS_FOR_NGU = "192.168.70.129/24"; + GNB_INTERFACE_NAME_FOR_NG_AMF = "lo:"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "127.0.0.2"; + GNB_INTERFACE_NAME_FOR_NGU = "lo:"; + GNB_IPV4_ADDRESS_FOR_NGU = "127.0.0.2"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; @@ -226,26 +226,20 @@ gNBs = ); MACRLCs = ( - { - num_cc = 1; - tr_s_preference = "local_L1"; - tr_n_preference = "local_RRC"; - ulsch_max_slots_inactivity = 10; - pusch_TargetSNRx10 = 150; - pucch_TargetSNRx10 = 200; - } + { + num_cc = 1; + local_s_if_name = "lo:"; + remote_s_address = "127.0.0.1"; // pnf addr [!] + local_s_address = "127.0.0.2"; // vnf addr + local_s_portc = 50601; // vnf p5 port + remote_s_portc = 50600; // pnf p5 port [!] + local_s_portd = 50611; // vnf p7 port [!] + remote_s_portd = 50610; // pnf p7 port [!] + tr_s_preference = "nfapi"; + tr_n_preference = "local_RRC"; + } ); -L1s = ( - { - num_cc = 1; - tr_n_preference = "local_mac"; - pusch_proc_threads = 8; - prach_dtx_threshold = 120; - pucch0_dtx_threshold = 150; - ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 - } -); RUs = ( { @@ -273,14 +267,6 @@ THREAD_STRUCT = ( } ); -rfsimulator : -{ - serveraddr = "server"; - serverport = "4043"; - options = (); #("saviq"); or/and "chanmod" - modelname = "AWGN"; - IQfile = "/tmp/rfsimulator.iqs"; -}; security = { # preferred ciphering algorithms From e635b90fda1f579560ea14d39c825d27af987913 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Mon, 1 Nov 2021 12:42:01 -0700 Subject: [PATCH 02/29] Decoding MIB and SIB1 in NR UE In this commit, we changed the stub function of the NRUE to handle the MIB and SIB1, which arrive in a single DL_TTI_REQ. If we have not received the MIB, we first call the scheduler, then we handle any received NFAPI messages. The NFAPI message handler will then call the nr_ue_dl_indication() again, which will process first the MIB, then SIB1. It seems that we are not properly sending the SIB1 response back to the gNB so the NRUE eventually crashes. We are however, properly decoding the MIB and SIB which is a step in the right direction! --- executables/nr-ue.c | 19 +++++-- openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c | 2 - openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 57 ++++++++++++++++++--- 3 files changed, 63 insertions(+), 15 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index e1c04bc1a9..38932d4833 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -434,15 +434,18 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) module_id_t mod_id = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); - if (mac->scc == NULL || mac->scc_SIB == NULL) //Melissa TODO this isnt correct + if (mac->mib == NULL) { if (get_softmodem_params()->sa && get_softmodem_params()->emulate_l2) { - LOG_D(NR_MAC, "We haven't gotten MIB or SIB yet. Lets see if we received it\n"); + LOG_D(NR_MAC, "We haven't gotten MIB. Lets see if we received it\n"); nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); process_queued_nr_nfapi_msgs(mac, sfn_slot); } - LOG_D(MAC, "mac->scc == NULL or mac->scc_SIB == NULL!\n"); + } + if (mac->scc == NULL && mac->scc_SIB == NULL ) + { + LOG_D(MAC, "[NSA] mac->scc == NULL and [SA] mac->scc_SIB == NULL!\n"); continue; } @@ -473,14 +476,20 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) mac->dl_info.dci_ind = NULL; mac->dl_info.rx_ind = NULL; - if (is_nr_DL_slot(mac->scc->tdd_UL_DL_ConfigurationCommon, ul_info.slot_rx)) + if (is_nr_DL_slot(get_softmodem_params()->nsa ? + mac->scc->tdd_UL_DL_ConfigurationCommon : + mac->scc_SIB->tdd_UL_DL_ConfigurationCommon, + ul_info.slot_rx)) { nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); } if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort(); - if (is_nr_UL_slot(mac->scc->tdd_UL_DL_ConfigurationCommon, ul_info.slot_tx, mac->frame_type)) + if (is_nr_UL_slot(get_softmodem_params()->nsa ? + mac->scc->tdd_UL_DL_ConfigurationCommon : + mac->scc_SIB->tdd_UL_DL_ConfigurationCommon, + ul_info.slot_tx, mac->frame_type)) { LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind() from %s\n", ul_info.slot_tx, __FUNCTION__); nr_ue_ul_indication(&ul_info); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 24da89763c..bfdb07a61c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -887,10 +887,8 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in nr_scheduled_response_t scheduled_response; nr_dcireq_t dcireq; - LOG_D(MAC,"Melissa we got herre %s():%d\n", __FUNCTION__, __LINE__); if(mac->cg != NULL){ // we have a cg - LOG_D(MAC,"Melissa we got herre %s():%d\n", __FUNCTION__, __LINE__); dcireq.module_id = mod_id; dcireq.gNB_index = gNB_index; dcireq.cc_id = cc_id; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index ad1d68028e..7ca333135a 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -232,6 +232,28 @@ static void fill_dl_info_with_pdcch(fapi_nr_dci_indication_t *dci, nfapi_nr_dl_d dci->number_of_dcis = idx + 1; } +static void fill_mib_in_rx_ind(nfapi_nr_dl_tti_request_pdu_t *pdu_list, fapi_nr_rx_indication_t *rx_ind, int pdu_idx, int pdu_type) +{ + AssertFatal(pdu_list->PDUSize < sizeof(rx_ind->rx_indication_body) / sizeof(rx_ind->rx_indication_body[0]), + "PDU size (%d) is greater than rx_indication_body size!\n", pdu_list->PDUSize); + nfapi_nr_dl_tti_ssb_pdu_rel15_t *ssb_pdu = &pdu_list->ssb_pdu.ssb_pdu_rel15; + + LOG_D(NR_MAC, "Recevied an SSB and are filling rx_ind with the MIB!\n"); + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.cell_id = ssb_pdu->PhysCellId; + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu = CALLOC(3, + sizeof(*rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu)); + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu[0] = (ssb_pdu->bchPayload) & 0xffff; + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu[1] = (ssb_pdu->bchPayload >> 8) & 0xffff; + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu[2] = (ssb_pdu->bchPayload >> 16) & 0xffff; + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.rsrp_dBm = ssb_pdu->ssbRsrp; + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.ssb_index = ssb_pdu->SsbBlockIndex; + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.ssb_length = pdu_list->PDUSize; + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.ssb_start_subcarrier = ssb_pdu->SsbSubcarrierOffset; + rx_ind->rx_indication_body[pdu_idx].pdu_type = pdu_type; + rx_ind->number_pdus = pdu_idx + 1; + +} + static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_nr_dl_tti_request_t *dl_tti_request) { NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id); @@ -240,6 +262,7 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ int pdu_idx = 0; int num_pdus = dl_tti_request->dl_tti_request_body.nPDUs; + LOG_D(NR_MAC, "This is the total number of PDUS in dl_tti_req = %d\n", num_pdus); if (num_pdus <= 0) { LOG_E(NR_PHY, "%s: dl_tti_request number of PDUS <= 0\n", __FUNCTION__); @@ -286,6 +309,24 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ } } } + if (pdu_list->PDUType == NFAPI_NR_DL_TTI_SSB_PDU_TYPE) + { + /* If we get a MIB, we want to handle it right away and then come back. + The MIB and SIB come in the same dl_tti_req but the MIB should be + processed first and then the DCI and payload of the SIB1 can be + processed. The MIB should be handled first and then the rx_ind + will be freed after handling. This is why the PDU index will + always be zero for the RX_IND becasue we should not have more than + one MIB. */ + dl_info->rx_ind = CALLOC(1, sizeof(*dl_info->rx_ind)); + fapi_nr_rx_indication_t *rx_ind = dl_info->rx_ind; + rx_ind->sfn = dl_tti_request->SFN; + rx_ind->slot = dl_tti_request->Slot; + fill_mib_in_rx_ind(pdu_list, rx_ind, 0, FAPI_NR_RX_PDU_TYPE_SSB); + NR_UL_TIME_ALIGNMENT_t ul_time_alignment; + memset(&ul_time_alignment, 0, sizeof(ul_time_alignment)); + nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); + } } dl_info->slot = dl_tti_request->Slot; dl_info->frame = dl_tti_request->SFN; @@ -342,7 +383,7 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi for (int i = 0; i < num_pdus; i++) { nfapi_nr_pdu_t *pdu_list = &tx_data_request->pdu_list[i]; - if (dl_info->dci_ind->number_of_dcis > 0 && dl_info->dci_ind->dci_list[i].rnti == 0xffff) //Melissa this is bad find a better way + if (dl_info->dci_ind->dci_list[i].rnti == 0xffff) { fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_SIB); pdu_idx++; @@ -554,11 +595,6 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, int slot = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(0); - if (mac->scc == NULL) //Melissa, if we comment this out, we see the SIB! - { - return; - } - if (pthread_mutex_lock(&mac->mutex_dl_info)) abort(); if (dl_tti_request) @@ -619,8 +655,13 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame; ul_info.frame_tx = (ul_info.slot_rx + slot_ahead >= slots_per_frame) ? ul_info.frame_rx + 1 : ul_info.frame_rx; ul_info.ue_sched_mode = SCHED_ALL; - if (mac->scc && is_nr_UL_slot(mac->scc->tdd_UL_DL_ConfigurationCommon, ul_info.slot_tx, mac->frame_type)) + if (mac->scc || mac->scc_SIB) { + if (is_nr_UL_slot(mac->scc ? + mac->scc->tdd_UL_DL_ConfigurationCommon : + mac->scc_SIB->tdd_UL_DL_ConfigurationCommon, + ul_info.slot_tx, + mac->frame_type)) nr_ue_ul_indication(&ul_info); } } @@ -1051,7 +1092,7 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){ nr_ue_if_module_inst[module_id]->current_frame = 0; nr_ue_if_module_inst[module_id]->current_slot = 0; nr_ue_if_module_inst[module_id]->phy_config_request = nr_ue_phy_config_request; - if (get_softmodem_params()->nsa) //TODO: Get a better flag for using stub + if (get_softmodem_params()->emulate_l2) nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response_stub; else nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response; From 554e7db1d941701f4ef67da6aff69c8ac0b0a046 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Tue, 2 Nov 2021 13:21:42 -0700 Subject: [PATCH 03/29] Updated the nr_ue_get_rach() function to match develop Also, in the nr_rrc_mac_config_req_ue(), we should only be configuring L1 if we are not in the L2 emul mode. We are crashing due to the RRC state in the NRUE not being set/checked properly. --- executables/nr-ue.c | 2 +- openair2/LAYER2/NR_MAC_UE/config_ue.c | 3 +- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 147 ++++++++++++------- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- 4 files changed, 97 insertions(+), 57 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 38932d4833..9e0ca95136 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -436,7 +436,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); if (mac->mib == NULL) { - if (get_softmodem_params()->sa && get_softmodem_params()->emulate_l2) + if (get_softmodem_params()->sa) { LOG_D(NR_MAC, "We haven't gotten MIB. Lets see if we received it\n"); nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index d223b9ddd7..c8a9516ae3 100755 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -650,7 +650,8 @@ int nr_rrc_mac_config_req_ue( mac->ul_config_request = (fapi_nr_ul_config_request_t *)calloc(num_slots_ul, sizeof(fapi_nr_ul_config_request_t)); // Setup the SSB to Rach Occasions mapping according to the config build_ssb_to_ro_map(mac);//->scc, mac->phy_config.config_req.cell_config.frame_duplex_type); - mac->if_module->phy_config_request(&mac->phy_config); + if (!get_softmodem_params()->emulate_l2) + mac->if_module->phy_config_request(&mac->phy_config); mac->common_configuration_complete = 1; } if(scell_group_config != NULL ){ diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index b99e0aa0ec..a05128cf29 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -665,10 +665,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; - uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES]; - uint8_t *payload; - uint16_t size_sdu = 0; - unsigned short post_padding; NR_RACH_ConfigCommon_t *setup; if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; else setup = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; @@ -676,85 +672,128 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = ra->rach_ConfigDedicated; - uint16_t sdu_lengths[NB_RB_MAX] = {0}; - int offset = 0; - int TBS_bytes = 848; - int header_length_total=0; - int mac_ce_len; - // Delay init RA procedure to allow the convergence of the IIR filter on PRACH noise measurements at gNB side if (!prach_resources->init_msg1) { - if ((mac->common_configuration_complete > 0 || get_softmodem_params()->do_ra || get_softmodem_params()->nsa) && - ((MAX_FRAME_NUMBER + frame - prach_resources->sync_frame) % MAX_FRAME_NUMBER) > 150) { + if ((mac->common_configuration_complete>0 || get_softmodem_params()->do_ra==1) && + ((MAX_FRAME_NUMBER+frame-prach_resources->sync_frame)%MAX_FRAME_NUMBER)>150){ prach_resources->init_msg1 = 1; } else { - LOG_D(NR_MAC,"PRACH Condition not met: frame %d, prach_resources->sync_frame %d\n",frame,prach_resources->sync_frame); + LOG_I(NR_MAC, "Melissa: mac->common_configuration_complete = %d \n" + " MAX_FRAME_NUMBER (%d) + frame (%d) - prach_resources->sync_frame (%d)" + " = (%d) mod MAX_FRAME_NUMBER (%d) = %d ??? >150\n", + mac->common_configuration_complete, + MAX_FRAME_NUMBER, + frame, + prach_resources->sync_frame, + MAX_FRAME_NUMBER + frame - prach_resources->sync_frame, + MAX_FRAME_NUMBER, + MAX_FRAME_NUMBER+frame-prach_resources->sync_frame%MAX_FRAME_NUMBER); + LOG_D(NR_MAC,"PRACH Condition not met: frame %d, prach_resources->sync_frame %d\n", + frame,prach_resources->sync_frame); return 0; } } - LOG_D(NR_MAC,"frame %d prach_resources->init_msg1 %d, ra->ra_state %d, ra->RA_active %d\n", - frame, prach_resources->init_msg1, ra->ra_state, ra->RA_active); + LOG_D(NR_MAC, "In %s: [UE %d][%d.%d]: init_msg1 %d, ra_state %d, RA_active %d\n", + __FUNCTION__, + mod_id, + frame, + nr_slot_tx, + prach_resources->init_msg1, + ra->ra_state, + ra->RA_active); if (prach_resources->init_msg1 && ra->ra_state != RA_SUCCEEDED) { if (ra->RA_active == 0) { /* RA not active - checking if RRC is ready to initiate the RA procedure */ - LOG_D(NR_MAC, "RA not active. Checking for data to transmit from upper layers...\n"); + LOG_D(NR_MAC, "In %s: RA not active. Checking for data to transmit from upper layers...\n", __FUNCTION__); - int TBS_max = 848; //8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); - payload = (uint8_t*) mac->CCCH_pdu.payload; - mac_ce_len = 0; - post_padding = 1; + const uint8_t lcid = UL_SCH_LCID_CCCH; + const uint8_t sh_size = sizeof(NR_MAC_SUBHEADER_FIXED); + const uint8_t TBS_max = 8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); // Note: unclear the reason behind the selection of such TBS_max + int8_t size_sdu = 0; + uint8_t mac_ce[16] = {0}; + uint8_t *pdu = get_softmodem_params()->sa ? mac->CCCH_pdu.payload : mac_ce; + uint8_t *payload = pdu; - // initialisation by RRC + // Concerning the C-RNTI MAC CE, it has to be included if the UL transmission (Msg3) is not being made for the CCCH logical channel. + // Therefore it has been assumed that this event only occurs only when RA is done and it is not SA mode. + if (get_softmodem_params()->sa) { - // TODO: To be removed after RA procedures fully implemented - if(get_softmodem_params()->do_ra) { + NR_MAC_SUBHEADER_FIXED *header = (NR_MAC_SUBHEADER_FIXED *) pdu; + pdu += sh_size; + + // initialisation by RRC nr_rrc_ue_generate_RRCSetupRequest(mod_id,gNB_id); - size_sdu = (uint16_t) nr_mac_rrc_data_req_ue(mod_id, CC_id, gNB_id, frame, CCCH, mac_sdus); + // CCCH PDU - sdu_lengths[0] = size_sdu; - LOG_D(NR_MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n", mod_id, frame, size_sdu); - } else { - // fill ulsch_buffer with random data - for (int i = 0; i < TBS_bytes; i++){ - mac_sdus[i] = (unsigned char) (lrand48()&0xff); + size_sdu = nr_mac_rrc_data_req_ue(mod_id, CC_id, gNB_id, frame, CCCH, pdu); + LOG_D(NR_MAC, "In %s: [UE %d][%d.%d]: Requested RRCConnectionRequest, got %d bytes for LCID 0x%02x \n", __FUNCTION__, mod_id, frame, nr_slot_tx, size_sdu, lcid); + + if (size_sdu > 0) { + + // UE Contention Resolution Identity + // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to determine whether or not the + // Random Access Procedure has been successful after reception of Msg4 + memcpy(ra->cont_res_id, pdu, sizeof(uint8_t) * 6); + + pdu += size_sdu; + ra->Msg3_size = size_sdu + sh_size; + + // Build header + header->R = 0; + header->LCID = lcid; + + } else { + pdu -= sh_size; } - //Sending SDUs with size 1 - //Initialize elements of sdu_lengths - sdu_lengths[0] = TBS_bytes - 3 - post_padding - mac_ce_len; - header_length_total += 2 + (sdu_lengths[0] >= 128); - size_sdu += sdu_lengths[0]; + + } else { + + size_sdu = nr_write_ce_ulsch_pdu(pdu, mac); + pdu += size_sdu; + ra->Msg3_size = size_sdu; + } + if (size_sdu > 0 && ra->generate_nr_prach == GENERATE_PREAMBLE) { - if (size_sdu > 0) { - - // UE Contention Resolution Identity - // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to determine whether or not the - // Random Access Procedure has been successful after reception of Msg4 - memcpy(ra->cont_res_id, mac_sdus, sizeof(uint8_t) * 6); - - LOG_D(NR_MAC, "[UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", mod_id, frame, nr_slot_tx); - - ra->Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); + LOG_D(NR_MAC, "In %s: [UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", __FUNCTION__, mod_id, frame, nr_slot_tx); + AssertFatal(TBS_max > ra->Msg3_size, "In %s: allocated resources are not enough for Msg3!\n", __FUNCTION__); + // Init RA procedure init_RA(mod_id, prach_resources, setup, rach_ConfigGeneric, rach_ConfigDedicated); - // prach_resources->Msg3 = payload; nr_get_RA_window(mac); - // Fill in preamble and PRACH resources - if (ra->generate_nr_prach == GENERATE_PREAMBLE) { - nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated); - } + nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated); // Padding: fill remainder with 0 - if (post_padding > 0){ - for (int j = 0; j < (TBS_max - offset); j++) - payload[offset + j] = 0; + if (TBS_max - ra->Msg3_size > 0) { + LOG_D(NR_MAC, "In %s: remaining %d bytes, filling with padding\n", __FUNCTION__, TBS_max - ra->Msg3_size); + ((NR_MAC_SUBHEADER_FIXED *) pdu)->R = 0; + ((NR_MAC_SUBHEADER_FIXED *) pdu)->LCID = UL_SCH_LCID_PADDING; + pdu += sizeof(NR_MAC_SUBHEADER_FIXED); + for (int j = 0; j < TBS_max - ra->Msg3_size - sizeof(NR_MAC_SUBHEADER_FIXED); j++) { + pdu[j] = 0; + } } + + // Dumping ULSCH payload + LOG_D(NR_MAC, "In %s: dumping UL Msg3 MAC PDU with length %d: \n", __FUNCTION__, TBS_max); + for(int k = 0; k < TBS_max; k++) { + LOG_D(NR_MAC,"(%i): %i\n", k, payload[k]); + } + + // Msg3 was initialized with TBS_max bytes because the RA_Msg3_size will only be known after + // receiving Msg2 (which contains the Msg3 resource reserve). + // Msg3 will be transmitted with RA_Msg3_size bytes, removing unnecessary 0s. + mac->ulsch_pdu.Pdu_size = TBS_max; + memcpy(mac->ulsch_pdu.payload, payload, TBS_max); + + } else { + return 0; } } else if (ra->RA_window_cnt != -1) { // RACH is active @@ -783,7 +822,7 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, } else if (ra->RA_window_cnt > 0) { - LOG_I(MAC, "[UE %d][%d.%d]: RAR not received yet (RA window count %d) \n", mod_id, frame, nr_slot_tx, ra->RA_window_cnt); + LOG_D(MAC, "[UE %d][%d.%d]: RAR not received yet (RA window count %d) \n", mod_id, frame, nr_slot_tx, ra->RA_window_cnt); // Fill in preamble and PRACH resources ra->RA_window_cnt--; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 7ca333135a..33ee64aa1f 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1092,7 +1092,7 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){ nr_ue_if_module_inst[module_id]->current_frame = 0; nr_ue_if_module_inst[module_id]->current_slot = 0; nr_ue_if_module_inst[module_id]->phy_config_request = nr_ue_phy_config_request; - if (get_softmodem_params()->emulate_l2) + if (get_softmodem_params()->emulate_l2 || get_softmodem_params()->nsa) nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response_stub; else nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response; From c87141fbcf97288e5aa06ea728efdce3672aa0b6 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Wed, 3 Nov 2021 09:14:40 -0700 Subject: [PATCH 04/29] Updating gNB RA PROC to match develop branch --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 198fd9f3c0..71bab705ef 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -516,28 +516,13 @@ void nr_initiate_ra_proc(module_id_t module_idP, total_RApreambles = total_RApreambles/num_ssb_per_RO ; } - for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { - NR_RA_t *ra = &cc->ra[i]; - LOG_D(MAC, - "[gNB %d][RAPROC] CC_id %d Frame %d, Slot %d Checking all rnti : preamble index %d, rnti %x\n", - module_idP, - CC_id, - frameP, - slotP, - preamble_index, - ra->rnti); - } for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { NR_RA_t *ra = &cc->ra[i]; pr_found = 0; - const int UE_id = find_nr_UE_id(module_idP, ra->rnti); - if (UE_id != -1) { - continue; - } 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]) { pr_found=1; break; } From 54a894e534db0eda9187b6b7e093bcd269b77f35 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Wed, 3 Nov 2021 10:54:33 -0700 Subject: [PATCH 05/29] Updated the following for SA development: 1. The preamble index in the NRUE is random for SA. Using the preamble index from the mac->ra is correct. 2. The dl_pathloss calculated is from L1. We should shunt this feature out for our emulated mode. If we add the abstraction later, we can model the pathloss in the proxy and update it in the RA procedure of the NRUE. 3. Checking that the crnti != t_crnti is not valid for SA mode. And may only be needed for multi-UE in NSA mode. We might be able to delete it all together. For now, we only use for NSA mode. 4. Checking the RAR based on rnti = 10b and not the RA_STATE is better. --- ci-scripts/conf_files/episci/proxy_nr-ue.nfapi.conf | 8 ++++++++ executables/nr-ue.c | 5 ++++- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 4 +++- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- 5 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ci-scripts/conf_files/episci/proxy_nr-ue.nfapi.conf b/ci-scripts/conf_files/episci/proxy_nr-ue.nfapi.conf index c4ea9ee13b..8411ed8fc6 100644 --- a/ci-scripts/conf_files/episci/proxy_nr-ue.nfapi.conf +++ b/ci-scripts/conf_files/episci/proxy_nr-ue.nfapi.conf @@ -15,6 +15,14 @@ log_config = { rrc_log_verbosity ="full"; }; +uicc0 = { +imsi = "2089900007487"; +key = "fec86ba6eb707ed08905757b1bb44b8f"; +opc= "C42449363BBAD02B66D16BC975D77CC1"; +dnn= "oai"; +nssai_sst=1; +nssai_sd=1; +} L1s = ( { diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 9e0ca95136..58966911aa 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -177,7 +177,10 @@ static void L1_nsa_prach_procedures(frame_t frame, int slot, fapi_nr_ul_config_p rach_ind->pdu_list[pdu_index].num_preamble = 1; const int num_p = rach_ind->pdu_list[pdu_index].num_preamble; rach_ind->pdu_list[pdu_index].preamble_list = calloc(num_p, sizeof(nfapi_nr_prach_indication_preamble_t)); - rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_index = mac->ra.rach_ConfigDedicated->cfra->resources.choice.ssb->ssb_ResourceList.list.array[0]->ra_PreambleIndex; + uint8_t preamble_index = get_softmodem_params()->nsa ? + mac->ra.rach_ConfigDedicated->cfra->resources.choice.ssb->ssb_ResourceList.list.array[0]->ra_PreambleIndex : + mac->ra.ra_PreambleIndex; + rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_index = preamble_index; rach_ind->pdu_list[pdu_index].preamble_list[0].timing_advance = 0; rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 33204c613f..8187389f5b 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -595,7 +595,9 @@ void nr_get_prach_resources(module_id_t mod_id, LOG_D(MAC, "In %s: selected RA preamble index %d for contention-free random access procedure for SSB with Id %d\n", __FUNCTION__, prach_resources->ra_PreambleIndex, cfra_ssb_resource_idx); } } else { - int16_t dl_pathloss = get_nr_PL(mod_id, CC_id, gNB_id); + /* TODO: This controls the tx_power of UE and the ramping procedure of RA of UE. Later we + can abstract this, perhaps in the proxy. But for the time being lets leave it as below. */ + int16_t dl_pathloss = !get_softmodem_params()->emulate_l2 ? get_nr_PL(mod_id, CC_id, gNB_id) : 0; ssb_rach_config(ra, prach_resources, nr_rach_ConfigCommon, prach_pdu); ra_preambles_config(prach_resources, mac, dl_pathloss); LOG_D(MAC, "[RAPROC] - Selected RA preamble index %d for contention-based random access procedure... \n", prach_resources->ra_PreambleIndex); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 2f7c51dc93..a7c16eefb6 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3802,7 +3802,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t LOG_D(NR_MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index); - if( mac->crnti == ra->t_crnti ) + if (get_softmodem_params()->nsa && mac->crnti == ra->t_crnti) { LOG_D(MAC, "Discarding the received RAR.\n"); return -1; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 33ee64aa1f..0a04666f9c 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -388,7 +388,7 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_SIB); pdu_idx++; } - else if(mac->ra.ra_state <= WAIT_RAR) + else if (dl_info->dci_ind->dci_list[i].rnti == 0x10b) { fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_RAR); pdu_idx++; From edd710f6a9c865961debb3e6c47184526952127b Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Wed, 3 Nov 2021 15:52:49 -0700 Subject: [PATCH 06/29] Removing bad log and changing RA state when we get prach --- executables/nr-ue.c | 1 + openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 10 ---------- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 58966911aa..2c136467f6 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -366,6 +366,7 @@ static void check_nr_prach(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_inf ul_info->slot_tx); if (nr_prach == 1) { + mac->ra.ra_state = GENERATE_PREAMBLE; L1_nsa_prach_procedures(ul_info->frame_tx, ul_info->slot_tx, prach_pdu); ul_config->number_pdus = 0; ul_info->ue_sched_mode = SCHED_ALL; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 8187389f5b..c30d808b99 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -680,16 +680,6 @@ uint8_t nr_ue_get_rach(NR_PRACH_RESOURCES_t *prach_resources, ((MAX_FRAME_NUMBER+frame-prach_resources->sync_frame)%MAX_FRAME_NUMBER)>150){ prach_resources->init_msg1 = 1; } else { - LOG_I(NR_MAC, "Melissa: mac->common_configuration_complete = %d \n" - " MAX_FRAME_NUMBER (%d) + frame (%d) - prach_resources->sync_frame (%d)" - " = (%d) mod MAX_FRAME_NUMBER (%d) = %d ??? >150\n", - mac->common_configuration_complete, - MAX_FRAME_NUMBER, - frame, - prach_resources->sync_frame, - MAX_FRAME_NUMBER + frame - prach_resources->sync_frame, - MAX_FRAME_NUMBER, - MAX_FRAME_NUMBER+frame-prach_resources->sync_frame%MAX_FRAME_NUMBER); LOG_D(NR_MAC,"PRACH Condition not met: frame %d, prach_resources->sync_frame %d\n", frame,prach_resources->sync_frame); return 0; From 81716e4c77fdde06fd4875a34433d77d81dca7e3 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Wed, 3 Nov 2021 16:28:42 -0700 Subject: [PATCH 07/29] Filtering for multiple UEs in MAC excluding SIB and RAR For multiple UEs, we need to be able to filter the rx'd messages by the RNTI. However, we do not have the RNTI value until the CFRA (NSA) or CBRA (SA) procedure is complete. The check below will handle this. Also, depending on the RNTI value, we can have a SIB (0xffff), RAR (0x10b), Msg3 (TC_RNTI) or an actual DCI message (CRNTI). When we get Msg3, the MAC instance of the UE still has a CRNTI = 0. Only once the RA procedure succeeds is the CRNTI value updated to the TC_RNTI. --- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 4 ++ openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 46 ++++++++++++++++----- 2 files changed, 40 insertions(+), 10 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index acdfed31cc..4e64aafcab 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -433,6 +433,10 @@ typedef struct { // Defined for abstracted mode nr_downlink_indication_t dl_info; NR_UE_HARQ_STATUS_t dl_harq_info[16]; + bool expected_sib; + bool index_has_sib[16]; + bool expected_rar; + bool index_has_rar[16]; bool expected_dci; bool index_has_dci[16]; int active_harq_sfn_slot; diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 0a04666f9c..0a8e799a06 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -257,6 +257,10 @@ static void fill_mib_in_rx_ind(nfapi_nr_dl_tti_request_pdu_t *pdu_list, fapi_nr_ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_nr_dl_tti_request_t *dl_tti_request) { NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id); + mac->expected_sib = false; + memset(mac->index_has_sib, 0, sizeof(*mac->index_has_sib)); + mac->expected_rar = false; + memset(mac->index_has_rar, 0, sizeof(*mac->index_has_rar)); mac->expected_dci = false; memset(mac->index_has_dci, 0, sizeof(*mac->index_has_dci)); int pdu_idx = 0; @@ -292,19 +296,41 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ "The number of DCIs is greater than dci_list"); for (int j = 0; j < num_dcis; j++) { + /* For multiple UEs, we need to be able to filter the rx'd messages by + the RNTI. However, we do not have the RNTI value until the CFRA (NSA) + or CBRA (SA) procedure is complete. The check below will handle this. + Also, depending on the RNTI value, we can have a SIB (0xffff), RAR (0x10b), + Msg3 (TC_RNTI) or an actual DCI message (CRNTI). When we get Msg3, the + MAC instance of the UE still has a CRNTI = 0. Only once the RA procedure + succeeds is the CRNTI value updated to the TC_RNTI. */ 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) && - (dci_pdu_list->RNTI != 0xffff) && - ((dci_pdu_list->RNTI != mac->ra.ra_rnti) || mac->ra.RA_RAPID_found)) + (mac->ra.ra_state == RA_SUCCEEDED)) { - LOG_D(NR_MAC, "We are filtering PDCCH DCI pdu because RNTI doesnt match!\n"); - LOG_D(NR_MAC, "dci_pdu_list->RNTI (%x) != mac->crnti (%x)\n", dci_pdu_list->RNTI, mac->crnti); + LOG_D(NR_MAC, "We are filtering PDCCH DCI pdu because RNTI doesnt match! " + "dci_pdu_list->RNTI (%x) != mac->crnti (%x)\n", + dci_pdu_list->RNTI, mac->crnti); continue; } fill_dl_info_with_pdcch(dl_info->dci_ind, dci_pdu_list, pdu_idx); - mac->expected_dci = true; - LOG_D(NR_MAC, "Setting index_has_dci[%d] = true\n", j); - mac->index_has_dci[j] = true; + if (dci_pdu_list->RNTI == 0xffff) + { + mac->expected_sib = true; + mac->index_has_sib[j] = true; + LOG_D(NR_MAC, "Setting index_has_sib[%d] = true\n", j); + } + else if (dci_pdu_list->RNTI == 0x10b) + { + mac->expected_rar = true; + mac->index_has_rar[j] = true; + LOG_D(NR_MAC, "Setting index_has_rar[%d] = true\n", j); + } + else + { + mac->expected_dci = true; + mac->index_has_dci[j] = true; + LOG_D(NR_MAC, "Setting index_has_dci[%d] = true\n", j); + } pdu_idx++; } } @@ -383,12 +409,12 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi for (int i = 0; i < num_pdus; i++) { nfapi_nr_pdu_t *pdu_list = &tx_data_request->pdu_list[i]; - if (dl_info->dci_ind->dci_list[i].rnti == 0xffff) + if (mac->index_has_sib[i]) { fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_SIB); pdu_idx++; } - else if (dl_info->dci_ind->dci_list[i].rnti == 0x10b) + else if (mac->index_has_rar[i]) { fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_RAR); pdu_idx++; @@ -609,7 +635,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, incoming tx_data_request is also destined for the current UE. If the RAR hasn't been processed yet, we do not want to be filtering the tx_data_requests. */ - if (tx_data_request && (mac->expected_dci || mac->ra.ra_state == WAIT_RAR)) + if (tx_data_request && (mac->expected_sib || mac->expected_rar || mac->expected_dci)) { frame = tx_data_request->SFN; slot = tx_data_request->Slot; From d7b4adb00692a7307131747201b95d2a60584246 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 09:17:16 -0700 Subject: [PATCH 08/29] Only filtering DCIs in MAC layer after RA is complete. --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index a7c16eefb6..0d11689c7d 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -599,9 +599,10 @@ 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)) { - 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); + if ((mac->ra.ra_state == RA_SUCCEEDED) && (dci->rnti != mac->crnti)) { + LOG_D(MAC,"[%d %d] Discarding the received dci indication because rnti %4x " + "!= mac->crnti %4x after RA procedure is complete: (RA state %d)\n", + frame, slot, dci->rnti, mac->crnti, mac->ra.ra_state); return 0; } From 7dc523355d33c245b0a4cf47976317d7341b8761 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 10:07:25 -0700 Subject: [PATCH 09/29] Return 0 is not a fail, so changing to -1 --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 0d11689c7d..f0e00d2ef5 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -603,7 +603,7 @@ int nr_ue_process_dci_indication_pdu(module_id_t module_id,int cc_id, int gNB_in LOG_D(MAC,"[%d %d] Discarding the received dci indication because rnti %4x " "!= mac->crnti %4x after RA procedure is complete: (RA state %d)\n", frame, slot, dci->rnti, mac->crnti, mac->ra.ra_state); - return 0; + return -1; } LOG_D(MAC,"Received dci indication (rnti %x,dci format %d,n_CCE %d,payloadSize %d,payload %llx)\n", From 10dec919ce087f4f42936f4b26808f58afa0bb36 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 11:11:13 -0700 Subject: [PATCH 10/29] Temp fix to try to get CBRA procdeure complete Need to review this with Raymond. --- openair2/RRC/NR_UE/rrc_UE.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 99bd7ff091..13cb2b7f78 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1762,8 +1762,13 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB //----------------------------------------------------------------------------- void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) { uint8_t i=0,rv[6]; - - if(get_softmodem_params()->sa) { + /* TODO: Melissa, this is not a proper fix. The NAS layer should be + getting intialized and then the substate will not crash when AMF_MODE_ENABLED + is equal to 1. However, as a side note, when we keep the code below, + once the CBRA procedure is finished, the NAS layer is ran and the AMF_MODE_ENABLED + is switched to one and the substate assertion in the nr_rrc_set_sub_state() + does not happen. So show this to Raymond and maybe its okay? */ + if(get_softmodem_params()->sa && !get_softmodem_params()->emulate_l2) { AMF_MODE_ENABLED = 1; } if(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) { From 7e10b4a10640ad9fb69eaf2361b0bcabeefc539e Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 12:15:52 -0700 Subject: [PATCH 11/29] Reverting nr-uesoftmodem to match master and added SA mode --- executables/nr-uesoftmodem.c | 67 ++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index f71d29a041..d6c8d389aa 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -194,18 +194,18 @@ int create_tasks_nrue(uint32_t ue_nb) { LOG_E(NR_RRC, "Create task for RRC UE failed\n"); return -1; } - } - if (ue_nb > 0 && get_softmodem_params()->nsa == 1) { - init_connections_with_lte_ue(); - if (itti_create_task (TASK_RRC_NSA_NRUE, recv_msgs_from_lte_ue, NULL) < 0) { - LOG_E(NR_RRC, "Create task for RRC NSA nr-UE failed\n"); + if (get_softmodem_params()->nsa) { + init_connections_with_lte_ue(); + if (itti_create_task (TASK_RRC_NSA_NRUE, recv_msgs_from_lte_ue, NULL) < 0) { + LOG_E(NR_RRC, "Create task for RRC NSA nr-UE failed\n"); + return -1; + } + } + if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) { + LOG_E(NR_RRC, "Create task for NAS UE failed\n"); return -1; } } - if (itti_create_task (TASK_NAS_NRUE, nas_nrue_task, NULL) < 0) { - LOG_E(NR_RRC, "Create task for NAS UE failed\n"); - return -1; - } itti_wait_ready(0); return 0; @@ -482,17 +482,13 @@ int main( int argc, char **argv ) { PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE *)*MAX_NUM_CCs); RCconfig_nr_ue_L1(); + if (get_softmodem_params()->do_ra) AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n"); if (get_softmodem_params()->sa) AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n"); - if (create_tasks_nrue(1) < 0) { - LOG_E(NR_RRC,"Cannot create ITTI tasks for RRC layer of nr-UE\n"); - exit(-1); - } - if (get_softmodem_params()->emulate_l2) start_oai_nrue_threads(); @@ -503,34 +499,32 @@ int main( int argc, char **argv ) { memset(UE[CC_id],0,sizeof(PHY_VARS_NR_UE)); set_options(CC_id, UE[CC_id]); - NR_UE_MAC_INST_t *mac = get_mac_inst(0); - if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL) - mac->if_module->phy_config_request(&mac->phy_config); - fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config; if (get_softmodem_params()->sa) { // set frame config to initial values from command line and assume that the SSB is centered on the grid - nrUE_config->ssb_config.scs_common = get_softmodem_params()->numerology; - nrUE_config->carrier_config.dl_grid_size[nrUE_config->ssb_config.scs_common] = UE[CC_id]->frame_parms.N_RB_DL; - nrUE_config->carrier_config.ul_grid_size[nrUE_config->ssb_config.scs_common] = UE[CC_id]->frame_parms.N_RB_DL; - nrUE_config->carrier_config.dl_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<ssb_config.scs_common)))/1000; - nrUE_config->carrier_config.uplink_frequency = (downlink_frequency[0][0] -(6*UE[CC_id]->frame_parms.N_RB_DL*(15000<ssb_config.scs_common)))/1000; - nrUE_config->ssb_table.ssb_offset_point_a = (UE[CC_id]->frame_parms.N_RB_DL - 20)>>1; + uint16_t nr_band = get_band(downlink_frequency[CC_id][0],uplink_frequency_offset[CC_id][0]); + mac->nr_band = nr_band; + nr_init_frame_parms_ue_sa(&UE[CC_id]->frame_parms, + downlink_frequency[CC_id][0], + uplink_frequency_offset[CC_id][0], + get_softmodem_params()->numerology, + nr_band); + } + else{ + if(mac->if_module != NULL && mac->if_module->phy_config_request != NULL) + mac->if_module->phy_config_request(&mac->phy_config); - // Initialize values, will be updated upon SIB1 reception - nrUE_config->cell_config.frame_duplex_type = TDD; - nrUE_config->ssb_table.ssb_mask_list[0].ssb_mask = 0xFFFFFFFF; - nrUE_config->ssb_table.ssb_period = 1; + fapi_nr_config_request_t *nrUE_config = &UE[CC_id]->nrUE_config; + + nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, + *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); } - nr_init_frame_parms_ue(&UE[CC_id]->frame_parms, nrUE_config, - mac->scc == NULL ? 78 : *mac->scc->downlinkConfigCommon->frequencyInfoDL->frequencyBandList.list.array[0]); init_symbol_rotation(&UE[CC_id]->frame_parms); + init_timeshift_rotation(&UE[CC_id]->frame_parms); init_nr_ue_vars(UE[CC_id], 0, abstraction_flag); } - init_NR_UE_threads(1); - printf("UE threads created by %ld\n", gettid()); init_openair0(); // init UE_PF_PO and mutex lock pthread_mutex_init(&ue_pf_po_mutex, NULL); @@ -541,12 +535,19 @@ int main( int argc, char **argv ) { if(IS_SOFTMODEM_DOSCOPE) { load_softscope("nr",PHY_vars_UE_g[0][0]); } + + init_NR_UE_threads(1); + printf("UE threads created by %ld\n", gettid()); } - config_sync_var=0; // wait for end of program printf("TYPE TO TERMINATE\n"); + if (create_tasks_nrue(1) < 0) { + printf("cannot create ITTI tasks\n"); + exit(-1); // need a softer mode + } + // Sleep a while before checking all parameters have been used // Some are used directly in external threads, asynchronously sleep(20); From 2f7378d125385f981a69244aa759699b13c35e9c Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 12:30:25 -0700 Subject: [PATCH 12/29] Update conf files to match master-nsa and made new SA mode gNB. --- ...oxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf | 325 ++++++++++++++++++ .../gnb.band78.sa.fr1.106PRB.usrpn310.conf | 29 +- .../gnb.sa.band78.fr1.106PRB.usrpb210.conf | 43 +-- 3 files changed, 360 insertions(+), 37 deletions(-) create mode 100644 ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf diff --git a/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf new file mode 100644 index 0000000000..740313abfc --- /dev/null +++ b/ci-scripts/conf_files/episci/proxy_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -0,0 +1,325 @@ +Active_gNBs = ( "gNB-OAI"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + gNB_name = "gNB-OAI"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x1; // 0 false, else true + }, + { + sst = 1; + sd = 0x112233; // 0 false, else true + } + ); + + }); + + nr_cellid = 12345678L; + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + ul_prbblacklist = "51,52,53,54" + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 12; + searchSpaceZero = 0; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641280; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640008; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=27,L=48 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875 12952 +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 + + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 12952; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -96; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; # used for UL slot + initialULBWPmappingType_0 = 1 + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + + initialULBWPk2_1 = 6; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 52; # this is SS=10 L=4 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA + initialULBWPmappingType_2 = 1; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// AMF parameters: + amf_ip_address = ( { ipv4 = "192.168.61.195"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + + NETWORK_INTERFACES : + { + GNB_INTERFACE_NAME_FOR_NG_AMF = "lo:"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "127.0.0.2"; + GNB_INTERFACE_NAME_FOR_NGU = "lo:"; + GNB_IPV4_ADDRESS_FOR_NGU = "127.0.0.2"; + GNB_PORT_FOR_NGU = 2152; # Spec 2152 + }; + + } +); + +MACRLCs = ( + { + num_cc = 1; + local_s_if_name = "lo:"; + remote_s_address = "127.0.0.1"; // pnf addr [!] + local_s_address = "127.0.0.2"; // vnf addr + local_s_portc = 50601; // vnf p5 port + remote_s_portc = 50600; // pnf p5 port [!] + local_s_portd = 50611; // vnf p7 port [!] + remote_s_portd = 50610; // pnf p7 port [!] + tr_s_preference = "nfapi"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [78]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + #clock_src = "external"; + sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +rfsimulator : +{ + serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs"; +}; + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia2", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "no"; +}; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + ngap_log_level ="debug"; + ngap_log_verbosity ="medium"; + }; + diff --git a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf index 740313abfc..a5d35d450e 100644 --- a/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf +++ b/ci-scripts/conf_files/gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -205,7 +205,7 @@ gNBs = ////////// AMF parameters: - amf_ip_address = ( { ipv4 = "192.168.61.195"; + amf_ip_address = ( { ipv4 = "CI_MME_IP_ADDR"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -215,10 +215,10 @@ gNBs = NETWORK_INTERFACES : { - GNB_INTERFACE_NAME_FOR_NG_AMF = "lo:"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "127.0.0.2"; - GNB_INTERFACE_NAME_FOR_NGU = "lo:"; - GNB_IPV4_ADDRESS_FOR_NGU = "127.0.0.2"; + GNB_INTERFACE_NAME_FOR_NG_AMF = "eth0"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "CI_GNB_IP_ADDR"; + GNB_INTERFACE_NAME_FOR_NGU = "eth0"; + GNB_IPV4_ADDRESS_FOR_NGU = "CI_GNB_IP_ADDR"; GNB_PORT_FOR_NGU = 2152; # Spec 2152 }; @@ -226,18 +226,13 @@ gNBs = ); MACRLCs = ( - { - num_cc = 1; - local_s_if_name = "lo:"; - remote_s_address = "127.0.0.1"; // pnf addr [!] - local_s_address = "127.0.0.2"; // vnf addr - local_s_portc = 50601; // vnf p5 port - remote_s_portc = 50600; // pnf p5 port [!] - local_s_portd = 50611; // vnf p7 port [!] - remote_s_portd = 50610; // pnf p7 port [!] - tr_s_preference = "nfapi"; - tr_n_preference = "local_RRC"; - } + { + num_cc = 1; + tr_s_preference = "local_L1"; + tr_n_preference = "local_RRC"; + pusch_TargetSNRx10 = 200; + pucch_TargetSNRx10 = 150; + } ); L1s = ( diff --git a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf index 6395455626..ac8622fbc5 100644 --- a/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf @@ -205,7 +205,7 @@ gNBs = ////////// MME parameters: - amf_ip_address = ( { ipv4 = "192.168.16.195"; + amf_ip_address = ( { ipv4 = "192.168.70.132"; ipv6 = "192:168:30::17"; active = "yes"; preference = "ipv4"; @@ -215,10 +215,10 @@ gNBs = NETWORK_INTERFACES : { - GNB_INTERFACE_NAME_FOR_NG_AMF = "lo:"; - GNB_IPV4_ADDRESS_FOR_NG_AMF = "127.0.0.2"; - GNB_INTERFACE_NAME_FOR_NGU = "lo:"; - GNB_IPV4_ADDRESS_FOR_NGU = "127.0.0.2"; + GNB_INTERFACE_NAME_FOR_NG_AMF = "demo-oai"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "192.168.70.129/24"; + GNB_INTERFACE_NAME_FOR_NGU = "demo-oai"; + GNB_IPV4_ADDRESS_FOR_NGU = "192.168.70.129/24"; GNB_PORT_FOR_S1U = 2152; # Spec 2152 }; @@ -226,20 +226,6 @@ gNBs = ); MACRLCs = ( -<<<<<<< HEAD - { - num_cc = 1; - local_s_if_name = "lo:"; - remote_s_address = "127.0.0.1"; // pnf addr [!] - local_s_address = "127.0.0.2"; // vnf addr - local_s_portc = 50601; // vnf p5 port - remote_s_portc = 50600; // pnf p5 port [!] - local_s_portd = 50611; // vnf p7 port [!] - remote_s_portd = 50610; // pnf p7 port [!] - tr_s_preference = "nfapi"; - tr_n_preference = "local_RRC"; - } -======= { num_cc = 1; tr_s_preference = "local_L1"; @@ -247,9 +233,18 @@ MACRLCs = ( pusch_TargetSNRx10 = 150; pucch_TargetSNRx10 = 200; } ->>>>>>> eurecom-develop ); +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; + ofdm_offset_divisor = 8; #set this to UINT_MAX for offset 0 + } +); RUs = ( { @@ -277,6 +272,14 @@ THREAD_STRUCT = ( } ); +rfsimulator : +{ + serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs"; +}; security = { # preferred ciphering algorithms From e0991d3cecdde9ffc5430e28b6c49ae44c0a2b00 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 12:44:30 -0700 Subject: [PATCH 13/29] Reverting log changes for MR --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 10 ++-------- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c | 5 ++--- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index f0e00d2ef5..c803ebb8b3 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -2607,8 +2607,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, N_RB_UL = NRRIV2BW(mac->scc->uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); } - LOG_D(MAC,"nr_extract_dci_info : dci_pdu %lx, size %d, rnti_type %d, dci_format %d\n", - *dci_pdu, dci_size, rnti_type, dci_format); + 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: @@ -2664,7 +2663,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, dci_pdu_rel15 = &mac->def_dci_pdu_rel15[NR_UL_DCI_FORMAT_0_0]; return 2+nr_extract_dci_info(mac, NR_UL_DCI_FORMAT_0_0, dci_size, rnti, dci_pdu, dci_pdu_rel15); } -#if 1 +#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); #endif @@ -3803,11 +3802,6 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t LOG_D(NR_MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index); - if (get_softmodem_params()->nsa && mac->crnti == ra->t_crnti) - { - LOG_D(MAC, "Discarding the received RAR.\n"); - return -1; - } while (1) { n_subheaders++; if (rarh->T == 1) { diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c index a50a8e4ee4..f35de9e28b 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_bch.c @@ -398,9 +398,8 @@ uint32_t schedule_control_sib1(module_id_t module_id, rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3; } while (TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); - AssertFatal(TBS>=gNB_mac->sched_ctrlCommon->num_total_bytes, - "Couldn't allocate (TBS = %d) enough resources for %d bytes in SIB1 PDSCH\n", - TBS, gNB_mac->sched_ctrlCommon->num_total_bytes); + AssertFatal(TBS>=gNB_mac->sched_ctrlCommon->num_total_bytes,"Couldn't allocate enough resources for %d bytes in SIB1 PDSCH\n", + gNB_mac->sched_ctrlCommon->num_total_bytes); gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize = rbSize; gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart = 0; From 479784a06440e1a835b658f9fa29320f0293a283 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 13:15:58 -0700 Subject: [PATCH 14/29] Calling proper nr_ue_get_rach function Also, reverted a DCI filtering change to exist again. --- executables/nr-ue.c | 22 ++- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 137 ++++++++----------- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 5 + 3 files changed, 74 insertions(+), 90 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 1d332e3bc8..ba2ff290f6 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -357,13 +357,21 @@ static void check_nr_prach(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_inf 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); fapi_nr_ul_config_prach_pdu *prach_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu; - uint8_t nr_prach = nr_ue_get_rach_nsa(prach_resources, - prach_pdu, - ul_info->module_id, - ul_info->cc_id, - ul_info->frame_tx, - ul_info->gNB_index, - ul_info->slot_tx); + uint8_t nr_prach = get_softmodem_params()->nsa ? + nr_ue_get_rach_nsa(prach_resources, + prach_pdu, + ul_info->module_id, + ul_info->cc_id, + ul_info->frame_tx, + ul_info->gNB_index, + ul_info->slot_tx) : + nr_ue_get_rach(prach_resources, + prach_pdu, + ul_info->module_id, + ul_info->cc_id, + ul_info->frame_tx, + ul_info->gNB_index, + ul_info->slot_tx); if (nr_prach == 1) { mac->ra.ra_state = GENERATE_PREAMBLE; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 6714750a3c..98f67f1311 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -667,6 +667,10 @@ uint8_t nr_ue_get_rach_nsa(NR_PRACH_RESOURCES_t *prach_resources, NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); RA_config_t *ra = &mac->ra; + uint8_t mac_sdus[MAX_NR_ULSCH_PAYLOAD_BYTES]; + uint8_t *payload; + uint16_t size_sdu = 0; + unsigned short post_padding; NR_RACH_ConfigCommon_t *setup; if (mac->scc) setup = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; else setup = mac->scc_SIB->uplinkConfigCommon->initialUplinkBWP.rach_ConfigCommon->choice.setup; @@ -674,118 +678,85 @@ uint8_t nr_ue_get_rach_nsa(NR_PRACH_RESOURCES_t *prach_resources, NR_RACH_ConfigGeneric_t *rach_ConfigGeneric = &setup->rach_ConfigGeneric; NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = ra->rach_ConfigDedicated; + uint16_t sdu_lengths[NB_RB_MAX] = {0}; + int offset = 0; + int TBS_bytes = 848; + int header_length_total=0; + int mac_ce_len; + // Delay init RA procedure to allow the convergence of the IIR filter on PRACH noise measurements at gNB side if (!prach_resources->init_msg1) { - if ((mac->common_configuration_complete>0 || get_softmodem_params()->do_ra==1) && - ((MAX_FRAME_NUMBER+frame-prach_resources->sync_frame)%MAX_FRAME_NUMBER)>150){ + if ((mac->common_configuration_complete > 0 || get_softmodem_params()->do_ra || get_softmodem_params()->nsa) && + ((MAX_FRAME_NUMBER + frame - prach_resources->sync_frame) % MAX_FRAME_NUMBER) > 150) { prach_resources->init_msg1 = 1; } else { - LOG_D(NR_MAC,"PRACH Condition not met: frame %d, prach_resources->sync_frame %d\n", - frame,prach_resources->sync_frame); + LOG_D(NR_MAC,"PRACH Condition not met: frame %d, prach_resources->sync_frame %d\n",frame,prach_resources->sync_frame); return 0; } } - LOG_D(NR_MAC, "In %s: [UE %d][%d.%d]: init_msg1 %d, ra_state %d, RA_active %d\n", - __FUNCTION__, - mod_id, - frame, - nr_slot_tx, - prach_resources->init_msg1, - ra->ra_state, - ra->RA_active); + LOG_D(NR_MAC,"frame %d prach_resources->init_msg1 %d, ra->ra_state %d, ra->RA_active %d\n", + frame, prach_resources->init_msg1, ra->ra_state, ra->RA_active); if (prach_resources->init_msg1 && ra->ra_state != RA_SUCCEEDED) { if (ra->RA_active == 0) { /* RA not active - checking if RRC is ready to initiate the RA procedure */ - LOG_D(NR_MAC, "In %s: RA not active. Checking for data to transmit from upper layers...\n", __FUNCTION__); + LOG_D(NR_MAC, "RA not active. Checking for data to transmit from upper layers...\n"); - const uint8_t lcid = UL_SCH_LCID_CCCH; - const uint8_t sh_size = sizeof(NR_MAC_SUBHEADER_FIXED); - const uint8_t TBS_max = 8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); // Note: unclear the reason behind the selection of such TBS_max - int8_t size_sdu = 0; - uint8_t mac_ce[16] = {0}; - uint8_t *pdu = get_softmodem_params()->sa ? mac->CCCH_pdu.payload : mac_ce; - uint8_t *payload = pdu; + int TBS_max = 848; //8 + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); + payload = (uint8_t*) mac->CCCH_pdu.payload; + mac_ce_len = 0; + post_padding = 1; - // Concerning the C-RNTI MAC CE, it has to be included if the UL transmission (Msg3) is not being made for the CCCH logical channel. - // Therefore it has been assumed that this event only occurs only when RA is done and it is not SA mode. - if (get_softmodem_params()->sa) { + // initialisation by RRC - NR_MAC_SUBHEADER_FIXED *header = (NR_MAC_SUBHEADER_FIXED *) pdu; - pdu += sh_size; - - // initialisation by RRC + // TODO: To be removed after RA procedures fully implemented + if(get_softmodem_params()->do_ra) { nr_rrc_ue_generate_RRCSetupRequest(mod_id,gNB_id); - + size_sdu = (uint16_t) nr_mac_rrc_data_req_ue(mod_id, CC_id, gNB_id, frame, CCCH, mac_sdus); // CCCH PDU - size_sdu = nr_mac_rrc_data_req_ue(mod_id, CC_id, gNB_id, frame, CCCH, pdu); - LOG_D(NR_MAC, "In %s: [UE %d][%d.%d]: Requested RRCConnectionRequest, got %d bytes for LCID 0x%02x \n", __FUNCTION__, mod_id, frame, nr_slot_tx, size_sdu, lcid); - - if (size_sdu > 0) { - - // UE Contention Resolution Identity - // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to determine whether or not the - // Random Access Procedure has been successful after reception of Msg4 - memcpy(ra->cont_res_id, pdu, sizeof(uint8_t) * 6); - - pdu += size_sdu; - ra->Msg3_size = size_sdu + sh_size; - - // Build header - header->R = 0; - header->LCID = lcid; - - } else { - pdu -= sh_size; - } - + sdu_lengths[0] = size_sdu; + LOG_D(NR_MAC,"[UE %d] Frame %d: Requested RRCConnectionRequest, got %d bytes\n", mod_id, frame, size_sdu); } else { - - size_sdu = nr_write_ce_ulsch_pdu(pdu, mac, 0, &(mac->crnti), NULL, NULL, NULL); - pdu += size_sdu; - ra->Msg3_size = size_sdu; - + // fill ulsch_buffer with random data + for (int i = 0; i < TBS_bytes; i++){ + mac_sdus[i] = (unsigned char) (lrand48()&0xff); + } + //Sending SDUs with size 1 + //Initialize elements of sdu_lengths + sdu_lengths[0] = TBS_bytes - 3 - post_padding - mac_ce_len; + header_length_total += 2 + (sdu_lengths[0] >= 128); + size_sdu += sdu_lengths[0]; } - if (size_sdu > 0 && ra->generate_nr_prach == GENERATE_PREAMBLE) { - LOG_D(NR_MAC, "In %s: [UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", __FUNCTION__, mod_id, frame, nr_slot_tx); - AssertFatal(TBS_max > ra->Msg3_size, "In %s: allocated resources are not enough for Msg3!\n", __FUNCTION__); + if (size_sdu > 0) { + + // UE Contention Resolution Identity + // Store the first 48 bits belonging to the uplink CCCH SDU within Msg3 to determine whether or not the + // Random Access Procedure has been successful after reception of Msg4 + memcpy(ra->cont_res_id, mac_sdus, sizeof(uint8_t) * 6); + + LOG_D(NR_MAC, "[UE %d][%d.%d]: starting initialisation Random Access Procedure...\n", mod_id, frame, nr_slot_tx); + + ra->Msg3_size = size_sdu + sizeof(NR_MAC_SUBHEADER_SHORT) + sizeof(NR_MAC_SUBHEADER_SHORT); - // Init RA procedure init_RA(mod_id, prach_resources, setup, rach_ConfigGeneric, rach_ConfigDedicated); + // prach_resources->Msg3 = payload; nr_get_RA_window(mac); + // Fill in preamble and PRACH resources - nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated); + if (ra->generate_nr_prach == GENERATE_PREAMBLE) { + nr_get_prach_resources(mod_id, CC_id, gNB_id, prach_resources, prach_pdu, rach_ConfigDedicated); + } // Padding: fill remainder with 0 - if (TBS_max - ra->Msg3_size > 0) { - LOG_D(NR_MAC, "In %s: remaining %d bytes, filling with padding\n", __FUNCTION__, TBS_max - ra->Msg3_size); - ((NR_MAC_SUBHEADER_FIXED *) pdu)->R = 0; - ((NR_MAC_SUBHEADER_FIXED *) pdu)->LCID = UL_SCH_LCID_PADDING; - pdu += sizeof(NR_MAC_SUBHEADER_FIXED); - for (int j = 0; j < TBS_max - ra->Msg3_size - sizeof(NR_MAC_SUBHEADER_FIXED); j++) { - pdu[j] = 0; - } + if (post_padding > 0){ + for (int j = 0; j < (TBS_max - offset); j++) + payload[offset + j] = 0; } - - // Dumping ULSCH payload - LOG_D(NR_MAC, "In %s: dumping UL Msg3 MAC PDU with length %d: \n", __FUNCTION__, TBS_max); - for(int k = 0; k < TBS_max; k++) { - LOG_D(NR_MAC,"(%i): %i\n", k, payload[k]); - } - - // Msg3 was initialized with TBS_max bytes because the RA_Msg3_size will only be known after - // receiving Msg2 (which contains the Msg3 resource reserve). - // Msg3 will be transmitted with RA_Msg3_size bytes, removing unnecessary 0s. - mac->ulsch_pdu.Pdu_size = TBS_max; - memcpy(mac->ulsch_pdu.payload, payload, TBS_max); - - } else { - return 0; } } else if (ra->RA_window_cnt != -1) { // RACH is active @@ -814,7 +785,7 @@ uint8_t nr_ue_get_rach_nsa(NR_PRACH_RESOURCES_t *prach_resources, } else if (ra->RA_window_cnt > 0) { - LOG_D(MAC, "[UE %d][%d.%d]: RAR not received yet (RA window count %d) \n", mod_id, frame, nr_slot_tx, ra->RA_window_cnt); + LOG_I(MAC, "[UE %d][%d.%d]: RAR not received yet (RA window count %d) \n", mod_id, frame, nr_slot_tx, ra->RA_window_cnt); // Fill in preamble and PRACH resources ra->RA_window_cnt--; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index c803ebb8b3..5d21db80f4 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3802,6 +3802,11 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t LOG_D(NR_MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index); + if (get_softmodem_params()->nsa && mac->crnti == ra->t_crnti) + { + LOG_D(MAC, "Discarding the received RAR.\n"); + return -1; + } while (1) { n_subheaders++; if (rarh->T == 1) { From 59458c9690c8205ba84fd605b8f59de382cb1ea4 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 16:36:50 -0700 Subject: [PATCH 15/29] Reverting changes that did not fix SA mode --- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 4 ++++ openair2/RRC/NR/rrc_gNB.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 71bab705ef..0d16602348 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -519,6 +519,10 @@ void nr_initiate_ra_proc(module_id_t module_idP, for (int i = 0; i < NR_NB_RA_PROC_MAX; i++) { NR_RA_t *ra = &cc->ra[i]; pr_found = 0; + const int UE_id = find_nr_UE_id(module_idP, ra->rnti); + if (UE_id != -1) { + continue; + } 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 diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 8781d17250..ccee95bf0f 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -224,7 +224,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier, configuration); } - else if (!NODE_IS_DU(rrc->node_type)) { + if (!NODE_IS_DU(rrc->node_type)) { rrc->carrier.SIB23 = (uint8_t *) malloc16(100); AssertFatal(rrc->carrier.SIB23 != NULL, "cannot allocate memory for SIB"); rrc->carrier.sizeof_SIB23 = do_SIB23_NR(&rrc->carrier, configuration); From f9b846154848b323485cc8786848ae523b82a4a6 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 16:40:44 -0700 Subject: [PATCH 16/29] Reverting more changing that were unnecessary for SA --- openair2/RRC/NR/rrc_gNB.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index ccee95bf0f..662bf250ec 100755 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -212,16 +212,13 @@ void rrc_gNB_generate_SgNBAdditionRequestAcknowledge( static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration) { LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); - if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type) || get_softmodem_params()->emulate_l2) { + if (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)) { rrc->carrier.MIB = (uint8_t *) malloc16(4); rrc->carrier.sizeof_MIB = do_MIB_NR(rrc,0); } - if(get_softmodem_params()->sa && - ((NODE_IS_DU(rrc->node_type) || - NODE_IS_MONOLITHIC(rrc->node_type) || - get_softmodem_params()->emulate_l2))) { - rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier, configuration); + if((get_softmodem_params()->sa) && ( (NODE_IS_DU(rrc->node_type) || NODE_IS_MONOLITHIC(rrc->node_type)))) { + rrc->carrier.sizeof_SIB1 = do_SIB1_NR(&rrc->carrier,configuration); } if (!NODE_IS_DU(rrc->node_type)) { @@ -234,7 +231,7 @@ static void init_NR_SI(gNB_RRC_INST *rrc, gNB_RrcConfigurationReq *configuration LOG_I(NR_RRC,"Done init_NR_SI\n"); - if (NODE_IS_MONOLITHIC(rrc->node_type) || get_softmodem_params()->emulate_l2){ + if (NODE_IS_MONOLITHIC(rrc->node_type)){ rrc_mac_config_req_gNB(rrc->module_id, rrc->carrier.ssb_SubcarrierOffset, rrc->carrier.pdsch_AntennaPorts, From 7c484fba3356b498b61a3376f822ddc783110ffa Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 17:17:55 -0700 Subject: [PATCH 17/29] Changing how we filter DCI's fixes NSA mode It will likely break SA mode because it will filter out Msg3. I will come back to this and fix it for Msg3. --- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 1cdd38b503..69f96d5362 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -299,13 +299,13 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ /* For multiple UEs, we need to be able to filter the rx'd messages by the RNTI. However, we do not have the RNTI value until the CFRA (NSA) or CBRA (SA) procedure is complete. The check below will handle this. - Also, depending on the RNTI value, we can have a SIB (0xffff), RAR (0x10b), + Also, depending on the RA state, we can have a SIB (0xffff), RAR (0x10b), Msg3 (TC_RNTI) or an actual DCI message (CRNTI). When we get Msg3, the MAC instance of the UE still has a CRNTI = 0. Only once the RA procedure succeeds is the CRNTI value updated to the TC_RNTI. */ 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) && - (mac->ra.ra_state == RA_SUCCEEDED)) + ((dci_pdu_list->RNTI != mac->ra.ra_rnti) || mac->ra.RA_RAPID_found)) { LOG_D(NR_MAC, "We are filtering PDCCH DCI pdu because RNTI doesnt match! " "dci_pdu_list->RNTI (%x) != mac->crnti (%x)\n", @@ -621,6 +621,11 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, int slot = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(0); + if (mac->scc == NULL && mac->scc_SIB == NULL) + { + return; + } + if (pthread_mutex_lock(&mac->mutex_dl_info)) abort(); if (dl_tti_request) From 954a64a1c0e955322ffff40256c0e0fd3496b813 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 17:58:01 -0700 Subject: [PATCH 18/29] SA mode SIB processing In SA mode, we will not be able to process the SIB if we change for mac->scc_SIB == NULL : return; So we change the statement for NSA mode --- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 69f96d5362..8fc8a585fc 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -621,7 +621,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, int slot = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(0); - if (mac->scc == NULL && mac->scc_SIB == NULL) + if (mac->scc == NULL && get_softmodem_params()->nsa) { return; } From bf8a37f8787a0eca55116594bd90e0ac4c71b653 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Thu, 4 Nov 2021 18:27:26 -0700 Subject: [PATCH 19/29] CBRA and CFRA procedure complete!! --- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 43 ++++++++++++++------- 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 8fc8a585fc..d8cd2159f3 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -254,6 +254,34 @@ static void fill_mib_in_rx_ind(nfapi_nr_dl_tti_request_pdu_t *pdu_list, fapi_nr_ } +static bool is_my_dci(NR_UE_MAC_INST_t *mac, nfapi_nr_dl_dci_pdu_t *received_pdu) +{ + /* For multiple UEs, we need to be able to filter the rx'd messages by + the RNTI. The filtering is different between NSA mode and SA mode. + NSA mode has a two step CFRA procedure and SA has a 4 step procedure. + We only need to check if the rx'd RNTI doesnt match the CRNTI if the RAR + has been processed already, in NSA mode. + In SA, depending on the RA state, we can have a SIB (0xffff), RAR (0x10b), + Msg3 (TC_RNTI) or an actual DCI message (CRNTI). When we get Msg3, the + MAC instance of the UE still has a CRNTI = 0. We should only check if the + CRNTI doesnt match the received RNTI in SA mode if Msg3 has been processed + already. Only once the RA procedure succeeds is the CRNTI value updated + to the TC_RNTI. */ + if (get_softmodem_params()->nsa) + { + if ((received_pdu->RNTI != mac->crnti) && + ((received_pdu->RNTI != mac->ra.ra_rnti) || mac->ra.RA_RAPID_found)) + return false; + } + else if (get_softmodem_params()->sa) + { + if ((received_pdu->RNTI != mac->crnti) && + (mac->ra.ra_state == RA_SUCCEEDED)) + return false; + } + return true; +} + static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_nr_dl_tti_request_t *dl_tti_request) { NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id); @@ -296,21 +324,10 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ "The number of DCIs is greater than dci_list"); for (int j = 0; j < num_dcis; j++) { - /* For multiple UEs, we need to be able to filter the rx'd messages by - the RNTI. However, we do not have the RNTI value until the CFRA (NSA) - or CBRA (SA) procedure is complete. The check below will handle this. - Also, depending on the RA state, we can have a SIB (0xffff), RAR (0x10b), - Msg3 (TC_RNTI) or an actual DCI message (CRNTI). When we get Msg3, the - MAC instance of the UE still has a CRNTI = 0. Only once the RA procedure - succeeds is the CRNTI value updated to the TC_RNTI. */ 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) && - ((dci_pdu_list->RNTI != mac->ra.ra_rnti) || mac->ra.RA_RAPID_found)) + if (!is_my_dci(mac, dci_pdu_list)) { - LOG_D(NR_MAC, "We are filtering PDCCH DCI pdu because RNTI doesnt match! " - "dci_pdu_list->RNTI (%x) != mac->crnti (%x)\n", - dci_pdu_list->RNTI, mac->crnti); - continue; + continue; } fill_dl_info_with_pdcch(dl_info->dci_ind, dci_pdu_list, pdu_idx); if (dci_pdu_list->RNTI == 0xffff) From f04f8e7d7b22efd228c09667d885d980aabf143f Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Fri, 5 Nov 2021 11:29:45 -0700 Subject: [PATCH 20/29] Setting ra_state breaks RA Procedure for NSA mode Also, changed some if statement formatting. --- executables/nr-ue.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index ba2ff290f6..784f37d824 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -374,7 +374,6 @@ static void check_nr_prach(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_inf ul_info->slot_tx); if (nr_prach == 1) { - mac->ra.ra_state = GENERATE_PREAMBLE; L1_nsa_prach_procedures(ul_info->frame_tx, ul_info->slot_tx, prach_pdu); ul_config->number_pdus = 0; ul_info->ue_sched_mode = SCHED_ALL; @@ -446,16 +445,13 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) module_id_t mod_id = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(mod_id); - if (mac->mib == NULL) + if (get_softmodem_params()->sa && mac->mib == NULL) { - if (get_softmodem_params()->sa) - { - LOG_D(NR_MAC, "We haven't gotten MIB. Lets see if we received it\n"); - nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); - process_queued_nr_nfapi_msgs(mac, sfn_slot); - } + LOG_D(NR_MAC, "We haven't gotten MIB. Lets see if we received it\n"); + nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); + process_queued_nr_nfapi_msgs(mac, sfn_slot); } - if (mac->scc == NULL && mac->scc_SIB == NULL ) + if (mac->scc == NULL && mac->scc_SIB == NULL) { LOG_D(MAC, "[NSA] mac->scc == NULL and [SA] mac->scc_SIB == NULL!\n"); continue; From 3569ba630ce087f861dbdfe4cad3f537cbe2a35f Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Fri, 5 Nov 2021 11:49:34 -0700 Subject: [PATCH 21/29] Reverted log level and gNB_RA_sched for NSA mode --- common/utils/LOG/log.h | 2 +- openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/common/utils/LOG/log.h b/common/utils/LOG/log.h index ce3ada3972..6083d23580 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 (1) logMinimal(COMPONENT, 'D', __VA_ARGS__); while (0) +# define LOG_D(COMPONENT, ...) do if (0) 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/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c index 0d16602348..22a237a9eb 100644 --- a/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c +++ b/openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c @@ -527,6 +527,8 @@ void nr_initiate_ra_proc(module_id_t module_idP, 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]) { + if (ra->rnti == 0 && get_softmodem_params()->nsa) + continue; pr_found=1; break; } From a2a823d54b3ab344440f5fb0cbc5621c712a797f Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Fri, 5 Nov 2021 11:56:28 -0700 Subject: [PATCH 22/29] Removing log --- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 1 - 1 file changed, 1 deletion(-) diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index d8cd2159f3..76eb5c66e5 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -294,7 +294,6 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ int pdu_idx = 0; int num_pdus = dl_tti_request->dl_tti_request_body.nPDUs; - LOG_D(NR_MAC, "This is the total number of PDUS in dl_tti_req = %d\n", num_pdus); if (num_pdus <= 0) { LOG_E(NR_PHY, "%s: dl_tti_request number of PDUS <= 0\n", __FUNCTION__); From fbd791d4a4bee0ddffdc5072991cbcc4090419ae Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Fri, 5 Nov 2021 12:22:00 -0700 Subject: [PATCH 23/29] Removing unnecessary DCI filtering. The DCIs are filtered already in the NRUE when the NFAPI messages are handled. --- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 5d21db80f4..0d76b9767c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -599,13 +599,6 @@ 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 ((mac->ra.ra_state == RA_SUCCEEDED) && (dci->rnti != mac->crnti)) { - LOG_D(MAC,"[%d %d] Discarding the received dci indication because rnti %4x " - "!= mac->crnti %4x after RA procedure is complete: (RA state %d)\n", - frame, slot, dci->rnti, mac->crnti, mac->ra.ra_state); - return -1; - } - 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, (uint64_t *)dci->payloadBits, def_dci_pdu_rel15); From f53668236728daa2a80b1ef28b2d0bc0eae75020 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Fri, 5 Nov 2021 14:59:00 -0700 Subject: [PATCH 24/29] Fixing formatting and added AssertFatal --- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 30 ++++++++++----------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 76eb5c66e5..c452e99ac3 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -234,17 +234,18 @@ static void fill_dl_info_with_pdcch(fapi_nr_dci_indication_t *dci, nfapi_nr_dl_d static void fill_mib_in_rx_ind(nfapi_nr_dl_tti_request_pdu_t *pdu_list, fapi_nr_rx_indication_t *rx_ind, int pdu_idx, int pdu_type) { - AssertFatal(pdu_list->PDUSize < sizeof(rx_ind->rx_indication_body) / sizeof(rx_ind->rx_indication_body[0]), - "PDU size (%d) is greater than rx_indication_body size!\n", pdu_list->PDUSize); - nfapi_nr_dl_tti_ssb_pdu_rel15_t *ssb_pdu = &pdu_list->ssb_pdu.ssb_pdu_rel15; + AssertFatal(pdu_idx < sizeof(rx_ind->rx_indication_body) / sizeof(rx_ind->rx_indication_body[0]), + "pdu_index (%d) is greater than rx_indication_body size!\n", pdu_idx); + AssertFatal(pdu_idx == rx_ind->number_pdus, "Invalid pdu_idx %d!\n", pdu_idx); LOG_D(NR_MAC, "Recevied an SSB and are filling rx_ind with the MIB!\n"); + + nfapi_nr_dl_tti_ssb_pdu_rel15_t *ssb_pdu = &pdu_list->ssb_pdu.ssb_pdu_rel15; rx_ind->rx_indication_body[pdu_idx].ssb_pdu.cell_id = ssb_pdu->PhysCellId; - rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu = CALLOC(3, - sizeof(*rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu)); - rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu[0] = (ssb_pdu->bchPayload) & 0xffff; - rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu[1] = (ssb_pdu->bchPayload >> 8) & 0xffff; - rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu[2] = (ssb_pdu->bchPayload >> 16) & 0xffff; + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu = MALLOC(3 * sizeof(*rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu)); + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu[0] = (ssb_pdu->bchPayload) & 0xff; + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu[1] = (ssb_pdu->bchPayload >> 8) & 0xff; + rx_ind->rx_indication_body[pdu_idx].ssb_pdu.pdu[2] = (ssb_pdu->bchPayload >> 16) & 0xff; rx_ind->rx_indication_body[pdu_idx].ssb_pdu.rsrp_dBm = ssb_pdu->ssbRsrp; rx_ind->rx_indication_body[pdu_idx].ssb_pdu.ssb_index = ssb_pdu->SsbBlockIndex; rx_ind->rx_indication_body[pdu_idx].ssb_pdu.ssb_length = pdu_list->PDUSize; @@ -269,15 +270,14 @@ static bool is_my_dci(NR_UE_MAC_INST_t *mac, nfapi_nr_dl_dci_pdu_t *received_pdu to the TC_RNTI. */ if (get_softmodem_params()->nsa) { - if ((received_pdu->RNTI != mac->crnti) && - ((received_pdu->RNTI != mac->ra.ra_rnti) || mac->ra.RA_RAPID_found)) - return false; + if (received_pdu->RNTI != mac->crnti && + (received_pdu->RNTI != mac->ra.ra_rnti || mac->ra.RA_RAPID_found)) + return false; } - else if (get_softmodem_params()->sa) + if (get_softmodem_params()->sa) { - if ((received_pdu->RNTI != mac->crnti) && - (mac->ra.ra_state == RA_SUCCEEDED)) - return false; + if (received_pdu->RNTI != mac->crnti && mac->ra.ra_state == RA_SUCCEEDED) + return false; } return true; } From 85e066054f8c6c4b44400b3ceb31e8bbc010e846 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Fri, 5 Nov 2021 15:45:48 -0700 Subject: [PATCH 25/29] Checking for emulate_l2 instead of NSA flag --- executables/nr-uesoftmodem.c | 2 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index d6c8d389aa..82aef08f03 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -489,7 +489,7 @@ int main( int argc, char **argv ) { if (get_softmodem_params()->sa) AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n"); - if (get_softmodem_params()->emulate_l2) + if (!get_softmodem_params()->nsa && get_softmodem_params()->emulate_l2) start_oai_nrue_threads(); if (!get_softmodem_params()->nsa && !get_softmodem_params()->emulate_l2) { diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index c452e99ac3..1c159f77cf 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -1124,7 +1124,7 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){ nr_ue_if_module_inst[module_id]->current_frame = 0; nr_ue_if_module_inst[module_id]->current_slot = 0; nr_ue_if_module_inst[module_id]->phy_config_request = nr_ue_phy_config_request; - if (get_softmodem_params()->emulate_l2 || get_softmodem_params()->nsa) + if (get_softmodem_params()->emulate_l2) nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response_stub; else nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response; From fa4617c0bfa38febcf6082dec6fff3e8237ab52f Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Mon, 8 Nov 2021 10:53:38 -0800 Subject: [PATCH 26/29] Fixing MR based on OAI feedback The following was changed in this commit: - A new struct in the mac instance was created for all emulated L1 fields. - NR UE RRC state bug was fixed - Checking the RAR rnti based on the MAC instance ra.ra_rnti and not hardcoding to 0x10b - Modified the name of the new emulate_l2 flag to make sense: emulate_l1 --- executables/nr-ue.c | 6 +-- executables/nr-uesoftmodem.c | 4 +- executables/softmodem-common.h | 8 ++-- openair2/LAYER2/NR_MAC_COMMON/nr_mac.h | 10 +++++ openair2/LAYER2/NR_MAC_UE/config_ue.c | 2 +- openair2/LAYER2/NR_MAC_UE/mac_defs.h | 9 +---- openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c | 2 +- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 2 +- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 42 +++++++++++--------- openair2/RRC/NR_UE/rrc_UE.c | 13 ++---- 10 files changed, 51 insertions(+), 47 deletions(-) diff --git a/executables/nr-ue.c b/executables/nr-ue.c index 784f37d824..2daf2fe1ad 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -269,12 +269,12 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot) nfapi_nr_ul_dci_request_t *ul_dci_request = get_queue(&nr_ul_dci_req_queue); LOG_D(NR_MAC, "Try to get a ul_tti_req for sfn/slot %d %d from queue with %lu items\n", - NFAPI_SFNSLOT2SFN(mac->active_harq_sfn_slot),NFAPI_SFNSLOT2SLOT(mac->active_harq_sfn_slot), nr_ul_tti_req_queue.num_items); - nfapi_nr_ul_tti_request_t *ul_tti_request = unqueue_matching(&nr_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->active_harq_sfn_slot); + NFAPI_SFNSLOT2SFN(mac->nr_ue_emul_l1.active_harq_sfn_slot),NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.active_harq_sfn_slot), nr_ul_tti_req_queue.num_items); + nfapi_nr_ul_tti_request_t *ul_tti_request = unqueue_matching(&nr_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->nr_ue_emul_l1.active_harq_sfn_slot); if (!ul_tti_request) { LOG_D(NR_MAC, "Try to get a ul_tti_req from seprate queue because dl_tti_req was late\n"); - ul_tti_request = unqueue_matching(&nr_wait_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->active_harq_sfn_slot); + ul_tti_request = unqueue_matching(&nr_wait_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->nr_ue_emul_l1.active_harq_sfn_slot); } if (rach_ind && rach_ind->number_of_pdus > 0) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 82aef08f03..d6f2a48330 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -489,10 +489,10 @@ int main( int argc, char **argv ) { if (get_softmodem_params()->sa) AssertFatal(get_softmodem_params()->phy_test == 0,"Standalone mode and phy_test are mutually exclusive\n"); - if (!get_softmodem_params()->nsa && get_softmodem_params()->emulate_l2) + if (!get_softmodem_params()->nsa && get_softmodem_params()->emulate_l1) start_oai_nrue_threads(); - if (!get_softmodem_params()->nsa && !get_softmodem_params()->emulate_l2) { + if (!get_softmodem_params()->emulate_l1) { for (int CC_id=0; CC_idul_config_request = (fapi_nr_ul_config_request_t *)calloc(num_slots_ul, sizeof(fapi_nr_ul_config_request_t)); // Setup the SSB to Rach Occasions mapping according to the config build_ssb_to_ro_map(mac);//->scc, mac->phy_config.config_req.cell_config.frame_duplex_type); - if (!get_softmodem_params()->emulate_l2) + if (!get_softmodem_params()->emulate_l1) mac->if_module->phy_config_request(&mac->phy_config); mac->common_configuration_complete = 1; } diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 4e64aafcab..0e02c9084b 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -433,13 +433,8 @@ typedef struct { // Defined for abstracted mode nr_downlink_indication_t dl_info; NR_UE_HARQ_STATUS_t dl_harq_info[16]; - bool expected_sib; - bool index_has_sib[16]; - bool expected_rar; - bool index_has_rar[16]; - bool expected_dci; - bool index_has_dci[16]; - int active_harq_sfn_slot; + + nr_emulated_l1_t nr_ue_emul_l1; pthread_mutex_t mutex_dl_info; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 98f67f1311..3eaff01957 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -597,7 +597,7 @@ void nr_get_prach_resources(module_id_t mod_id, } else { /* TODO: This controls the tx_power of UE and the ramping procedure of RA of UE. Later we can abstract this, perhaps in the proxy. But for the time being lets leave it as below. */ - int16_t dl_pathloss = !get_softmodem_params()->emulate_l2 ? get_nr_PL(mod_id, CC_id, gNB_id) : 0; + int16_t dl_pathloss = !get_softmodem_params()->emulate_l1 ? get_nr_PL(mod_id, CC_id, gNB_id) : 0; ssb_rach_config(ra, prach_resources, nr_rach_ConfigCommon, prach_pdu); ra_preambles_config(prach_resources, mac, dl_pathloss); LOG_D(MAC, "[RAPROC] - Selected RA preamble index %d for contention-based random access procedure... \n", prach_resources->ra_PreambleIndex); diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 0d76b9767c..6a9e67c90f 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -1325,7 +1325,7 @@ void set_harq_status(NR_UE_MAC_INST_t *mac, // FIXME k0 != 0 currently not taken into consideration current_harq->dl_frame = frame; current_harq->dl_slot = slot; - mac->active_harq_sfn_slot = NFAPI_SFNSLOT2HEX(frame, (slot + data_toul_fb)); + mac->nr_ue_emul_l1.active_harq_sfn_slot = NFAPI_SFNSLOT2HEX(frame, (slot + data_toul_fb)); LOG_D(NR_PHY,"Setting harq_status for harq_id %d, dl %d.%d, sched ul %d.%d\n", harq_id, frame, slot, frame, (slot + data_toul_fb)); diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 1c159f77cf..6fd58c24c7 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -285,12 +285,12 @@ static bool is_my_dci(NR_UE_MAC_INST_t *mac, nfapi_nr_dl_dci_pdu_t *received_pdu static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_nr_dl_tti_request_t *dl_tti_request) { NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id); - mac->expected_sib = false; - memset(mac->index_has_sib, 0, sizeof(*mac->index_has_sib)); - mac->expected_rar = false; - memset(mac->index_has_rar, 0, sizeof(*mac->index_has_rar)); - mac->expected_dci = false; - memset(mac->index_has_dci, 0, sizeof(*mac->index_has_dci)); + mac->nr_ue_emul_l1.expected_sib = false; + memset(mac->nr_ue_emul_l1.index_has_sib, 0, sizeof(*mac->nr_ue_emul_l1.index_has_sib)); + mac->nr_ue_emul_l1.expected_rar = false; + memset(mac->nr_ue_emul_l1.index_has_rar, 0, sizeof(*mac->nr_ue_emul_l1.index_has_rar)); + mac->nr_ue_emul_l1.expected_dci = false; + memset(mac->nr_ue_emul_l1.index_has_dci, 0, sizeof(*mac->nr_ue_emul_l1.index_has_dci)); int pdu_idx = 0; int num_pdus = dl_tti_request->dl_tti_request_body.nPDUs; @@ -331,20 +331,20 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ fill_dl_info_with_pdcch(dl_info->dci_ind, dci_pdu_list, pdu_idx); if (dci_pdu_list->RNTI == 0xffff) { - mac->expected_sib = true; - mac->index_has_sib[j] = true; + mac->nr_ue_emul_l1.expected_sib = true; + mac->nr_ue_emul_l1.index_has_sib[j] = true; LOG_D(NR_MAC, "Setting index_has_sib[%d] = true\n", j); } - else if (dci_pdu_list->RNTI == 0x10b) + else if (dci_pdu_list->RNTI == mac->ra.ra_rnti) { - mac->expected_rar = true; - mac->index_has_rar[j] = true; + mac->nr_ue_emul_l1.expected_rar = true; + mac->nr_ue_emul_l1.index_has_rar[j] = true; LOG_D(NR_MAC, "Setting index_has_rar[%d] = true\n", j); } else { - mac->expected_dci = true; - mac->index_has_dci[j] = true; + mac->nr_ue_emul_l1.expected_dci = true; + mac->nr_ue_emul_l1.index_has_dci[j] = true; LOG_D(NR_MAC, "Setting index_has_dci[%d] = true\n", j); } pdu_idx++; @@ -425,24 +425,26 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi for (int i = 0; i < num_pdus; i++) { nfapi_nr_pdu_t *pdu_list = &tx_data_request->pdu_list[i]; - if (mac->index_has_sib[i]) + if (mac->nr_ue_emul_l1.index_has_sib[i]) { + AssertFatal(!get_softmodem_params()->nsa, + "Should not be processing SIB in NSA mode, something bad happened\n"); fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_SIB); pdu_idx++; } - else if (mac->index_has_rar[i]) + else if (mac->nr_ue_emul_l1.index_has_rar[i]) { fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_RAR); pdu_idx++; } - else if (mac->index_has_dci[i]) + else if (mac->nr_ue_emul_l1.index_has_dci[i]) { fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_DLSCH); pdu_idx++; } else { - LOG_D(NR_MAC, "mac->index_has_dci[%d] = 0, so this index contained a DCI for a different UE\n", i); + LOG_D(NR_MAC, "mac->nr_ue_emul_l1.index_has_dci[%d] = 0, so this index contained a DCI for a different UE\n", i); } } @@ -656,7 +658,9 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, incoming tx_data_request is also destined for the current UE. If the RAR hasn't been processed yet, we do not want to be filtering the tx_data_requests. */ - if (tx_data_request && (mac->expected_sib || mac->expected_rar || mac->expected_dci)) + if (tx_data_request && (mac->nr_ue_emul_l1.expected_sib || + mac->nr_ue_emul_l1.expected_rar || + mac->nr_ue_emul_l1.expected_dci)) { frame = tx_data_request->SFN; slot = tx_data_request->Slot; @@ -1124,7 +1128,7 @@ nr_ue_if_module_t *nr_ue_if_module_init(uint32_t module_id){ nr_ue_if_module_inst[module_id]->current_frame = 0; nr_ue_if_module_inst[module_id]->current_slot = 0; nr_ue_if_module_inst[module_id]->phy_config_request = nr_ue_phy_config_request; - if (get_softmodem_params()->emulate_l2) + if (get_softmodem_params()->emulate_l1) nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response_stub; else nr_ue_if_module_inst[module_id]->scheduled_response = nr_ue_scheduled_response; diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index 0626906c5b..b89b2d216f 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -1206,8 +1206,8 @@ int8_t nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message(module_id_t module_id, check_requested_SI_List(module_id, NR_UE_rrc_inst[module_id].requested_SI_List, *sib1); if( nr_rrc_get_state(module_id) <= RRC_STATE_IDLE_NR ) { NR_UE_rrc_inst[module_id].ra_trigger = INITIAL_ACCESS_FROM_RRC_IDLE; - LOG_D(PHY,"Setting state to NR_RRC_SI_RECEIVED\n"); - nr_rrc_set_state (module_id, NR_RRC_SI_RECEIVED); + LOG_D(PHY,"Setting state to RRC_STATE_IDLE_NR\n"); + nr_rrc_set_state (module_id, RRC_STATE_IDLE_NR); } // take ServingCellConfigCommon and configure L1/L2 NR_UE_rrc_inst[module_id].servingCellConfigCommonSIB = sib1->servingCellConfigCommon; @@ -1763,13 +1763,8 @@ int8_t nr_rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const NR_SRB //----------------------------------------------------------------------------- void nr_rrc_ue_generate_RRCSetupRequest(module_id_t module_id, const uint8_t gNB_index) { uint8_t i=0,rv[6]; - /* TODO: Melissa, this is not a proper fix. The NAS layer should be - getting intialized and then the substate will not crash when AMF_MODE_ENABLED - is equal to 1. However, as a side note, when we keep the code below, - once the CBRA procedure is finished, the NAS layer is ran and the AMF_MODE_ENABLED - is switched to one and the substate assertion in the nr_rrc_set_sub_state() - does not happen. So show this to Raymond and maybe its okay? */ - if(get_softmodem_params()->sa && !get_softmodem_params()->emulate_l2) { + + if(get_softmodem_params()->sa) { AMF_MODE_ENABLED = 1; } if(NR_UE_rrc_inst[module_id].Srb0[gNB_index].Tx_buffer.payload_size ==0) { From dbacbfd0cdd71cc7e87beaaaa02f66231ae06db8 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Mon, 8 Nov 2021 11:28:41 -0800 Subject: [PATCH 27/29] Removing more unnecessary filtering in NRUE Got rid of unnecessary mac->scc check as well --- executables/nr-uesoftmodem.c | 4 +++- openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c | 5 ----- openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 5 ----- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index d6f2a48330..0fd9d0fc07 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -480,7 +480,9 @@ int main( int argc, char **argv ) { NB_INST=1; PHY_vars_UE_g = malloc(sizeof(PHY_VARS_NR_UE **)); PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_NR_UE *)*MAX_NUM_CCs); - RCconfig_nr_ue_L1(); + if (get_softmodem_params()->emulate_l1) { + RCconfig_nr_ue_L1(); + } if (get_softmodem_params()->do_ra) diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 6a9e67c90f..d330060b79 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -3795,11 +3795,6 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t LOG_D(NR_MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index); - if (get_softmodem_params()->nsa && mac->crnti == ra->t_crnti) - { - LOG_D(MAC, "Discarding the received RAR.\n"); - return -1; - } while (1) { n_subheaders++; if (rarh->T == 1) { diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 6fd58c24c7..3d2b904e3c 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -639,11 +639,6 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, int slot = 0; NR_UE_MAC_INST_t *mac = get_mac_inst(0); - if (mac->scc == NULL && get_softmodem_params()->nsa) - { - return; - } - if (pthread_mutex_lock(&mac->mutex_dl_info)) abort(); if (dl_tti_request) From dbf2aba84381bc02cf58aabd13b65207e31e19b2 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Mon, 8 Nov 2021 14:41:51 -0800 Subject: [PATCH 28/29] Reverting white space change --- executables/nr-uesoftmodem.c | 1 - 1 file changed, 1 deletion(-) diff --git a/executables/nr-uesoftmodem.c b/executables/nr-uesoftmodem.c index 0fd9d0fc07..a190f1d8f9 100644 --- a/executables/nr-uesoftmodem.c +++ b/executables/nr-uesoftmodem.c @@ -484,7 +484,6 @@ int main( int argc, char **argv ) { RCconfig_nr_ue_L1(); } - if (get_softmodem_params()->do_ra) AssertFatal(get_softmodem_params()->phy_test == 0,"RA and phy_test are mutually exclusive\n"); From 83f8d7123302097d398db00bf9d8ca5d47c91071 Mon Sep 17 00:00:00 2001 From: Melissa Elkadi Date: Tue, 9 Nov 2021 09:44:48 -0800 Subject: [PATCH 29/29] Fixing indentation in if statement and adding conf file --- ...sci_gnb.band78.sa.fr1.106PRB.usrpn310.conf | 325 ++++++++++++++++++ openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c | 2 +- 2 files changed, 326 insertions(+), 1 deletion(-) create mode 100644 ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf diff --git a/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf new file mode 100644 index 0000000000..e0d31e46f7 --- /dev/null +++ b/ci-scripts/conf_files/episci/episci_gnb.band78.sa.fr1.106PRB.usrpn310.conf @@ -0,0 +1,325 @@ +Active_gNBs = ( "gNB-OAI"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + gNB_name = "gNB-OAI"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = 1; + plmn_list = ({ + mcc = 208; + mnc = 99; + mnc_length = 2; + snssaiList = ( + { + sst = 1; + sd = 0x1; // 0 false, else true + }, + { + sst = 1; + sd = 0x112233; // 0 false, else true + } + ); + + }); + + nr_cellid = 12345678L; + + ////////// Physical parameters: + + ssb_SubcarrierOffset = 0; + pdsch_AntennaPorts = 1; + pusch_AntennaPorts = 1; + ul_prbblacklist = "51,52,53,54" + + pdcch_ConfigSIB1 = ( + { + controlResourceSetZero = 12; + searchSpaceZero = 0; + } + ); + + servingCellConfigCommon = ( + { + #spCellConfigCommon + + physCellId = 0; + +# downlinkConfigCommon + #frequencyInfoDL + # this is 3600 MHz + 43 PRBs@30kHz SCS (same as initial BWP) + absoluteFrequencySSB = 641280; + dl_frequencyBand = 78; + # this is 3600 MHz + dl_absoluteFrequencyPointA = 640008; + #scs-SpecificCarrierList + dl_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + dl_subcarrierSpacing = 1; + dl_carrierBandwidth = 106; + #initialDownlinkBWP + #genericParameters + # this is RBstart=27,L=48 (275*(L-1))+RBstart + initialDLBWPlocationAndBandwidth = 12952; # 6366 12925 12956 28875 12952 +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialDLBWPsubcarrierSpacing = 1; + #pdcch-ConfigCommon + initialDLBWPcontrolResourceSetZero = 12; + initialDLBWPsearchSpaceZero = 0; + #pdsch-ConfigCommon + #pdschTimeDomainAllocationList (up to 16 entries) + initialDLBWPk0_0 = 0; #for DL slot + initialDLBWPmappingType_0 = 0; #0=typeA,1=typeB + initialDLBWPstartSymbolAndLength_0 = 40; #this is SS=1,L=13 + + initialDLBWPk0_1 = 0; #for mixed slot + initialDLBWPmappingType_1 = 0; + initialDLBWPstartSymbolAndLength_1 = 57; #this is SS=1,L=5 + + #uplinkConfigCommon + #frequencyInfoUL + ul_frequencyBand = 78; + #scs-SpecificCarrierList + ul_offstToCarrier = 0; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + ul_subcarrierSpacing = 1; + ul_carrierBandwidth = 106; + pMax = 20; + #initialUplinkBWP + #genericParameters + initialULBWPlocationAndBandwidth = 12952; +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + initialULBWPsubcarrierSpacing = 1; + #rach-ConfigCommon + #rach-ConfigGeneric + prach_ConfigurationIndex = 98; +#prach_msg1_FDM +#0 = one, 1=two, 2=four, 3=eight + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 13; + preambleReceivedTargetPower = -96; +#preamblTransMax (0...10) = (3,4,5,6,7,8,10,20,50,100,200) + preambleTransMax = 6; +#powerRampingStep +# 0=dB0,1=dB2,2=dB4,3=dB6 + powerRampingStep = 1; +#ra_ReponseWindow +#1,2,4,8,10,20,40,80 + ra_ResponseWindow = 4; +#ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR +#1=oneeighth,2=onefourth,3=half,4=one,5=two,6=four,7=eight,8=sixteen + ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR = 4; +#oneHalf (0..15) 4,8,12,16,...60,64 + ssb_perRACH_OccasionAndCB_PreamblesPerSSB = 14; +#ra_ContentionResolutionTimer +#(0..7) 8,16,24,32,40,48,56,64 + ra_ContentionResolutionTimer = 7; + rsrp_ThresholdSSB = 19; +#prach-RootSequenceIndex_PR +#1 = 839, 2 = 139 + prach_RootSequenceIndex_PR = 2; + prach_RootSequenceIndex = 1; + # SCS for msg1, can only be 15 for 30 kHz < 6 GHz, takes precendence over the one derived from prach-ConfigIndex + # + msg1_SubcarrierSpacing = 1, +# restrictedSetConfig +# 0=unrestricted, 1=restricted type A, 2=restricted type B + restrictedSetConfig = 0, + + # pusch-ConfigCommon (up to 16 elements) + initialULBWPk2_0 = 6; # used for UL slot + initialULBWPmappingType_0 = 1 + initialULBWPstartSymbolAndLength_0 = 41; # this is SS=0 L=13 + + initialULBWPk2_1 = 6; # used for mixed slot + initialULBWPmappingType_1 = 1; + initialULBWPstartSymbolAndLength_1 = 52; # this is SS=10 L=4 + + initialULBWPk2_2 = 7; # used for Msg.3 during RA + initialULBWPmappingType_2 = 1; + initialULBWPstartSymbolAndLength_2 = 52; # this is SS=10 L=4 + + msg3_DeltaPreamble = 1; + p0_NominalWithGrant =-90; + +# pucch-ConfigCommon setup : +# pucchGroupHopping +# 0 = neither, 1= group hopping, 2=sequence hopping + pucchGroupHopping = 0; + hoppingId = 40; + p0_nominal = -90; +# ssb_PositionsInBurs_BitmapPR +# 1=short, 2=medium, 3=long + ssb_PositionsInBurst_PR = 2; + ssb_PositionsInBurst_Bitmap = 1; + +# ssb_periodicityServingCell +# 0 = ms5, 1=ms10, 2=ms20, 3=ms40, 4=ms80, 5=ms160, 6=spare2, 7=spare1 + ssb_periodicityServingCell = 2; + +# dmrs_TypeA_position +# 0 = pos2, 1 = pos3 + dmrs_TypeA_Position = 0; + +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + subcarrierSpacing = 1; + + + #tdd-UL-DL-ConfigurationCommon +# subcarrierSpacing +# 0=kHz15, 1=kHz30, 2=kHz60, 3=kHz120 + referenceSubcarrierSpacing = 1; + # pattern1 + # dl_UL_TransmissionPeriodicity + # 0=ms0p5, 1=ms0p625, 2=ms1, 3=ms1p25, 4=ms2, 5=ms2p5, 6=ms5, 7=ms10 + dl_UL_TransmissionPeriodicity = 6; + nrofDownlinkSlots = 7; + nrofDownlinkSymbols = 6; + nrofUplinkSlots = 2; + nrofUplinkSymbols = 4; + + ssPBCH_BlockPower = -25; + } + + ); + + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// AMF parameters: + amf_ip_address = ( { ipv4 = "192.168.61.195"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + + NETWORK_INTERFACES : + { + GNB_INTERFACE_NAME_FOR_NG_AMF = "ctrl0"; + GNB_IPV4_ADDRESS_FOR_NG_AMF = "172.16.0.1"; + GNB_INTERFACE_NAME_FOR_NGU = "ctrl0"; + GNB_IPV4_ADDRESS_FOR_NGU = "172.16.0.1"; + GNB_PORT_FOR_NGU = 2152; # Spec 2152 + }; + + } +); + +MACRLCs = ( + { + num_cc = 1; + local_s_if_name = "lo:"; + remote_s_address = "127.0.0.1"; // pnf addr [!] + local_s_address = "127.0.0.2"; // vnf addr + local_s_portc = 50601; // vnf p5 port + remote_s_portc = 50600; // pnf p5 port [!] + local_s_portd = 50611; // vnf p7 port [!] + remote_s_portd = 50610; // pnf p7 port [!] + tr_s_preference = "nfapi"; + tr_n_preference = "local_RRC"; + } +); + +L1s = ( + { + num_cc = 1; + tr_n_preference = "local_mac"; + pusch_proc_threads = 8; + prach_dtx_threshold = 120; + pucch0_dtx_threshold = 150; + } +); + +RUs = ( + { + local_rf = "yes" + nb_tx = 1 + nb_rx = 1 + att_tx = 0 + att_rx = 0; + bands = [78]; + max_pdschReferenceSignalPower = -27; + max_rxgain = 75; + eNB_instances = [0]; + #beamforming 1x4 matrix: + bf_weights = [0x00007fff, 0x0000, 0x0000, 0x0000]; + #clock_src = "external"; + sdr_addrs = "mgmt_addr=192.168.18.240,addr=192.168.10.2,second_addr=192.168.20.2,clock_source=internal,time_source=internal" + } +); + +THREAD_STRUCT = ( + { + #three config for level of parallelism "PARALLEL_SINGLE_THREAD", "PARALLEL_RU_L1_SPLIT", or "PARALLEL_RU_L1_TRX_SPLIT" + parallel_config = "PARALLEL_SINGLE_THREAD"; + #two option for worker "WORKER_DISABLE" or "WORKER_ENABLE" + worker_config = "WORKER_ENABLE"; + } +); + +rfsimulator : +{ + serveraddr = "server"; + serverport = "4043"; + options = (); #("saviq"); or/and "chanmod" + modelname = "AWGN"; + IQfile = "/tmp/rfsimulator.iqs"; +}; + +security = { + # preferred ciphering algorithms + # the first one of the list that an UE supports in chosen + # valid values: nea0, nea1, nea2, nea3 + ciphering_algorithms = ( "nea0" ); + + # preferred integrity algorithms + # the first one of the list that an UE supports in chosen + # valid values: nia0, nia1, nia2, nia3 + integrity_algorithms = ( "nia2", "nia0" ); + + # setting 'drb_ciphering' to "no" disables ciphering for DRBs, no matter + # what 'ciphering_algorithms' configures; same thing for 'drb_integrity' + drb_ciphering = "yes"; + drb_integrity = "no"; +}; + + log_config : + { + global_log_level ="info"; + global_log_verbosity ="medium"; + hw_log_level ="info"; + hw_log_verbosity ="medium"; + phy_log_level ="info"; + phy_log_verbosity ="medium"; + mac_log_level ="info"; + mac_log_verbosity ="high"; + rlc_log_level ="info"; + rlc_log_verbosity ="medium"; + pdcp_log_level ="info"; + pdcp_log_verbosity ="medium"; + rrc_log_level ="info"; + rrc_log_verbosity ="medium"; + ngap_log_level ="debug"; + ngap_log_verbosity ="medium"; + }; + diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index 3d2b904e3c..a63b5efc30 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -708,7 +708,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, mac->scc_SIB->tdd_UL_DL_ConfigurationCommon, ul_info.slot_tx, mac->frame_type)) - nr_ue_ul_indication(&ul_info); + nr_ue_ul_indication(&ul_info); } }