diff --git a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c index ea73f2fecc..c3ccfcc829 100644 --- a/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c +++ b/openair1/SCHED_NR_UE/fapi_nr_ue_l1.c @@ -120,6 +120,7 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ } } } + dl_config->number_pdus = 0; } else { pdcch_vars->nb_search_space = 0; } @@ -232,11 +233,9 @@ int8_t nr_ue_scheduled_response(nr_scheduled_response_t *scheduled_response){ break; } } - } else { + ul_config->number_pdus = 0; } - } - return 0; } diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c index 2285fc5999..a262f5b54c 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_dci_configuration.c @@ -177,7 +177,7 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t #endif // add DCI dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DCI; - dl_config->number_pdus = dl_config->number_pdus + 1; + dl_config->number_pdus += 1; } void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl_config, frame_t frame, int slot) { diff --git a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c index 0205b4e3f1..a70b74b5c7 100644 --- a/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c +++ b/openair2/LAYER2/NR_MAC_UE/nr_ue_procedures.c @@ -728,9 +728,9 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in dcireq.cc_id = cc_id; dcireq.frame = rx_frame; dcireq.slot = rx_slot; + dcireq.dl_config_req.number_pdus = 0; nr_ue_dcireq(&dcireq); //to be replaced with function pointer later - // we should have received a DL DCI here, so configure DL accordingly scheduled_response.dl_config = &dcireq.dl_config_req; scheduled_response.ul_config = NULL; scheduled_response.tx_request = NULL; @@ -939,12 +939,13 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in nr_scheduled_response_t scheduled_response; scheduled_response.ul_config = &mac->ul_config_request; scheduled_response.dl_config = NULL; - scheduled_response.ul_config->number_pdus++; //TBR fix - fapi_nr_ul_config_request_pdu_t *ul_config_list = &scheduled_response.ul_config->ul_config_list[scheduled_response.ul_config->number_pdus - 1]; + scheduled_response.ul_config->number_pdus++; + uint8_t pdu_index = scheduled_response.ul_config->number_pdus - 1; + fapi_nr_ul_config_request_pdu_t *ul_config_list = &scheduled_response.ul_config->ul_config_list[pdu_index]; fapi_nr_tx_request_t tx_req; fapi_nr_tx_request_body_t tx_req_body; - uint16_t TBS_bytes = scheduled_response.ul_config->ul_config_list[scheduled_response.ul_config->number_pdus - 1].pusch_config_pdu.pusch_data.tb_size; + uint16_t TBS_bytes = scheduled_response.ul_config->ul_config_list[pdu_index].pusch_config_pdu.pusch_data.tb_size; //if (IS_SOFTMODEM_NOS1){ // // Getting IP traffic to be transmitted @@ -962,7 +963,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in //if (!IS_SOFTMODEM_NOS1 || !data_existing) { //Use zeros for the header bytes in noS1 mode, in order to make sure that the LCID is not valid //and block this traffic from being forwarded to the upper layers at the gNB - printf("[DEBUG_MSG3] Random data to be tranmsitted (TBS_bytes %d, pdu_index %d ul_config (%p) list (%p): \n", TBS_bytes, scheduled_response.ul_config->number_pdus - 1, scheduled_response.ul_config, ul_config_list); + printf("[DEBUG_MSG3] Random data to be tranmsitted (TBS_bytes %d, pdu_index %d ul_config (%p) list (%p): \n", TBS_bytes, pdu_index, scheduled_response.ul_config, ul_config_list); //Give the first byte a dummy value (a value not corresponding to any valid LCID based on 38.321, Table 6.2.1-2) //in order to distinguish the PHY random packets at the MAC layer of the gNB receiver from the normal packets that should //have a valid LCID (nr_process_mac_pdu function) @@ -984,7 +985,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in tx_req.sfn = ul_info->frame_tx; tx_req.number_of_pdus = 1; tx_req_body.pdu_length = TBS_bytes; - tx_req_body.pdu_index = 0; + tx_req_body.pdu_index = pdu_index; tx_req_body.pdu = ulsch_input_buffer; ul_config_list->pdu_type = FAPI_NR_UL_CONFIG_TYPE_PUSCH; scheduled_response.tx_request = &tx_req; @@ -1195,6 +1196,8 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s mac->generate_nr_prach = 2; } mac->scheduled_response.ul_config = ul_config; + if (mac->ul_config_request.number_pdus > 0) + mac->if_module->scheduled_response(&mac->scheduled_response); } } diff --git a/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c b/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c index d291e74e45..a4633d314c 100644 --- a/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c +++ b/openair2/LAYER2/NR_MAC_UE/rar_tools_nrUE.c @@ -76,14 +76,13 @@ void nr_config_Msg3_pdu(NR_UE_MAC_INST_t *mac, int f_alloc, mask, StartSymbolIndex, NrOfSymbols; uint16_t TBS_bytes; fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request; - ul_config->number_pdus++; - nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus - 1].pusch_config_pdu; + nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu; NR_ServingCellConfigCommon_t *scc = mac->scc; NR_BWP_Uplink_t *ubwp = mac->ULbwp[0]; int startSymbolAndLength = ubwp->bwp_Common->pusch_ConfigCommon->choice.setup->pusch_TimeDomainAllocationList->list.array[Msg3_t_alloc]->startSymbolAndLength; #ifdef DEBUG_MSG3 - printf("[DEBUG_MSG3] Configuring Msg3 PDU of %d UL pdus \n", ul_config->number_pdus); + printf("[DEBUG_MSG3] Configuring 1 Msg3 PDU of %d UL pdus \n", ul_config->number_pdus); #endif // active BWP start diff --git a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c index bfcfe88d62..def7325fa7 100644 --- a/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c +++ b/openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.c @@ -107,17 +107,13 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ module_id_t module_id = ul_info->module_id; NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); - // clean previous FAPI messages - mac->tx_request.number_of_pdus = 0; - mac->ul_config_request.number_pdus = 0; - mac->dl_config_request.number_pdus = 0; - // clean previous FAPI messages - ret = nr_ue_scheduler(NULL, ul_info); - if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra){ + // clean previous FAPI messages + mac->tx_request.number_of_pdus = 0; + + if (is_nr_UL_slot(mac->scc, ul_info->slot_tx) && get_softmodem_params()->do_ra) nr_ue_prach_scheduler(module_id, ul_info->frame_tx, ul_info->slot_tx); - } switch(ret){ case UE_CONNECTION_OK: @@ -132,8 +128,6 @@ int nr_ue_ul_indication(nr_uplink_indication_t *ul_info){ break; } - mac->if_module->scheduled_response(&mac->scheduled_response); - return 0; } @@ -146,13 +140,13 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request; fapi_nr_ul_config_request_t *ul_config = &mac->ul_config_request; + LOG_D(PHY,"DEBUG dl_config %d DL pdus\n",dl_config->number_pdus); + if (!dl_info->dci_ind && !dl_info->rx_ind) { // UL indication to schedule DCI reception nr_ue_scheduler(dl_info, NULL); } else { // UL indication after reception of DCI or DL PDU - dl_config->number_pdus = 0; - ul_config->number_pdus = 0; //hook up pointers mac->scheduled_response.dl_config = dl_config; mac->scheduled_response.ul_config = ul_config; @@ -269,12 +263,10 @@ int nr_ue_if_module_kill(uint32_t module_id) { int nr_ue_dcireq(nr_dcireq_t *dcireq) { - fapi_nr_dl_config_request_t *dl_config=&dcireq->dl_config_req; + fapi_nr_dl_config_request_t *dl_config = &dcireq->dl_config_req; NR_UE_MAC_INST_t *UE_mac = get_mac_inst(0); - - dl_config->sfn=UE_mac->dl_config_request.sfn; - dl_config->slot=UE_mac->dl_config_request.slot; - dl_config->number_pdus=0; + dl_config->sfn = UE_mac->dl_config_request.sfn; + dl_config->slot = UE_mac->dl_config_request.slot; LOG_D(PHY, "Entering UE DCI configuration frame %d slot %d \n", dcireq->frame, dcireq->slot);