diff --git a/executables/nr-ue.c b/executables/nr-ue.c index dd5ce02045..e31f72eaea 100644 --- a/executables/nr-ue.c +++ b/executables/nr-ue.c @@ -31,8 +31,6 @@ #include "SCHED_NR_UE/defs.h" #include "PHY/NR_UE_TRANSPORT/nr_transport_proto_ue.h" #include "executables/softmodem-common.h" -#include "LAYER2/nr_pdcp/nr_pdcp_entity.h" -#include "openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h" #include "PHY/NR_REFSIG/refsig_defs_ue.h" #include "radio/COMMON/common_lib.h" @@ -103,8 +101,6 @@ typedef enum { si = 2 } sync_mode_t; -queue_t nr_rach_ind_queue; - static void *NRUE_phy_stub_standalone_pnf_task(void *arg); static size_t dump_L1_UE_meas_stats(PHY_VARS_NR_UE *ue, char *output, size_t max_len) @@ -192,47 +188,6 @@ void init_nrUE_standalone_thread(int ue_idx) pthread_setname_np(phy_thread, "oai:nrue-stand-phy"); } -static void L1_nsa_prach_procedures(frame_t frame, int slot, fapi_nr_ul_config_prach_pdu *prach_pdu) -{ - NR_UE_MAC_INST_t *mac = get_mac_inst(0); - nfapi_nr_rach_indication_t *rach_ind = CALLOC(1, sizeof(*rach_ind)); - rach_ind->sfn = frame; - rach_ind->slot = slot; - rach_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION; - - uint8_t pdu_index = 0; - rach_ind->pdu_list = CALLOC(1, sizeof(*rach_ind->pdu_list)); - rach_ind->number_of_pdus = 1; - rach_ind->pdu_list[pdu_index].phy_cell_id = prach_pdu->phys_cell_id; - rach_ind->pdu_list[pdu_index].symbol_index = prach_pdu->prach_start_symbol; - rach_ind->pdu_list[pdu_index].slot_index = prach_pdu->prach_slot; - rach_ind->pdu_list[pdu_index].freq_index = prach_pdu->num_ra; - rach_ind->pdu_list[pdu_index].avg_rssi = 128; - rach_ind->pdu_list[pdu_index].avg_snr = 0xff; // invalid for now - - 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)); - 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; - - if (!put_queue(&nr_rach_ind_queue, rach_ind)) - { - for (int pdu_index = 0; pdu_index < rach_ind->number_of_pdus; pdu_index++) - { - free(rach_ind->pdu_list[pdu_index].preamble_list); - } - free(rach_ind->pdu_list); - free(rach_ind); - } - LOG_D(NR_MAC, "We have successfully filled the rach_ind queue with the recently filled rach ind\n"); -} - static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot) { nfapi_nr_rach_indication_t *rach_ind = unqueue_matching(&nr_rach_ind_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &sfn_slot); @@ -244,14 +199,12 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot) NFAPI_SFNSLOT2SFN(mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot), NFAPI_SFNSLOT2SLOT(mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot), nr_ul_tti_req_queue.num_items); nfapi_nr_ul_tti_request_t *ul_tti_request_crc = unqueue_matching(&nr_ul_tti_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot); - if (ul_tti_request_crc && ul_tti_request_crc->n_pdus > 0) - { + if (ul_tti_request_crc && ul_tti_request_crc->n_pdus > 0) { check_and_process_dci(NULL, NULL, NULL, ul_tti_request_crc); } } - if (rach_ind && rach_ind->number_of_pdus > 0) - { + if (rach_ind && rach_ind->number_of_pdus > 0) { NR_UL_IND_t UL_INFO = { .rach_ind = *rach_ind, }; @@ -262,70 +215,32 @@ static void process_queued_nr_nfapi_msgs(NR_UE_MAC_INST_t *mac, int sfn_slot) } free_and_zero(rach_ind->pdu_list); free_and_zero(rach_ind); - nr_Msg1_transmitted(0); } - if (dl_tti_request) - { + if (dl_tti_request) { int dl_tti_sfn_slot = NFAPI_SFNSLOT2HEX(dl_tti_request->SFN, dl_tti_request->Slot); nfapi_nr_tx_data_request_t *tx_data_request = unqueue_matching(&nr_tx_req_queue, MAX_QUEUE_SIZE, sfn_slot_matcher, &dl_tti_sfn_slot); - if (!tx_data_request) - { + if (!tx_data_request) { 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)); if (get_softmodem_params()->nsa) save_nr_measurement_info(dl_tti_request); free_and_zero(dl_tti_request); } - else if (dl_tti_request->dl_tti_request_body.nPDUs > 0 && tx_data_request->Number_of_PDUs > 0) - { + else if (dl_tti_request->dl_tti_request_body.nPDUs > 0 && tx_data_request->Number_of_PDUs > 0) { 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 - { + else { AssertFatal(false, "We dont have PDUs in either dl_tti %d or tx_req %d\n", dl_tti_request->dl_tti_request_body.nPDUs, tx_data_request->Number_of_PDUs); } } - if (ul_dci_request && ul_dci_request->numPdus > 0) - { + if (ul_dci_request && ul_dci_request->numPdus > 0) { check_and_process_dci(NULL, NULL, ul_dci_request, NULL); } } -static void check_nr_prach(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) -{ - fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, ul_info->slot_tx); - if (!ul_config) - { - LOG_E(NR_MAC, "mac->ul_config is null! \n"); - return; - } - if (mac->ra.ra_state != RA_SUCCEEDED) - { - 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(ul_info->module_id, - ul_info->cc_id, - ul_info->frame_tx, - ul_info->gNB_index, - ul_info->slot_tx); - if (nr_prach == 1) { - 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_PUSCH; - } - else if (nr_prach == 2) { - LOG_I(NR_PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, ul_info->module_id); - } - else if(nr_prach == 3) { - LOG_I(NR_PHY, "In %s: [UE %d] RA failed, setting UE mode to PRACH\n", __FUNCTION__, ul_info->module_id); - } - } -} - static void *NRUE_phy_stub_standalone_pnf_task(void *arg) { LOG_I(MAC, "Clearing Queues\n"); @@ -350,17 +265,14 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) mac->nr_ue_emul_l1.harq[i].active_ul_harq_sfn_slot = -1; } - while (!oai_exit) - { - if (sem_wait(&sfn_slot_semaphore) != 0) - { + while (!oai_exit) { + if (sem_wait(&sfn_slot_semaphore) != 0) { LOG_E(NR_MAC, "sem_wait() error\n"); abort(); } uint16_t *slot_ind = get_queue(&nr_sfn_slot_queue); nr_phy_channel_params_t *ch_info = get_queue(&nr_chan_param_queue); - if (!slot_ind && !ch_info) - { + if (!slot_ind && !ch_info) { LOG_D(MAC, "get nr_sfn_slot_queue and nr_chan_param_queue == NULL!\n"); continue; } @@ -375,8 +287,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) frame_t frame = NFAPI_SFNSLOT2SFN(sfn_slot); int slot = NFAPI_SFNSLOT2SLOT(sfn_slot); - if (sfn_slot == last_sfn_slot) - { + if (sfn_slot == last_sfn_slot) { LOG_D(NR_MAC, "repeated sfn_sf = %d.%d\n", frame, slot); continue; @@ -386,14 +297,12 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) LOG_D(NR_MAC, "The received sfn/slot [%d %d] from proxy\n", frame, slot); - if (get_softmodem_params()->sa && mac->mib == NULL) - { + if (get_softmodem_params()->sa && mac->mib == NULL) { 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; } @@ -410,7 +319,6 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ul_info.slot_rx = slot; 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_PUSCH; if (pthread_mutex_lock(&mac->mutex_dl_info)) abort(); @@ -432,8 +340,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) 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)) - { + ul_info.slot_rx)) { nr_ue_dl_indication(&mac->dl_info, &ul_time_alignment); } @@ -442,13 +349,11 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) 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)) - { + ul_info.slot_tx, mac->frame_type)) { LOG_D(NR_MAC, "Slot %d. calling nr_ue_ul_ind() and nr_ue_pucch_scheduler() from %s\n", ul_info.slot_tx, __FUNCTION__); nr_ue_scheduler(NULL, &ul_info); nr_ue_prach_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx); nr_ue_pucch_scheduler(mod_id, ul_info.frame_tx, ul_info.slot_tx, NULL); - check_nr_prach(mac, &ul_info); } if (!IS_SOFTMODEM_NOS1 && get_softmodem_params()->sa) { NR_UE_MAC_INST_t *mac = get_mac_inst(0); @@ -673,7 +578,6 @@ void processSlotTX(void *arg) { ul_indication.slot_rx = proc->nr_slot_rx; ul_indication.frame_tx = proc->frame_tx; ul_indication.slot_tx = proc->nr_slot_tx; - ul_indication.ue_sched_mode = rxtxD->ue_sched_mode; ul_indication.phy_data = &phy_data; UE->if_inst->ul_indication(&ul_indication); diff --git a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c index 59051d07b8..e5e0e44b6b 100644 --- a/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c +++ b/openair1/PHY/NR_UE_TRANSPORT/nr_prach.c @@ -515,7 +515,6 @@ int32_t generate_nr_prach(PHY_VARS_NR_UE *ue, uint8_t gNB_id, int frame, uint8_t LOG_M("Prach_txsig.m","txs",(int16_t*)(&ue->common_vars.txdata[0][prach_start]), 2*(prach_start+prach_len), 1, 1) #endif - ue->prach_vars[gNB_id]->active = false; return signal_energy((int*)prach, 256); } diff --git a/openair1/PHY/defs_nr_UE.h b/openair1/PHY/defs_nr_UE.h index 7989c0e7a5..0c67ac017e 100644 --- a/openair1/PHY/defs_nr_UE.h +++ b/openair1/PHY/defs_nr_UE.h @@ -764,7 +764,6 @@ typedef struct nr_phy_data_s { typedef struct nr_rxtx_thread_data_s { UE_nr_rxtx_proc_t proc; PHY_VARS_NR_UE *UE; - NR_UE_SCHED_MODE_t ue_sched_mode; int writeBlockSize; } nr_rxtx_thread_data_t; diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index 2ab1040cdb..e7fc09e4a2 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -49,6 +49,7 @@ const char *ul_pdu_type[]={"PRACH", "PUCCH", "PUSCH", "SRS"}; queue_t nr_rx_ind_queue; queue_t nr_crc_ind_queue; queue_t nr_uci_ind_queue; +queue_t nr_rach_ind_queue; static void fill_uci_2_3_4(nfapi_nr_uci_pucch_pdu_format_2_3_4_t *pdu_2_3_4, fapi_nr_ul_config_pucch_pdu *pucch_pdu) @@ -108,29 +109,56 @@ static void free_uci_inds(nfapi_nr_uci_indication_t *uci_ind) } int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response) { + NR_UE_MAC_INST_t *mac = get_mac_inst(0); - if(scheduled_response != NULL) - { - if (scheduled_response->ul_config != NULL) - { + + if(scheduled_response != NULL) { + if (scheduled_response->ul_config != NULL) { fapi_nr_ul_config_request_t *ul_config = scheduled_response->ul_config; AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]), "Too many ul_config pdus %d", ul_config->number_pdus); - for (int i = 0; i < ul_config->number_pdus; ++i) - { + for (int i = 0; i < ul_config->number_pdus; ++i) { LOG_D(NR_PHY, "In %s: processing type %d PDU of %d total UL PDUs (ul_config %p) \n", __FUNCTION__, ul_config->ul_config_list[i].pdu_type, ul_config->number_pdus, ul_config); uint8_t pdu_type = ul_config->ul_config_list[i].pdu_type; - switch (pdu_type) - { - case (FAPI_NR_UL_CONFIG_TYPE_PUSCH): - { + switch (pdu_type) { + case FAPI_NR_UL_CONFIG_TYPE_PRACH: { + fapi_nr_ul_config_prach_pdu *prach_pdu = &ul_config->ul_config_list[i].prach_config_pdu; + nfapi_nr_rach_indication_t *rach_ind = CALLOC(1, sizeof(*rach_ind)); + rach_ind->sfn = scheduled_response->frame; + rach_ind->slot = scheduled_response->slot; + rach_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_RACH_INDICATION; + uint8_t pdu_index = 0; + rach_ind->pdu_list = CALLOC(1, sizeof(*rach_ind->pdu_list)); + rach_ind->number_of_pdus = 1; + rach_ind->pdu_list[pdu_index].phy_cell_id = prach_pdu->phys_cell_id; + rach_ind->pdu_list[pdu_index].symbol_index = prach_pdu->prach_start_symbol; + rach_ind->pdu_list[pdu_index].slot_index = prach_pdu->prach_slot; + rach_ind->pdu_list[pdu_index].freq_index = prach_pdu->num_ra; + rach_ind->pdu_list[pdu_index].avg_rssi = 128; + rach_ind->pdu_list[pdu_index].avg_snr = 0xff; // invalid for now + 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 = prach_pdu->ra_PreambleIndex; + rach_ind->pdu_list[pdu_index].preamble_list[0].timing_advance = 0; + rach_ind->pdu_list[pdu_index].preamble_list[0].preamble_pwr = 0xffffffff; + + if (!put_queue(&nr_rach_ind_queue, rach_ind)) { + for (int pdu_index = 0; pdu_index < rach_ind->number_of_pdus; pdu_index++) + free(rach_ind->pdu_list[pdu_index].preamble_list); + free(rach_ind->pdu_list); + free(rach_ind); + } + LOG_D(NR_MAC, "We have successfully filled the rach_ind queue with the recently filled rach ind\n"); + break; + } + case (FAPI_NR_UL_CONFIG_TYPE_PUSCH): { nfapi_nr_rx_data_indication_t *rx_ind = CALLOC(1, sizeof(*rx_ind)); nfapi_nr_crc_indication_t *crc_ind = CALLOC(1, sizeof(*crc_ind)); nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[i].pusch_config_pdu; - if (scheduled_response->tx_request) - { + if (scheduled_response->tx_request) { AssertFatal(scheduled_response->tx_request->number_of_pdus < sizeof(scheduled_response->tx_request->tx_request_body) / sizeof(scheduled_response->tx_request->tx_request_body[0]), "Too many tx_req pdus %d", scheduled_response->tx_request->number_of_pdus); @@ -139,8 +167,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response rx_ind->slot = scheduled_response->ul_config->slot; rx_ind->number_of_pdus = scheduled_response->tx_request->number_of_pdus; rx_ind->pdu_list = CALLOC(rx_ind->number_of_pdus, sizeof(*rx_ind->pdu_list)); - for (int j = 0; j < rx_ind->number_of_pdus; j++) - { + for (int j = 0; j < rx_ind->number_of_pdus; j++) { fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[j]; rx_ind->pdu_list[j].handle = pusch_config_pdu->handle; rx_ind->pdu_list[j].harq_id = pusch_config_pdu->pusch_data.harq_process_id; @@ -160,8 +187,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response crc_ind->sfn = scheduled_response->ul_config->sfn; crc_ind->slot = scheduled_response->ul_config->slot; crc_ind->crc_list = CALLOC(crc_ind->number_crcs, sizeof(*crc_ind->crc_list)); - for (int j = 0; j < crc_ind->number_crcs; j++) - { + for (int j = 0; j < crc_ind->number_crcs; j++) { crc_ind->crc_list[j].handle = pusch_config_pdu->handle; crc_ind->crc_list[j].harq_id = pusch_config_pdu->pusch_data.harq_process_id; LOG_D(NR_MAC, "This is the harq pid %d for crc_list[%d]\n", crc_ind->crc_list[j].harq_id, j); @@ -179,11 +205,9 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response scheduled_response->frame, scheduled_response->slot, crc_ind->sfn, crc_ind->slot,pusch_config_pdu->mcs_index); } - if (!put_queue(&nr_rx_ind_queue, rx_ind)) - { + if (!put_queue(&nr_rx_ind_queue, rx_ind)) { LOG_E(NR_MAC, "Put_queue failed for rx_ind\n"); - for (int i = 0; i < rx_ind->number_of_pdus; i++) - { + for (int i = 0; i < rx_ind->number_of_pdus; i++) { free(rx_ind->pdu_list[i].pdu); rx_ind->pdu_list[i].pdu = NULL; } @@ -193,8 +217,7 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response free(rx_ind); rx_ind = NULL; } - if (!put_queue(&nr_crc_ind_queue, crc_ind)) - { + if (!put_queue(&nr_crc_ind_queue, crc_ind)) { LOG_E(NR_MAC, "Put_queue failed for crc_ind\n"); free(crc_ind->crc_list); crc_ind->crc_list = NULL; @@ -203,32 +226,26 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response } LOG_D(PHY, "In %s: Filled queue rx/crc_ind which was filled by ulconfig. \n", __FUNCTION__); - scheduled_response->tx_request->number_of_pdus = 0; } break; } - - case FAPI_NR_UL_CONFIG_TYPE_PUCCH: - { + case FAPI_NR_UL_CONFIG_TYPE_PUCCH: { nfapi_nr_uci_indication_t *uci_ind = CALLOC(1, sizeof(*uci_ind)); uci_ind->header.message_id = NFAPI_NR_PHY_MSG_TYPE_UCI_INDICATION; uci_ind->sfn = scheduled_response->frame; uci_ind->slot = scheduled_response->slot; uci_ind->num_ucis = 1; uci_ind->uci_list = CALLOC(uci_ind->num_ucis, sizeof(*uci_ind->uci_list)); - for (int j = 0; j < uci_ind->num_ucis; j++) - { + for (int j = 0; j < uci_ind->num_ucis; j++) { LOG_D(NR_MAC, "ul_config->ul_config_list[%d].pucch_config_pdu.n_bit = %d\n", i, ul_config->ul_config_list[i].pucch_config_pdu.n_bit); - if (ul_config->ul_config_list[i].pucch_config_pdu.n_bit > 3 && mac->nr_ue_emul_l1.num_csi_reports > 0) - { + if (ul_config->ul_config_list[i].pucch_config_pdu.n_bit > 3 && mac->nr_ue_emul_l1.num_csi_reports > 0) { uci_ind->uci_list[j].pdu_type = NFAPI_NR_UCI_FORMAT_2_3_4_PDU_TYPE; uci_ind->uci_list[j].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_2_3_4_t); nfapi_nr_uci_pucch_pdu_format_2_3_4_t *pdu_2_3_4 = &uci_ind->uci_list[j].pucch_pdu_format_2_3_4; fill_uci_2_3_4(pdu_2_3_4, &ul_config->ul_config_list[i].pucch_config_pdu); } - else - { + else { nfapi_nr_uci_pucch_pdu_format_0_1_t *pdu_0_1 = &uci_ind->uci_list[j].pucch_pdu_format_0_1; uci_ind->uci_list[j].pdu_type = NFAPI_NR_UCI_FORMAT_0_1_PDU_TYPE; uci_ind->uci_list[j].pdu_size = sizeof(nfapi_nr_uci_pucch_pdu_format_0_1_t); @@ -248,12 +265,10 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response pdu_0_1->harq->harq_confidence_level = 0; pdu_0_1->harq->harq_list = CALLOC(pdu_0_1->harq->num_harq, sizeof(*pdu_0_1->harq->harq_list)); int harq_pid = -1; - for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++) - { + for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++) { if (mac->nr_ue_emul_l1.harq[k].active && mac->nr_ue_emul_l1.harq[k].active_dl_harq_sfn == uci_ind->sfn && - mac->nr_ue_emul_l1.harq[k].active_dl_harq_slot == uci_ind->slot) - { + mac->nr_ue_emul_l1.harq[k].active_dl_harq_slot == uci_ind->slot) { mac->nr_ue_emul_l1.harq[k].active = false; harq_pid = k; AssertFatal(harq_index < pdu_0_1->harq->num_harq, "Invalid harq_index %d\n", harq_index); diff --git a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c index 8ebbc92179..4888892a82 100644 --- a/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c +++ b/openair1/SCHED_NR_UE/phy_procedures_nr_ue.c @@ -1323,6 +1323,8 @@ void nr_ue_prach_procedures(PHY_VARS_NR_UE *ue, UE_nr_rxtx_proc_t *proc, uint8_t ue->tx_power_dBm[nr_slot_tx], dB_fixed(prach_power), ue->prach_vars[gNB_id]->amp); + + ue->prach_vars[gNB_id]->active = false; } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX_PRACH, VCD_FUNCTION_OUT); diff --git a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h index 507d4469a5..90a09544f0 100644 --- a/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h +++ b/openair2/LAYER2/NR_MAC_COMMON/nr_mac_common.h @@ -32,10 +32,8 @@ #define __LAYER2_NR_MAC_COMMON_H__ #include "NR_MIB.h" -#include "NR_PDSCH-Config.h" #include "NR_CellGroupConfig.h" #include "nr_mac.h" -#include "openair1/PHY/impl_defs_nr.h" #include "common/utils/nr/nr_common.h" typedef enum { diff --git a/openair2/LAYER2/NR_MAC_UE/mac_defs.h b/openair2/LAYER2/NR_MAC_UE/mac_defs.h index 5cc47f2241..69beaec25e 100644 --- a/openair2/LAYER2/NR_MAC_UE/mac_defs.h +++ b/openair2/LAYER2/NR_MAC_UE/mac_defs.h @@ -280,8 +280,6 @@ typedef struct { uint8_t RA_active; /// Random-access preamble index int ra_PreambleIndex; - /// Flag for the Msg1 generation: enabled at every occurrence of nr prach slot - RA_state_t generate_nr_prach; // When multiple SSBs per RO is configured, this indicates which one is selected in this RO -> this is used to properly compute the PRACH preamble uint8_t ssb_nb_in_ro; diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c index 68b0818672..8b71713eb6 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c @@ -31,7 +31,6 @@ */ /* RRC */ -#include "NR_RACH-ConfigCommon.h" #include "RRC/NR_UE/rrc_proto.h" /* MAC */ diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 4cf87ebcbd..8bda319799 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -39,10 +39,6 @@ /* RRC*/ #include "RRC/NR_UE/rrc_proto.h" -#include "NR_RACH-ConfigCommon.h" -#include "NR_RACH-ConfigGeneric.h" -#include "NR_FrequencyInfoDL.h" -#include "NR_PDCCH-ConfigCommon.h" /* MAC */ #include "NR_MAC_COMMON/nr_mac.h" diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c index 1bb36e8228..902bb2aec8 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c @@ -35,13 +35,6 @@ /* exe */ #include -/* RRC*/ -#include "RRC/NR_UE/rrc_proto.h" -#include "NR_RACH-ConfigCommon.h" -#include "NR_RACH-ConfigGeneric.h" -#include "NR_FrequencyInfoDL.h" -#include "NR_PDCCH-ConfigCommon.h" - /* MAC */ #include "NR_MAC_COMMON/nr_mac.h" #include "NR_MAC_COMMON/nr_mac_common.h" diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index d93a4ada98..b9df6b4e7b 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -692,8 +692,7 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, if (pthread_mutex_lock(&mac->mutex_dl_info)) abort(); - if (dl_tti_request) - { + if (dl_tti_request) { frame = dl_tti_request->SFN; slot = dl_tti_request->Slot; LOG_D(NR_PHY, "[%d, %d] dl_tti_request\n", frame, slot); @@ -705,40 +704,34 @@ 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) - { + if (tx_data_request) { if (mac->nr_ue_emul_l1.expected_sib || mac->nr_ue_emul_l1.expected_rar || - mac->nr_ue_emul_l1.expected_dci) - { + mac->nr_ue_emul_l1.expected_dci) { frame = tx_data_request->SFN; slot = tx_data_request->Slot; LOG_D(NR_PHY, "[%d, %d] PDSCH in tx_request\n", frame, slot); copy_tx_data_req_to_dl_info(&mac->dl_info, tx_data_request); } - else - { + else { LOG_D(NR_MAC, "Unexpected tx_data_req\n"); } free_and_zero(tx_data_request); } - else if (ul_dci_request) - { + else if (ul_dci_request) { frame = ul_dci_request->SFN; slot = ul_dci_request->Slot; LOG_D(NR_PHY, "[%d, %d] ul_dci_request\n", frame, slot); copy_ul_dci_data_req_to_dl_info(&mac->dl_info, ul_dci_request); free_and_zero(ul_dci_request); } - else if (ul_tti_request) - { + else if (ul_tti_request) { frame = ul_tti_request->SFN; slot = ul_tti_request->Slot; LOG_T(NR_PHY, "[%d, %d] ul_tti_request\n", frame, slot); copy_ul_tti_data_req_to_dl_info(&mac->dl_info, ul_tti_request); } - else - { + else { if (pthread_mutex_unlock(&mac->mutex_dl_info)) abort(); LOG_T(NR_MAC, "All indications were NULL in %s\n", __FUNCTION__); return; @@ -762,15 +755,12 @@ void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, ul_info.slot_rx = slot; 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_PUSCH; - if (mac->scc || mac->scc_SIB) - { + 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) && mac->ra.ra_state != RA_SUCCEEDED) - { + mac->frame_type) && mac->ra.ra_state != RA_SUCCEEDED) { nr_ue_scheduler(NULL, &ul_info); nr_ue_prach_scheduler(ul_info.module_id, ul_info.frame_tx, ul_info.slot_tx); } @@ -1137,8 +1127,8 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_TDD_UL_DL_ConfigCommon_t *tdd_UL_DL_ConfigurationCommon = mac->scc != NULL ? mac->scc->tdd_UL_DL_ConfigurationCommon : mac->scc_SIB->tdd_UL_DL_ConfigurationCommon; - LOG_T(NR_MAC, "In %s():%d not calling scheduler. sched mode = %d and mac->ra.ra_state = %d\n", - __FUNCTION__, __LINE__, ul_info->ue_sched_mode, mac->ra.ra_state); + LOG_T(NR_MAC, "In %s():%d not calling scheduler mac->ra.ra_state = %d\n", + __FUNCTION__, __LINE__, mac->ra.ra_state); ret = nr_ue_scheduler(NULL, ul_info); if (is_nr_UL_slot(tdd_UL_DL_ConfigurationCommon, ul_info->slot_tx, mac->frame_type) && !get_softmodem_params()->phy_test) { diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h index 722b1be9ec..e3adfe7d53 100755 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h @@ -46,11 +46,6 @@ extern slot_rnti_mcs_s slot_rnti_mcs[NUM_NFAPI_SLOT]; typedef struct NR_UL_TIME_ALIGNMENT NR_UL_TIME_ALIGNMENT_t; -typedef enum { - SCHED_PUSCH, - SCHED_PUCCH, -} NR_UE_SCHED_MODE_t; - typedef struct { /// module id module_id_t module_id; @@ -112,7 +107,6 @@ typedef struct { /// dci reception indication structure fapi_nr_dci_indication_t *dci_ind; - NR_UE_SCHED_MODE_t ue_sched_mode; void *phy_data; } nr_uplink_indication_t;