From 7b6a9c445e2552b13b8ec8f687405c2b33822c83 Mon Sep 17 00:00:00 2001 From: matzakos <panagiotis.matzakos@eurecom.fr> Date: Wed, 13 Dec 2017 23:58:15 +0100 Subject: [PATCH] Testing works up to the reception of SIB1/2/3 from the UE through nfapi, but there is an issue with missing some of the nfapi messages for some frames. --- cmake_targets/CMakeLists.txt | 2 +- cmake_targets/build_oai | 7 +- nfapi/nfapi_pnf.c | 6 +- openair1/PHY/defs.h | 2 + openair2/ENB_APP/enb_config.c | 24 ++-- openair2/PHY_INTERFACE/phy_stub_UE.c | 105 ++++++++++++++++-- openair2/RRC/LITE/rrc_UE.c | 20 +++- .../CONF/oaiL1.nfapi.usrpb210.conf | 22 +++- targets/RT/USER/lte-softmodem-stub.c | 22 ++-- targets/RT/USER/lte-ue.c | 58 ++++++++-- 10 files changed, 210 insertions(+), 58 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index b17355de00..0933c8fb36 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1946,7 +1946,7 @@ add_executable(lte-softmodem-stub ${OPENAIR_TARGETS}/COMMON/create_tasks.c ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c - ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c + #${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c ${OPENAIR_DIR}/common/utils/utils.c ${OPENAIR_DIR}/common/utils/system.c ${GTPU_need_ITTI} diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index a5d47a4158..052a32f320 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -502,11 +502,12 @@ function main() { DIR=$OPENAIR_DIR/cmake_targets if [ "$NOS1" = "1" ] ; then lte_build_dir=lte_noS1_build_oai - lte_exec=lte-softmodem-nos1 + #lte_exec=lte-softmodem-nos1 + lte_exec=lte-softmodem-stub else lte_build_dir=lte_build_oai - lte_exec=lte-softmodem - #lte_exec=lte-softmodem-stub + #lte_exec=lte-softmodem + lte_exec=lte-softmodem-stub fi # configuration module libraries, one currently available, using libconfig diff --git a/nfapi/nfapi_pnf.c b/nfapi/nfapi_pnf.c index 708152be01..076707ee32 100644 --- a/nfapi/nfapi_pnf.c +++ b/nfapi/nfapi_pnf.c @@ -1414,7 +1414,8 @@ int start_request(nfapi_pnf_config_t* config, nfapi_pnf_phy_config_t* phy, nfapi NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] DJP - HACK - Set p7_config global ready for subframe ind%s\n", __FUNCTION__); p7_config_g = p7_config; - printf("Panos-D: start_request, bUFFER SIZE: %d", p7_config_g->subframe_buffer_size); + NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Panos-D: start_request, BUFFER SIZE: %d", p7_config_g->subframe_buffer_size); + //printf("Panos-D: start_request, bUFFER SIZE: %d", p7_config_g->subframe_buffer_size); // Need to wait for main thread to create RU structures while(config_sync_var<0) @@ -1841,7 +1842,8 @@ void oai_subframe_ind(uint16_t sfn, uint16_t sf) if (p7_config_g != NULL && sync_var==0) { - printf("Panos-D: oai_subframe_ind 1, buffer size:%d", p7_config_g->subframe_buffer_size); + NFAPI_TRACE(NFAPI_TRACE_INFO, "[PNF] Panos-D: oai_subframe_ind 1, buffer size: %d", p7_config_g->subframe_buffer_size); + //printf("Panos-D: oai_subframe_ind 1, buffer size:%d", p7_config_g->subframe_buffer_size); uint16_t sfn_sf_tx = sfn<<4 | sf; diff --git a/openair1/PHY/defs.h b/openair1/PHY/defs.h index d10af0de34..b5f8da626d 100644 --- a/openair1/PHY/defs.h +++ b/openair1/PHY/defs.h @@ -662,6 +662,7 @@ typedef struct{ int ticking_var; /// condition variable for timer_thread; pthread_cond_t cond_ticking; + //time_stats_t timer_stats; }SF_ticking; @@ -1449,6 +1450,7 @@ typedef struct { time_stats_t dlsch_tc_intl1_stats; time_stats_t dlsch_tc_intl2_stats; time_stats_t tx_prach; + time_stats_t timer_stats; /// RF and Interface devices per CC diff --git a/openair2/ENB_APP/enb_config.c b/openair2/ENB_APP/enb_config.c index 327b7bb0c8..c20e447c07 100644 --- a/openair2/ENB_APP/enb_config.c +++ b/openair2/ENB_APP/enb_config.c @@ -272,7 +272,7 @@ void UE_config_stub_pnf(void) { UE_mac_inst[0].eth_params_n.remote_portd = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr); UE_mac_inst[0].eth_params_n.transp_preference = ETH_UDP_MODE;*/ - sf_ahead = 4; // Cannot cope with 4 subframes betweem RX and TX - set it to 2 + sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2 //configure_nfapi_pnf(UE_mac_inst[0].eth_params_n.remote_addr, UE_mac_inst[0].eth_params_n.remote_portc, UE_mac_inst[0].eth_params_n.my_addr, UE_mac_inst[0].eth_params_n.my_portd, UE_mac_inst[0].eth_params_n.remote_portd); configure_nfapi_pnf(stub_eth_params.remote_addr, stub_eth_params.remote_portc, stub_eth_params.my_addr, stub_eth_params.my_portd, stub_eth_params.remote_portd); } @@ -335,13 +335,13 @@ void RCconfig_L1(void) { RC.eNB[j] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB**)); LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]); memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB***)); - printf("Panos-D: RCconfig_L1 99"); + //printf("Panos-D: RCconfig_L1 99"); } for (i=0;i<RC.nb_L1_CC[j];i++) { - printf("Panos-D: RCconfig_L1 9"); + //printf("Panos-D: RCconfig_L1 9"); if (RC.eNB[j][i] == NULL) { - printf("Panos-D: RCconfig_L1 10"); + //printf("Panos-D: RCconfig_L1 10"); RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB)); memset((void*)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB)); LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]); @@ -364,7 +364,7 @@ void RCconfig_L1(void) { RC.eNB[j][0]->eth_params_n.remote_portd = *(L1_ParamList.paramarray[j][L1_REMOTE_N_PORTD_IDX].iptr); RC.eNB[j][0]->eth_params_n.transp_preference = ETH_UDP_MODE; - printf("Panos-D: RCconfig_L1 11"); + //printf("Panos-D: RCconfig_L1 11"); sf_ahead = 2; // Cannot cope with 4 subframes betweem RX and TX - set it to 2 RC.nb_macrlc_inst = 1; // This is used by mac_top_init_eNB() @@ -384,7 +384,7 @@ void RCconfig_L1(void) { configure_nfapi_pnf(RC.eNB[j][0]->eth_params_n.remote_addr, RC.eNB[j][0]->eth_params_n.remote_portc, RC.eNB[j][0]->eth_params_n.my_addr, RC.eNB[j][0]->eth_params_n.my_portd, RC.eNB[j][0]->eth_params_n .remote_portd); } else { // other midhaul - printf("Panos-D: RCconfig_L1 12 \n"); + //printf("Panos-D: RCconfig_L1 12 \n"); } }// j=0..num_inst printf("Initializing northbound interface for L1\n"); @@ -400,22 +400,22 @@ void RCconfig_L1(void) { RC.nb_L1_CC[j]=1; // DJP - hmmm - printf("Panos-D: RCconfig_L1 13 \n"); + //printf("Panos-D: RCconfig_L1 13 \n"); if (RC.eNB[j] == NULL) { RC.eNB[j] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB*)); - printf("Panos-D: RCconfig_L1 13 \n"); + //printf("Panos-D: RCconfig_L1 13 \n"); LOG_I(PHY,"RC.eNB[%d] = %p\n",j,RC.eNB[j]); memset(RC.eNB[j],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB*)); - printf("Panos-D: RCconfig_L1 14 \n"); + //printf("Panos-D: RCconfig_L1 14 \n"); } for (i=0;i<RC.nb_L1_CC[j];i++) { if (RC.eNB[j][i] == NULL) { - printf("Panos-D: RCconfig_L1 15 \n"); + //printf("Panos-D: RCconfig_L1 15 \n"); RC.eNB[j][i] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB)); - printf("Panos-D: RCconfig_L1 16 \n"); + //printf("Panos-D: RCconfig_L1 16 \n"); memset((void*)RC.eNB[j][i],0,sizeof(PHY_VARS_eNB)); - printf("Panos-D: RCconfig_L1 17 \n"); + //printf("Panos-D: RCconfig_L1 17 \n"); LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",j,i,RC.eNB[j][i]); RC.eNB[j][i]->Mod_id = j; RC.eNB[j][i]->CC_id = i; diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 837fd2976a..2ea8bdaa68 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -9,6 +9,9 @@ #include "openair1/SCHED/defs.h" //#include "common/ran_context.h" #include "openair2/PHY_INTERFACE/phy_stub_UE.h" + +//#define DEADLINE_SCHEDULER 1 + //#include "nfapi_pnf_interface.h" //#include "nfapi.h" //#include "nfapi_pnf.h" @@ -18,6 +21,7 @@ //extern uint8_t nfapi_pnf; //UL_IND_t *UL_INFO; +extern nfapi_tx_request_pdu_t* tx_request_pdu[1023][10][10]; void Msg1_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); void Msg3_transmitted(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id); @@ -742,8 +746,11 @@ int tx_req_UE_MAC(nfapi_tx_request_t* req) LOG_D(PHY,"%s() SFN/SF:%d/%d PDUs:%d\n", __FUNCTION__, sfn, sf, req->tx_request_body.number_of_pdus); - if (req->tx_request_body.tl.tag==NFAPI_TX_REQUEST_BODY_TAG) - { + LOG_I(MAC, "Panos-D: tx_req_UE_MAC 1 \n"); + //printf("Panos-D: tx_req_UE_MAC 1 \n"); + //if (req->tx_request_body.tl.tag==NFAPI_TX_REQUEST_BODY_TAG) + //{ + for (int i=0; i<req->tx_request_body.number_of_pdus; i++) { LOG_D(PHY,"%s() SFN/SF:%d/%d number_of_pdus:%d [PDU:%d] pdu_length:%d pdu_index:%d num_segments:%d\n", @@ -756,10 +763,10 @@ int tx_req_UE_MAC(nfapi_tx_request_t* req) req->tx_request_body.tx_pdu_list[i].num_segments ); - tx_request_pdu_list = req->tx_request_body.tx_pdu_list; - //tx_request_pdu_UE_MAC[sfn][sf][i] = &req->tx_request_body.tx_pdu_list[i]; + //tx_request_pdu_list = req->tx_request_body.tx_pdu_list; + //tx_request_pdu[sfn][sf][i] = &req->tx_request_body.tx_pdu_list[i]; } - } + //} return 0; } @@ -767,7 +774,7 @@ int tx_req_UE_MAC(nfapi_tx_request_t* req) int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req) { - + LOG_I(MAC, "Panos-D: dl_config_req_UE_MAC 1 \n"); int sfn = NFAPI_SFNSF2SFN(req->sfn_sf); int sf = NFAPI_SFNSF2SF(req->sfn_sf); module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change. @@ -784,10 +791,15 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req) //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() TX:%d/%d RX:%d/%d sfn_sf:%d DCI:%d PDU:%d\n", __FUNCTION__, proc->frame_tx, proc->subframe_tx, proc->frame_rx, proc->subframe_rx, NFAPI_SFNSF2DEC(req->sfn_sf), req->dl_config_request_body.number_dci, req->dl_config_request_body.number_pdu); + + + //LOG_D(PHY,"NFAPI: Sched_INFO:SFN/SF:%d%d dl_pdu:%d tx_req:%d hi_dci0:%d ul_cfg:%d num_pdcch_symbols:%d\n", + // frame,subframe,number_dl_pdu,TX_req->tx_request_body.number_of_pdus,number_hi_dci0_pdu,number_ul_pdu, eNB->pdcch_vars[subframe&1].num_pdcch_symbols); + for (int i=0;i<req->dl_config_request_body.number_pdu;i++) { //NFAPI_TRACE(NFAPI_TRACE_INFO, "%s() sfn/sf:%d PDU[%d] size:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size); - + LOG_E(MAC, "%s() sfn/sf:%d PDU[%d] size:%d\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), i, dl_config_pdu_list[i].pdu_size); if (dl_config_pdu_list[i].pdu_type == NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE) { if (dl_config_pdu_list[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti_type == 1) { @@ -810,6 +822,8 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req) dl_config_pdu_tmp = &dl_config_pdu_list[i+1]; if(dl_config_pdu_tmp->pdu_type == NFAPI_DL_CONFIG_DLSCH_PDU_TYPE && dl_config_pdu_list[i].dci_dl_pdu.dci_dl_pdu_rel8.rnti == 0xFFFF){ //pdu = Tx_req->tx_request_body.tx_pdu_list[dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data; + LOG_D(PHY,"%s() [PDU:%d] NFAPI_DL_CONFIG_DLSCH_PDU_TYPE TX:%d/%d RX:%d/%d transport_blocks:%d pdu_index:%d sdu:%p\n", + __FUNCTION__, i, sfn, sf, sfn, sf, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.transport_blocks, dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index, tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data); if(tx_request_pdu_list + dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index!= NULL){ ue_decode_si(Mod_id, 0, sfn, 0, tx_request_pdu_list[dl_config_pdu_tmp->dlsch_pdu.dlsch_pdu_rel8.pdu_index].segments[0].segment_data, @@ -868,14 +882,25 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req) //NFAPI_TRACE(NFAPI_TRACE_ERROR, "%s() UNKNOWN:%d\n", __FUNCTION__, dl_config_pdu_list[i].pdu_type); } } + //deallocate_mem_nfapi_dl if(req->vendor_extension) free(req->vendor_extension); + /*if(tx_request_pdu_list) + free(tx_request_pdu_list); + free(req);*/ + return 0; } +int deallocate_mem_nfapi_dl(nfapi_dl_config_request_t* req, nfapi_tx_request_pdu_t* tx_pdu_list){ + +} + + + int hi_dci0_req_UE_MAC(nfapi_hi_dci0_request_t* req) { @@ -919,13 +944,40 @@ int hi_dci0_req_UE_MAC(nfapi_hi_dci0_request_t* req) return 0; } + + + + // The following set of memcpy functions should be getting called as callback functions from // pnf_p7_subframe_ind. int memcpy_dl_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request_t* req) { + module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change. - UE_mac_inst[Mod_id].dl_config_req = req; + UE_mac_inst[Mod_id].dl_config_req = (nfapi_dl_config_request_t*)malloc(sizeof(nfapi_dl_config_request_t)); + LOG_I(MAC, "Panos-D: memcpy_dl_config_req 1 \n"); + + /*if(req->header!=NULL){ + UE_mac_inst[Mod_id].dl_config_req->header = req->header; + }*/ + + UE_mac_inst[Mod_id].dl_config_req->sfn_sf = req->sfn_sf; + UE_mac_inst[Mod_id].dl_config_req->vendor_extension = req->vendor_extension; + + UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.number_dci = req->dl_config_request_body.number_dci; + UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = req->dl_config_request_body.number_pdcch_ofdm_symbols; + UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.number_pdsch_rnti = req->dl_config_request_body.number_pdsch_rnti; + UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.number_pdu = req->dl_config_request_body.number_pdu; + UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.tl = req->dl_config_request_body.tl; + + UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*) malloc(req->dl_config_request_body.number_pdu*sizeof(nfapi_dl_config_request_pdu_t)); + for(int i=0; i<UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.number_pdu; i++) { + UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.dl_config_pdu_list[i] = req->dl_config_request_body.dl_config_pdu_list[i]; + } + + //UE_mac_inst[Mod_id].dl_config_req = req; return 0; + } int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request_t* req) @@ -937,8 +989,43 @@ int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request int memcpy_tx_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_tx_request_t* req) { + LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.number_of_pdus: %d \n", req->tx_request_body.number_of_pdus); + LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].pdu_length: %d \n", req->tx_request_body.tx_pdu_list[0].pdu_length); + LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].pdu_index: %d \n", req->tx_request_body.tx_pdu_list[0].pdu_index); + LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].num_segments: %d \n", req->tx_request_body.tx_pdu_list[0].num_segments); + LOG_I(MAC, "Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].segments[j].segment_data: %d \n", *req->tx_request_body.tx_pdu_list[0].segments[0].segment_data); + //printf("Panos-D: memcpy_tx_req 1, req->tx_request_body.number_of_pdus: %d \n", req->tx_request_body.number_of_pdus); + //printf("Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].pdu_length: %d \n", req->tx_request_body.tx_pdu_list[0].pdu_length); + //printf("Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].pdu_index: %d \n", req->tx_request_body.tx_pdu_list[0].pdu_index); + //printf("Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].num_segments: %d \n", req->tx_request_body.tx_pdu_list[0].num_segments); + //printf("Panos-D: memcpy_tx_req 1, req->tx_request_body.tx_pdu_list[i].segments[j].segment_data: %d \n", *req->tx_request_body.tx_pdu_list[0].segments[0].segment_data); + module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change. - UE_mac_inst[Mod_id].tx_req = req; + + int num_elem = req->tx_request_body.number_of_pdus; + tx_request_pdu_list = (nfapi_tx_request_pdu_t*) malloc(num_elem*sizeof(nfapi_tx_request_pdu_t)); + //UE_mac_inst[Mod_id].tx_req = (nfapi_tx_request_t*) malloc(sizeof(nfapi_tx_request_t)); + //memcpy(UE_mac_inst[Mod_id].tx_req, req, sizeof(req)); + for (int i=0; i<num_elem; i++) { + tx_request_pdu_list[i].num_segments = req->tx_request_body.tx_pdu_list[i].num_segments; + tx_request_pdu_list[i].pdu_index = req->tx_request_body.tx_pdu_list[i].pdu_index; + tx_request_pdu_list[i].pdu_length = req->tx_request_body.tx_pdu_list[i].pdu_length; + for (int j=0; j<req->tx_request_body.tx_pdu_list[i].num_segments; j++){ + //*tx_request_pdu_list[i].segments[j].segment_data = *req->tx_request_body.tx_pdu_list[i].segments[j].segment_data; + tx_request_pdu_list[i].segments[j].segment_length = req->tx_request_body.tx_pdu_list[i].segments[j].segment_length; + if(tx_request_pdu_list[i].segments[j].segment_length > 0){ + tx_request_pdu_list[i].segments[j].segment_data = (uint8_t*)malloc(tx_request_pdu_list[i].segments[j].segment_length*sizeof (uint8_t)); + memcpy(tx_request_pdu_list[i].segments[j].segment_data, req->tx_request_body.tx_pdu_list[i].segments[j].segment_data, tx_request_pdu_list[i].segments[j].segment_length); + } + //tx_request_pdu_list[i].segments[j].segment_length = req->tx_request_body.tx_pdu_list[i].segments[j].segment_length; + } + + //tx_request_pdu_list[i].segments = req->tx_request_body.tx_pdu_list[i].segments; + } + + + // Panos: Old way. Not possible to use because by the time we call tx_req_UE_MAC tx_req memory has been deallocated within nfapi. + //UE_mac_inst[Mod_id].tx_req = req; return 0; } diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index 1ffed72dc5..f446b72e78 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -2742,6 +2742,9 @@ int decode_BCCH_DLSCH_Message( (void*)&bcch_message->message.choice.c1.choice.systemInformationBlockType1, sizeof(SystemInformationBlockType1_t) ); LOG_D( RRC, "[UE %"PRIu8"] Decoding First SIB1\n", ctxt_pP->module_id ); + + LOG_I( RRC, "Panos-D: decode_BCCH_DLSCH_Message1 BEFORE decode_SIB1"); + //printf("Panos-D: decode_BCCH_DLSCH_Message1 BEFORE decode_SIB1"); decode_SIB1( ctxt_pP, eNB_index, rsrq, rsrp ); } } @@ -2760,7 +2763,8 @@ int decode_BCCH_DLSCH_Message( LOG_D( RRC, "[UE %"PRIu8"] Decoding SI for frameP %"PRIu32"\n", ctxt_pP->module_id, ctxt_pP->frame ); - + LOG_I( RRC, "Panos-D: decode_BCCH_DLSCH_Message1 BEFORE OTHER decode_SI"); + //printf("Panos-D: decode_BCCH_DLSCH_Message1 BEFORE OTHER decode_SI"); decode_SI( ctxt_pP, eNB_index ); } @@ -3581,25 +3585,31 @@ static void dump_sib19(SystemInformationBlockType19_r12_t *sib19){ //----------------------------------------------------------------------------- static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) { - + LOG_I( RRC, "Panos-D: decode_SI 1 \n"); + //printf("Panos-D: decode_SI 1 \n"); SystemInformation_t** si = &UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; int new_sib = 0; SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; + LOG_I( RRC, "Panos-D: decode_SI 2 \n"); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN ); // Dump contents //TTN - should be modified since we use SystemInformation__criticalExtensions_PR_criticalExtensionsFuture // instead of SystemInformation__criticalExtensions_PR_systemInformation_r8 - //if ((*si)->criticalExtensions.present == SystemInformation__criticalExtensions_PR_systemInformation_r8) { - if ((*si)->criticalExtensions.present == SystemInformation__criticalExtensions_PR_criticalExtensionsFuture) { + // Panos: I brought this if condition back to previous form in order to prevent crashing. Pending to + // modify for SystemInformation__criticalExtensions_PR_criticalExtensionsFuture + if ((*si)->criticalExtensions.present == SystemInformation__criticalExtensions_PR_systemInformation_r8) { + //if ((*si)->criticalExtensions.present == SystemInformation__criticalExtensions_PR_criticalExtensionsFuture) { LOG_D( RRC, "[UE] (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count %d\n", (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count ); } else { + LOG_I( RRC, "Panos-D: decode_SI 2.3 \n"); LOG_D( RRC, "[UE] Unknown criticalExtension version (not Rel8)\n" ); return -1; } + LOG_I( RRC, "Panos-D: decode_SI 3 \n"); for (int i=0; i<(*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count; i++) { LOG_D( RRC, "SI count %d\n", i ); struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *typeandinfo; @@ -3607,6 +3617,7 @@ static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_in switch(typeandinfo->present) { case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: + LOG_I( RRC, "Panos-D: decode_SI 4 \n"); if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2; new_sib=1; @@ -3690,6 +3701,7 @@ static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_in break; // case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: + LOG_I( RRC, "Panos-D: decode_SI 5 \n"); if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4) == 0) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4; new_sib=1; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf index de6eb72ee7..801f439084 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/oaiL1.nfapi.usrpb210.conf @@ -5,16 +5,32 @@ log_config = { hw_log_verbosity ="medium"; phy_log_level ="info"; phy_log_verbosity ="medium"; - mac_log_level ="info"; + mac_log_level ="debug"; mac_log_verbosity ="medium"; rlc_log_level ="info"; rlc_log_verbosity ="medium"; pdcp_log_level ="info"; pdcp_log_verbosity ="medium"; - rrc_log_level ="info"; - rrc_log_verbosity ="medium"; + rrc_log_level ="debug"; + rrc_log_verbosity ="full"; }; + +#L1s = ( +# { +# num_cc = 1; +# tr_n_preference = "nfapi"; +# local_n_if_name = "eno1"; +# remote_n_address = "192.168.1.28"; +# local_n_address = "192.168.1.74"; +# local_n_portc = 50000; +# remote_n_portc = 50001; +# local_n_portd = 50010; +# remote_n_portd = 50011; +# } +#); + + L1s = ( { num_cc = 1; diff --git a/targets/RT/USER/lte-softmodem-stub.c b/targets/RT/USER/lte-softmodem-stub.c index e02a064fe4..62f2976088 100644 --- a/targets/RT/USER/lte-softmodem-stub.c +++ b/targets/RT/USER/lte-softmodem-stub.c @@ -633,7 +633,6 @@ static void get_options(void) { uint32_t online_log_messages; uint32_t glog_level, glog_verbosity; uint32_t start_telnetsrv; - printf("Panos: get_options 1 \n"); paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ; paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ; @@ -641,7 +640,6 @@ static void get_options(void) { config_process_cmdline( cmdline_params,sizeof(cmdline_params)/sizeof(paramdef_t),NULL); printf("get_options 0, UE_flag: %d", UE_flag); - printf("Panos: get_options 2 \n"); if (strlen(in_path) > 0) { opt_type = OPT_PCAP; opt_enabled=1; @@ -652,7 +650,6 @@ static void get_options(void) { opt_type = OPT_WIRESHARK; printf("Enabling OPT for wireshark for local interface"); } - printf("Panos: get_options 3 \n"); config_process_cmdline( cmdline_logparams,sizeof(cmdline_logparams)/sizeof(paramdef_t),NULL); if(config_isparamset(cmdline_logparams,CMDLINE_ONLINELOG_IDX)) { set_glog_onlinelog(online_log_messages); @@ -667,27 +664,23 @@ static void get_options(void) { load_module_shlib("telnetsrv",NULL,0); } - printf("Panos: get_options 4 \n"); if (UE_flag > 0) { // set default parameters set_default_frame_parms(frame_parms); paramdef_t cmdline_uemodeparams[] =CMDLINE_UEMODEPARAMS_DESC; paramdef_t cmdline_ueparams[] =CMDLINE_UEPARAMS_DESC; - printf("Panos: get_options 5 \n"); config_process_cmdline( cmdline_uemodeparams,sizeof(cmdline_uemodeparams)/sizeof(paramdef_t),NULL); config_process_cmdline( cmdline_ueparams,sizeof(cmdline_ueparams)/sizeof(paramdef_t),NULL); - printf("Panos: get_options 6 \n"); + if (loopfile != NULL) { printf("Input file for hardware emulation: %s",loopfile); mode=loop_through_memory; input_fd = fopen(loopfile,"r"); AssertFatal(input_fd != NULL,"Please provide a valid input file\n"); } - printf("Panos: get_options 7 \n"); if ( (cmdline_uemodeparams[CMDLINE_CALIBUERX_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue; - printf("Panos: get_options 8 \n"); if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXMED_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_med; printf("Panos: get_options 9 \n"); if ( (cmdline_uemodeparams[CMDLINE_CALIBUERXBYP_IDX].paramflags & PARAMFLAG_PARAMSET) != 0) mode = rx_calib_ue_byp; @@ -1305,12 +1298,13 @@ int main( int argc, char **argv ) rt_sleep_ns(10*100000000ULL); - if (nfapi_mode) + // Panos: I have commented these lines because cond_init and mutex_init take place above in any case. + /*if (nfapi_mode) { printf("NFAPI*** - mutex and cond created - will block shortly for completion of PNF connection\n"); pthread_cond_init(&sync_cond,NULL); pthread_mutex_init(&sync_mutex, NULL); - } + }*/ const char *nfapi_mode_str = "<UNKNOWN>"; @@ -1343,10 +1337,6 @@ int main( int argc, char **argv ) // start the main threads if (UE_flag == 1) { int eMBMS_active = 0; - // Panos: Call init_UE_stub instead of init_UE as we are always on nfapi_mode=3 - //phy_stub_ticking = (SF_ticking*)malloc(sizeof(SF_ticking)); - init_timer_thread(); - init_UE_stub(1,eMBMS_active,uecap_xer_in); //init_UE(1,eMBMS_active,uecap_xer_in); number_of_cards = 1; @@ -1355,6 +1345,10 @@ int main( int argc, char **argv ) { wait_nfapi_init("main?"); } + // Panos: Call init_UE_stub instead of init_UE as we are always on nfapi_mode=3 + //phy_stub_ticking = (SF_ticking*)malloc(sizeof(SF_ticking)); + init_timer_thread(); + init_UE_stub(1,eMBMS_active,uecap_xer_in); /*for(CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { PHY_vars_UE_g[0][CC_id]->rf_map.card=0; diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index f8254c193f..f2c87c2e7e 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -57,6 +57,7 @@ #include "UTIL/LOG/vcd_signal_dumper.h" #include "UTIL/OPT/opt.h" + #include "T.h" extern double cpuf; @@ -812,6 +813,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { //CPU_SET(threads.three, &cpuset); init_thread(900000,1000000 , FIFO_PRIORITY-1, &cpuset, threadname); + wait_sync("UE_phy_stub_thread_rxn_txnp4"); while (!oai_exit) { if (pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) != 0) { @@ -830,7 +832,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { proc->subframe_rx=timer_subframe; proc->frame_rx = timer_frame; - proc->subframe_tx=(timer_subframe+4)%10; + proc->subframe_tx=(timer_subframe+2)%10; proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0); @@ -875,17 +877,18 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { // Panos: is this the right place to call oai_subframe_indication to invoke p7 nfapi callbacks here? oai_subframe_ind(proc->frame_rx, proc->subframe_rx); - printf("Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind \n"); - if(UE_mac_inst[Mod_id].tx_req!= NULL){ + LOG_I( MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind \n"); + //printf("Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind \n"); + /*if(UE_mac_inst[Mod_id].tx_req!= NULL){ printf("Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 2\n"); tx_req_UE_MAC(UE_mac_inst[Mod_id].tx_req); - } + }*/ if(UE_mac_inst[Mod_id].dl_config_req!= NULL) { - printf("Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 3\n"); + LOG_I( MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 3 \n"); dl_config_req_UE_MAC(UE_mac_inst[Mod_id].dl_config_req); } if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){ - printf("Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 4\n"); + LOG_I( MAC, "Panos-D: UE_phy_stub_thread_rxn_txnp4 after oai_subframe_ind 4 \n"); hi_dci0_req_UE_MAC(UE_mac_inst[Mod_id].hi_dci0_req); } @@ -1421,16 +1424,24 @@ int setup_ue_buffers(PHY_VARS_UE **phy_vars_ue, openair0_config_t *openair0_cfg) // which will be ticking and provide the SFN/SF values that will be used from the UE threads // playing the role of nfapi-pnf. static void* timer_thread( void* param ) { + thread_top_init("timer_thread",1,870000L,1000000L,1000000L); timer_subframe =9; timer_frame =1023; //phy_stub_ticking = (SF_ticking*)malloc(sizeof(SF_ticking)); phy_stub_ticking->ticking_var = -1; + PHY_VARS_UE *UE; + UE = PHY_vars_UE_g[0][0]; + double t_diff; wait_sync("timer_thread"); //pthread_mutex_init(&phy_stub_ticking->mutex_ticking,NULL); //pthread_cond_init(&phy_stub_ticking->cond_ticking,NULL); + struct timespec start = {0}; + struct timespec end = {0}; + //sleepValue.tv_nsec = 1000000; + opp_enabled = 1; while (!oai_exit) { - usleep(1000); + // these are local subframe/frame counters to check that we are in synch with the fronthaul timing. // They are set on the first rx/tx in the underly FH routines. if (timer_subframe==9) { @@ -1440,18 +1451,45 @@ static void* timer_thread( void* param ) { } else { timer_subframe++; } + //printf("[timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe); + LOG_I(MAC," Panos-D [timer_thread] Frame: %d, Subframe: %d \n", timer_frame, timer_subframe); //AssertFatal( 0 == pthread_cond_signal(&phy_stub_ticking->cond_ticking), ""); AssertFatal(pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) ==0,""); phy_stub_ticking->ticking_var++; // This should probably be a call to pthread_cond_broadcast when we introduce support for multiple UEs (threads) - if(phy_stub_ticking->ticking_var == 0) { - if (pthread_cond_signal(&phy_stub_ticking->cond_ticking) != 0) { + if(phy_stub_ticking->ticking_var == 0){ + //AssertFatal(phy_stub_ticking->ticking_var == 0,"phy_stub_ticking->ticking_var = %d", + // phy_stub_ticking->ticking_var); + if (pthread_cond_signal(&phy_stub_ticking->cond_ticking) != 0) { //LOG_E( PHY, "[SCHED][UE %d] ERROR pthread_cond_signal for UE RX thread\n", UE->Mod_id); LOG_E( PHY, "timer_thread ERROR pthread_cond_signal for UE_thread\n"); exit_fun("nothing to add"); - } } + } + AssertFatal(pthread_mutex_unlock(&phy_stub_ticking->mutex_ticking) ==0,""); + start_meas(&UE->timer_stats); + + + //clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &start); // get initial time-stamp + usleep(1000); + + //clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &end); // get final time-stamp + + //double t_ns = (double)(end.tv_sec - start.tv_sec) * 1.0e9 + + // (double)(end.tv_nsec - start.tv_nsec); + //printf("Panos-D: [timer_thread] REAL TIME difference: %f", t_ns); + + + //nanosleep(&sleepValue, NULL); + + stop_meas(&UE->timer_stats); + t_diff = get_time_meas_us(&UE->timer_stats); + //printf("Panos-D: Absolute time: %lld, diff: %lld, diff_now: %lld \n",UE->timer_stats.p_time, UE->timer_stats.diff, UE->timer_stats.diff_now); + //LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",module_idP); + if (t_diff > 1100) LOG_E(MAC," Panos-D Absolute time: %f\n", t_diff); + //printf("Panos-D: Absolute time: %f", t_diff); + //UE->proc.ticking_var++; // pthread_cond_signal() //Send signal to ue_thread()? // We also need to somehow pass the information of SFN/SF -- GitLab