From 42709fce5a121851a3fbb723c4cd504da4343d70 Mon Sep 17 00:00:00 2001 From: Andrew Burger <aburger@episci.com> Date: Mon, 13 Jul 2020 10:37:37 -0700 Subject: [PATCH] Fixing subframe issue in UE UL --- .../conf_files/rcc.band7.tm1.nfapi.conf | 6 +-- openair2/PHY_INTERFACE/phy_stub_UE.c | 13 +++-- targets/RT/USER/lte-ue.c | 48 +++++++++---------- 3 files changed, 34 insertions(+), 33 deletions(-) diff --git a/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf index 90da72dcc5..3df3faeb2f 100644 --- a/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf +++ b/ci-scripts/conf_files/rcc.band7.tm1.nfapi.conf @@ -226,18 +226,18 @@ THREAD_STRUCT = ( log_config = { - global_log_level ="info"; + global_log_level ="debug"; 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_level ="debug"; 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_level ="debug"; rrc_log_verbosity ="medium"; }; diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index e9559eb3c9..584618dac7 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -166,7 +166,8 @@ void fill_crc_indication_UE_MAC(int Mod_id, nfapi_ul_config_request_t *ul_config_req) { pthread_mutex_lock(&fill_ul_mutex.crc_mutex); - LOG_I(MAC, "Entered fill_crc_indication_UE_MAC\n"); + LOG_I(MAC, "Entered fill_crc_indication_UE_MAC Frame %d Subframe %d\n", + frame, subframe); nfapi_crc_indication_pdu_t *pdu = &UL_INFO->crc_ind.crc_indication_body @@ -698,8 +699,8 @@ int ul_config_req_UE_MAC(nfapi_ul_config_request_t *req, req->ul_config_request_body.rach_prach_frequency_resources, req->ul_config_request_body.srs_present); - int sfn = NFAPI_SFNSF2SFN(req->sfn_sf); - int sf = NFAPI_SFNSF2SF(req->sfn_sf); + int sfn = timer_frame; + int sf = timer_subframe; LOG_D(MAC, "ul_config_req_UE_MAC() TOTAL NUMBER OF UL_CONFIG PDUs: %d, SFN/SF: " @@ -1324,11 +1325,13 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len break; case NFAPI_CRC_INDICATION: encoded_size = nfapi_p7_message_pack(&UL->crc_ind, buffer, sizeof(buffer), NULL); - LOG_E(MAC, "CRC_IND sent to Proxy, Size: %d\n", encoded_size); + LOG_E(MAC, "CRC_IND sent to Proxy, Size: %d Frame %d Subframe %d\n", encoded_size, + NFAPI_SFNSF2SFN(UL->crc_ind.sfn_sf), NFAPI_SFNSF2SF(UL->crc_ind.sfn_sf)); break; case NFAPI_RX_ULSCH_INDICATION: // is this the right nfapi message_id? Ask Raymond encoded_size = nfapi_p7_message_pack(&UL->rx_ind, buffer, sizeof(buffer), NULL); - LOG_E(MAC, "RX_IND sent to Proxy, Size: %d\n", encoded_size); + LOG_E(MAC, "RX_IND sent to Proxy, Size: %d Frame %d Subframe %d\n", encoded_size, + NFAPI_SFNSF2SFN(UL->rx_ind.sfn_sf), NFAPI_SFNSF2SF(UL->rx_ind.sfn_sf)); break; case NFAPI_RX_CQI_INDICATION: // is this the right nfapi message_id? Ask Raymond encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL); diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 258bbe9a91..4995ae028d 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -1029,6 +1029,9 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0; proc->subframe_rx = proc->sub_frame_start; + proc->subframe_tx = -1; + proc->frame_rx = -1; + proc->frame_tx = -1; // Initializations for nfapi-L2-emulator mode sync_var = 0; @@ -1048,13 +1051,8 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) } last_sfn_sf = sfn_sf; - // FDD and TDD tx timing settings. - // XXX:It is the result of timing adjustment in debug. - proc->subframe_tx = NFAPI_SFNSF2SF(sfn_sf); - proc->frame_tx = NFAPI_SFNSF2SFN(sfn_sf); - - LOG_E(MAC, "received from proxy frame %d subframe %d\n", proc->frame_tx, - proc->subframe_tx); + LOG_E(MAC, "received from proxy frame %d subframe %d\n", NFAPI_SFNSF2SFN(sfn_sf), + NFAPI_SFNSF2SF(sfn_sf)); nfapi_dl_config_request_t *dl_config_req = get_queue(&dl_config_req_queue); nfapi_tx_request_pdu_t *tx_request_pdu_list = get_queue(&tx_req_pdu_queue); @@ -1148,22 +1146,22 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) #if UE_TIMING_TRACE start_meas(&UE->generic_stat); #endif - int rx_frame = proc->subframe_tx < 4 ? (proc->frame_tx + 1023) % 1024 : proc->frame_tx; // subtracting 4 from subframe_tx - int rx_subframe = proc->subframe_tx < 4 ? proc->subframe_tx + 6 : proc->subframe_tx - 4; + int rx_frame = NFAPI_SFNSF2SF(sfn_sf) < 4 ? (NFAPI_SFNSF2SFN(sfn_sf) + 1023) % 1024 : NFAPI_SFNSF2SFN(sfn_sf); // subtracting 4 from subframe_tx + int rx_subframe = NFAPI_SFNSF2SF(sfn_sf) < 4 ? NFAPI_SFNSF2SF(sfn_sf) + 6 : NFAPI_SFNSF2SF(sfn_sf) - 4; LOG_D(MAC, "rx_frame %d rx_subframe %d\n", rx_frame, rx_subframe); if (UE->mac_enabled == 1) { ret = ue_scheduler(ue_Mod_id, rx_frame, rx_subframe, - proc->frame_tx, - proc->subframe_tx, - subframe_select(&UE->frame_parms, proc->subframe_tx), + NFAPI_SFNSF2SFN(sfn_sf), + NFAPI_SFNSF2SF(sfn_sf), + subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)), 0, 0 /*FIXME CC_id*/); if (ret != CONNECTION_OK) { LOG_E(PHY, "[UE %" PRIu8 "] Frame %" PRIu32 ", subframe %u %s\n", - UE->Mod_id, proc->frame_rx, proc->subframe_tx, get_connectionloss_errstr(ret)); + UE->Mod_id, rx_frame, NFAPI_SFNSF2SF(sfn_sf), get_connectionloss_errstr(ret)); } } @@ -1172,29 +1170,29 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) #endif // Prepare the future Tx data - if ((subframe_select(&UE->frame_parms, proc->subframe_tx) == SF_UL) || + if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) || (UE->frame_parms.frame_type == FDD)) if (UE->mode != loop_through_memory) { // We make the start of RA between consecutive UEs differ by 20 frames - //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && proc->frame_rx >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { + //if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id == 0) || (UE_mac_inst[Mod_id].UE_mode[0] == PRACH && Mod_id>0 && rx_frame >= UE_mac_inst[Mod_id-1].ra_frame + 20) ) { if (UE_mac_inst[ue_Mod_id].UE_mode[0] == PRACH && ue_Mod_id == next_Mod_id) { next_ra_frame++; if (next_ra_frame > 500) { // check if we have PRACH opportunity - if (is_prach_subframe(&UE->frame_parms, proc->frame_tx, proc->subframe_tx) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { + if (is_prach_subframe(&UE->frame_parms, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)) && UE_mac_inst[ue_Mod_id].SI_Decoded == 1) { // The one working strangely... - //if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx && Mod_id == (module_id_t) init_ra_UE) ) { - PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx); + //if (is_prach_subframe(&UE->frame_parms,NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf) && Mod_id == (module_id_t) init_ra_UE) ) { + PRACH_RESOURCES_t *prach_resources = ue_get_rach(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0, NFAPI_SFNSF2SF(sfn_sf)); LOG_D(MAC, "Celtics prach_resources %p\n", prach_resources); if (prach_resources != NULL) { - UE_mac_inst[ue_Mod_id].ra_frame = proc->frame_rx; - LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, proc->frame_tx, proc->subframe_tx); - fill_rach_indication_UE_MAC(ue_Mod_id, proc->frame_tx, proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); + UE_mac_inst[ue_Mod_id].ra_frame = rx_frame; + LOG_D(MAC, "UE_phy_stub_thread_rxn_txnp4 before RACH, Mod_id: %d frame %d subframe %d\n", ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf)); + fill_rach_indication_UE_MAC(ue_Mod_id, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI); sent_any = true; - Msg1_transmitted(ue_Mod_id, 0, proc->frame_tx, 0); + Msg1_transmitted(ue_Mod_id, 0, NFAPI_SFNSF2SFN(sfn_sf), 0); UE_mac_inst[ue_Mod_id].UE_mode[0] = RA_RESPONSE; next_Mod_id = ue_Mod_id + 1; - //next_ra_frame = (proc->frame_rx + 20)%1000; + //next_ra_frame = (rx_frame + 20)%1000; next_ra_frame = 0; } @@ -1206,8 +1204,8 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) // Substitute call to phy_procedures Tx with call to phy_stub functions in order to trigger // UE Tx procedures directly at the MAC layer, based on the received ul_config requests from the vnf (eNB). // Generate UL_indications which correspond to UL traffic. - if (ul_config_req != NULL) { //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ - ul_config_req_UE_MAC(ul_config_req, timer_frame, timer_subframe, ue_Mod_id); // Andrew - send over socket to proxy here + if (ul_config_req != NULL) { // check to see if you get every 2 ms //&& UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ + ul_config_req_UE_MAC(ul_config_req, NFAPI_SFNSF2SFN(sfn_sf), NFAPI_SFNSF2SF(sfn_sf), ue_Mod_id); // Andrew - send over socket to proxy here } // Andrew - else send a dummy over the socket } -- 2.26.2