diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index d07581c474fe824c7c23f10408b64103db793146..99f75175190a803d26e0f6a6c613a79e97cb7a32 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -1502,13 +1502,6 @@ typedef struct { int ra_frame; // This variable keeps the frame in which the RA started for the specific UE. It is used in order // to make sure that different UEs RA starts within a number of frames difference. - /// Panos: Pointers to config_request types. Used from nfapi callback functions. - nfapi_dl_config_request_t* dl_config_req; - nfapi_ul_config_request_t* ul_config_req; - nfapi_hi_dci0_request_t* hi_dci0_req; - nfapi_tx_request_pdu_t* tx_request_pdu_list; - nfapi_tx_request_t* tx_req; - eth_params_t eth_params_n; } UE_MAC_INST; diff --git a/openair2/LAYER2/MAC/ue_procedures.c b/openair2/LAYER2/MAC/ue_procedures.c index 7f98ad55e5af66fce6333f6c2025e0c2c407f6dc..fdd70d1aa58ab92eba0f966e6dcff748eb5d5b8d 100644 --- a/openair2/LAYER2/MAC/ue_procedures.c +++ b/openair2/LAYER2/MAC/ue_procedures.c @@ -163,11 +163,6 @@ void ue_init_mac(module_id_t module_idP) UE_mac_inst[module_idP].UE_mode[0] = NOT_SYNCHED; //PRACH; UE_mac_inst[module_idP].first_ULSCH_Tx =0; UE_mac_inst[module_idP].SI_Decoded = 0; - UE_mac_inst[module_idP].dl_config_req = NULL; - UE_mac_inst[module_idP].ul_config_req = NULL; - UE_mac_inst[module_idP].hi_dci0_req = NULL; - UE_mac_inst[module_idP].tx_req = NULL; - //UE_mac_inst[Mod_id].ra_frame = 0; next_ra_frame = 0; next_Mod_id = 0; tx_request_pdu_list = NULL; diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.c b/openair2/PHY_INTERFACE/phy_stub_UE.c index 9d7bb20875f3394ed6503cea01e5f06f8a3edf5a..6be951e6a6e75c024724488a49c2758f38167b6b 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.c +++ b/openair2/PHY_INTERFACE/phy_stub_UE.c @@ -50,7 +50,7 @@ void fill_rx_indication_UE_MAC(module_id_t Mod_id,int frame,int subframe, UL_IND UL_INFO->rx_ind.sfn_sf = frame<<4| subframe; UL_INFO->rx_ind.rx_indication_body.tl.tag = NFAPI_RX_INDICATION_BODY_TAG; - UL_INFO->rx_ind.vendor_extension = UE_mac_inst[Mod_id].ul_config_req->vendor_extension; + UL_INFO->rx_ind.vendor_extension = ul_config_req->vendor_extension; pdu = &UL_INFO->rx_ind.rx_indication_body.rx_pdu_list[UL_INFO->rx_ind.rx_indication_body.number_of_pdus]; @@ -91,7 +91,7 @@ void fill_sr_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_I nfapi_sr_indication_t *sr_ind = &UL_INFO->sr_ind; nfapi_sr_indication_body_t *sr_ind_body = &sr_ind->sr_indication_body; nfapi_sr_indication_pdu_t *pdu = &sr_ind_body->sr_pdu_list[sr_ind_body->number_of_srs]; - UL_INFO->sr_ind.vendor_extension = UE_mac_inst[Mod_id].ul_config_req->vendor_extension; + UL_INFO->sr_ind.vendor_extension = ul_config_req->vendor_extension; //nfapi_sr_indication_pdu_t *pdu = &UL_INFO->sr_ind.sr_indication_body.sr_pdu_list[UL_INFO->rx_ind.rx_indication_body.number_of_pdus]; @@ -132,7 +132,7 @@ void fill_crc_indication_UE_MAC(int Mod_id,int frame,int subframe, UL_IND_t *UL_ nfapi_crc_indication_pdu_t *pdu = &UL_INFO->crc_ind.crc_indication_body.crc_pdu_list[UL_INFO->crc_ind.crc_indication_body.number_of_crcs]; UL_INFO->crc_ind.sfn_sf = frame<<4| subframe; - UL_INFO->crc_ind.vendor_extension = UE_mac_inst[Mod_id].ul_config_req->vendor_extension; + UL_INFO->crc_ind.vendor_extension = ul_config_req->vendor_extension; UL_INFO->crc_ind.header.message_id = NFAPI_CRC_INDICATION; UL_INFO->crc_ind.crc_indication_body.tl.tag = NFAPI_CRC_INDICATION_BODY_TAG; @@ -248,7 +248,7 @@ void fill_ulsch_harq_indication_UE_MAC(int Mod_id, int frame,int subframe, UL_IN UL_INFO->harq_ind.header.message_id = NFAPI_HARQ_INDICATION; UL_INFO->harq_ind.sfn_sf = frame<<4|subframe; - UL_INFO->harq_ind.vendor_extension = UE_mac_inst[Mod_id].ul_config_req->vendor_extension; + UL_INFO->harq_ind.vendor_extension = ul_config_req->vendor_extension; UL_INFO->harq_ind.harq_indication_body.tl.tag = NFAPI_HARQ_INDICATION_BODY_TAG; @@ -292,7 +292,7 @@ void fill_uci_harq_indication_UE_MAC(int Mod_id, nfapi_harq_indication_body_t *body = &ind->harq_indication_body; nfapi_harq_indication_pdu_t *pdu = &body->harq_pdu_list[UL_INFO->harq_ind.harq_indication_body.number_of_harqs]; - UL_INFO->harq_ind.vendor_extension = UE_mac_inst[Mod_id].ul_config_req->vendor_extension; + UL_INFO->harq_ind.vendor_extension = ul_config_req->vendor_extension; ind->sfn_sf = frame<<4|subframe; ind->header.message_id = NFAPI_HARQ_INDICATION; @@ -354,9 +354,6 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id, nfapi_ul_config_ulsch_pdu_rel8_t *rel8 = &ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8; if (ul_config_pdu->pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) { - //LOG_D(MAC, "Panos-D: handle_nfapi_ul_pdu_UE_MAC 2 \n"); - //AssertFatal((UE_id = find_ulsch(ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.rnti,eNB,SEARCH_EXIST_OR_FREE))>=0, - // "No existing UE ULSCH for rnti %x\n",rel8->rnti); LOG_D(PHY,"Applying UL config for UE, rnti %x for frame %d, subframe %d\n", rel8->rnti,frame,subframe); uint8_t ulsch_buffer[5477] __attribute__ ((aligned(32))); @@ -525,7 +522,7 @@ void handle_nfapi_ul_pdu_UE_MAC(module_id_t Mod_id, int ul_config_req_UE_MAC(nfapi_ul_config_request_t* req, int timer_frame, int timer_subframe, module_id_t Mod_id) { - if (req!=NULL){ // && req->ul_config_request_body.ul_config_pdu_list !=NULL){ + //if (req!=NULL){ // && req->ul_config_request_body.ul_config_pdu_list !=NULL){ LOG_D(PHY,"[PNF] UL_CONFIG_REQ %s() sfn_sf:%d pdu:%d rach_prach_frequency_resources:%d srs_present:%u\n", __FUNCTION__, NFAPI_SFNSF2DEC(req->sfn_sf), @@ -568,7 +565,7 @@ int ul_config_req_UE_MAC(nfapi_ul_config_request_t* req, int timer_frame, int ti } } - } +// } return 0; } @@ -603,7 +600,7 @@ int tx_req_UE_MAC(nfapi_tx_request_t* req) int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //, nfapi_tx_request_pdu_t* tx_request_pdu_list) { - if (req!=NULL && tx_request_pdu_list!=NULL){ + //if (req!=NULL && tx_request_pdu_list!=NULL){ int sfn = NFAPI_SFNSF2SFN(req->sfn_sf); int sf = NFAPI_SFNSF2SF(req->sfn_sf); //Mod_id = 0; //Panos: Currently static (only for one UE) but this should change. @@ -752,24 +749,18 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //, } //deallocate_mem_nfapi_dl - if(req->vendor_extension) + /*if(req->vendor_extension) free(req->vendor_extension); - /*if(tx_request_pdu_list!=NULL){ - free(tx_request_pdu_list); - tx_request_pdu_list = NULL; - }*/ - - if(req->dl_config_request_body.dl_config_pdu_list!=NULL){ free(req->dl_config_request_body.dl_config_pdu_list); req->dl_config_request_body.dl_config_pdu_list = NULL; } free(req); - req = NULL; + req = NULL;*/ return 0; - } + /*} else if(req!=NULL){ //LOG_I(MAC, "Panos-D: dl_config_req_UE_MAC probably dummy DL_Config \n"); if(req->dl_config_request_body.dl_config_pdu_list!=NULL){ @@ -780,7 +771,7 @@ int dl_config_req_UE_MAC(nfapi_dl_config_request_t* req, module_id_t Mod_id) //, free(req); req = NULL; return -1; - } + }*/ @@ -845,26 +836,26 @@ int memcpy_dl_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_dl_config_request for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){ - UE_mac_inst[Mod_id].dl_config_req = (nfapi_dl_config_request_t*)malloc(sizeof(nfapi_dl_config_request_t)); + 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, Mod_id:%d \n", Mod_id); //UE_mac_inst[Mod_id].dl_config_req->header = req->header; - UE_mac_inst[Mod_id].dl_config_req->sfn_sf = req->sfn_sf; + dl_config_req->sfn_sf = req->sfn_sf; - UE_mac_inst[Mod_id].dl_config_req->vendor_extension = req->vendor_extension; + 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; + dl_config_req->dl_config_request_body.number_dci = req->dl_config_request_body.number_dci; + dl_config_req->dl_config_request_body.number_pdcch_ofdm_symbols = req->dl_config_request_body.number_pdcch_ofdm_symbols; + dl_config_req->dl_config_request_body.number_pdsch_rnti = req->dl_config_request_body.number_pdsch_rnti; + 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.tag = req->dl_config_request_body.tl.tag; - UE_mac_inst[Mod_id].dl_config_req->dl_config_request_body.tl.length = req->dl_config_request_body.tl.length; + dl_config_req->dl_config_request_body.tl.tag = req->dl_config_request_body.tl.tag; + dl_config_req->dl_config_request_body.tl.length = req->dl_config_request_body.tl.length; - 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]; + dl_config_req->dl_config_request_body.dl_config_pdu_list = (nfapi_dl_config_request_pdu_t*) calloc(req->dl_config_request_body.number_pdu, sizeof(nfapi_dl_config_request_pdu_t)); + for(int i=0; i<dl_config_req->dl_config_request_body.number_pdu; i++) { + dl_config_req->dl_config_request_body.dl_config_pdu_list[i] = req->dl_config_request_body.dl_config_pdu_list[i]; } } @@ -882,23 +873,23 @@ int memcpy_ul_config_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_ul_config_request for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){ - UE_mac_inst[Mod_id].ul_config_req = (nfapi_ul_config_request_t*)malloc(sizeof(nfapi_ul_config_request_t)); + ul_config_req = (nfapi_ul_config_request_t*)malloc(sizeof(nfapi_ul_config_request_t)); - UE_mac_inst[Mod_id].ul_config_req->sfn_sf = req->sfn_sf; - UE_mac_inst[Mod_id].ul_config_req->vendor_extension = req->vendor_extension; + ul_config_req->sfn_sf = req->sfn_sf; + ul_config_req->vendor_extension = req->vendor_extension; - UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.number_of_pdus = req->ul_config_request_body.number_of_pdus; - UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.rach_prach_frequency_resources = req->ul_config_request_body.rach_prach_frequency_resources; - UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.srs_present = req->ul_config_request_body.srs_present; + ul_config_req->ul_config_request_body.number_of_pdus = req->ul_config_request_body.number_of_pdus; + ul_config_req->ul_config_request_body.rach_prach_frequency_resources = req->ul_config_request_body.rach_prach_frequency_resources; + ul_config_req->ul_config_request_body.srs_present = req->ul_config_request_body.srs_present; - UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.tl.tag = req->ul_config_request_body.tl.tag; - UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.tl.length = req->ul_config_request_body.tl.length; + ul_config_req->ul_config_request_body.tl.tag = req->ul_config_request_body.tl.tag; + ul_config_req->ul_config_request_body.tl.length = req->ul_config_request_body.tl.length; //LOG_D(MAC, "memcpy_ul_config_req 1 #ofULPDUs: %d \n", UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.number_of_pdus); //req->ul_config_request_body.number_of_pdus); - UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*) malloc(req->ul_config_request_body.number_of_pdus*sizeof(nfapi_ul_config_request_pdu_t)); - for(int i=0; i<UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.number_of_pdus; i++) { - UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list[i] = req->ul_config_request_body.ul_config_pdu_list[i]; + ul_config_req->ul_config_request_body.ul_config_pdu_list = (nfapi_ul_config_request_pdu_t*) malloc(req->ul_config_request_body.number_of_pdus*sizeof(nfapi_ul_config_request_pdu_t)); + for(int i=0; i<ul_config_req->ul_config_request_body.number_of_pdus; i++) { + ul_config_req->ul_config_request_body.ul_config_pdu_list[i] = req->ul_config_request_body.ul_config_pdu_list[i]; } } @@ -940,25 +931,25 @@ int memcpy_hi_dci0_req (nfapi_pnf_p7_config_t* pnf_p7, nfapi_hi_dci0_request_t* module_id_t Mod_id = 0; //Panos: Currently static (only for one UE) but this should change. for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++){ - UE_mac_inst[Mod_id].hi_dci0_req = (nfapi_hi_dci0_request_t*)malloc(sizeof(nfapi_hi_dci0_request_t)); + hi_dci0_req = (nfapi_hi_dci0_request_t*)malloc(sizeof(nfapi_hi_dci0_request_t)); - UE_mac_inst[Mod_id].hi_dci0_req->sfn_sf = req->sfn_sf; - UE_mac_inst[Mod_id].hi_dci0_req->vendor_extension = req->vendor_extension; + hi_dci0_req->sfn_sf = req->sfn_sf; + hi_dci0_req->vendor_extension = req->vendor_extension; - UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.number_of_dci = req->hi_dci0_request_body.number_of_dci; - UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.number_of_hi = req->hi_dci0_request_body.number_of_hi; - UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.sfnsf = req->hi_dci0_request_body.sfnsf; + hi_dci0_req->hi_dci0_request_body.number_of_dci = req->hi_dci0_request_body.number_of_dci; + hi_dci0_req->hi_dci0_request_body.number_of_hi = req->hi_dci0_request_body.number_of_hi; + hi_dci0_req->hi_dci0_request_body.sfnsf = req->hi_dci0_request_body.sfnsf; //UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.tl = req->hi_dci0_request_body.tl; - UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.tl.tag = req->hi_dci0_request_body.tl.tag; - UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.tl.length = req->hi_dci0_request_body.tl.length; + hi_dci0_req->hi_dci0_request_body.tl.tag = req->hi_dci0_request_body.tl.tag; + hi_dci0_req->hi_dci0_request_body.tl.length = req->hi_dci0_request_body.tl.length; - int total_pdus = UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.number_of_dci + UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.number_of_hi; + int total_pdus = hi_dci0_req->hi_dci0_request_body.number_of_dci + hi_dci0_req->hi_dci0_request_body.number_of_hi; - UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*) malloc(total_pdus*sizeof(nfapi_hi_dci0_request_pdu_t)); + hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = (nfapi_hi_dci0_request_pdu_t*) malloc(total_pdus*sizeof(nfapi_hi_dci0_request_pdu_t)); for(int i=0; i<total_pdus; i++){ - UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list[i] = req->hi_dci0_request_body.hi_dci0_pdu_list[i]; + hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list[i] = req->hi_dci0_request_body.hi_dci0_pdu_list[i]; //LOG_I(MAC, "Original hi_dci0 req. type:%d, Copy type: %d \n",req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type, UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list[i].pdu_type); } diff --git a/openair2/PHY_INTERFACE/phy_stub_UE.h b/openair2/PHY_INTERFACE/phy_stub_UE.h index 81963a91dce0b6ace1856064eed0c8ee44678a1c..9865be3eebb2eab81fd10acde8b97bafe6fe2846 100644 --- a/openair2/PHY_INTERFACE/phy_stub_UE.h +++ b/openair2/PHY_INTERFACE/phy_stub_UE.h @@ -20,6 +20,12 @@ UL_IND_t *UL_INFO; nfapi_tx_request_pdu_t* tx_request_pdu_list; +// New +/// Panos: Pointers to config_request types. Used from nfapi callback functions. +nfapi_dl_config_request_t* dl_config_req; +nfapi_ul_config_request_t* ul_config_req; +nfapi_hi_dci0_request_t* hi_dci0_req; + int tx_req_num_elems; int next_ra_frame; diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 5806f6872704cb52d521b942f28c234ac1acab4d..2b91c0594d2046e3a20e511a4b0561a999a7080e 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -878,6 +878,12 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { struct rx_tx_thread_data *rtd = arg; UE_rxtx_proc_t *proc = rtd->proc; + // Initializations for nfapi-L2-emulator mode + dl_config_req = NULL; + ul_config_req = NULL; + hi_dci0_req = NULL; + tx_request_pdu_list = NULL; + PHY_VARS_UE *UE; //= rtd->UE; int ret; // double t_diff; @@ -934,26 +940,26 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/ - //Panos: Not sure whether we should put the memory allocation here. - //*** Note we should find the right place to call free(UL_INFO). + //Panos: Not sure whether we should put the memory allocation here and not sure how much memory + //we should allocate for each subframe cycle. UL_INFO = (UL_IND_t*)malloc(sizeof(UL_IND_t)); UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = (nfapi_rx_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_rx_indication_pdu_t)); UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0; - UL_INFO->rx_ind.header.message_id = 3225; + //UL_INFO->rx_ind.header.message_id = 3225; UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = (nfapi_crc_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_crc_indication_pdu_t)); UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0; - UL_INFO->crc_ind.header.message_id = 3225; + //UL_INFO->crc_ind.header.message_id = 3225; UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = (nfapi_harq_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_harq_indication_pdu_t)); UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0; - UL_INFO->harq_ind.header.message_id = 3225; + //UL_INFO->harq_ind.header.message_id = 3225; UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = (nfapi_sr_indication_pdu_t*)malloc(NB_UE_INST*sizeof(nfapi_sr_indication_pdu_t)); UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; - UL_INFO->sr_ind.header.message_id = 3225; + //UL_INFO->sr_ind.header.message_id = 3225; @@ -986,27 +992,16 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { phy_procedures_UE_SL_RX(UE,proc); + if (dl_config_req!=NULL && tx_request_pdu_list!=NULL){ + //if(dl_config_req!= NULL) { + dl_config_req_UE_MAC(dl_config_req, Mod_id); - - if(UE_mac_inst[Mod_id].dl_config_req!= NULL) { - - dl_config_req_UE_MAC(UE_mac_inst[Mod_id].dl_config_req, Mod_id); } - if (UE_mac_inst[Mod_id].hi_dci0_req!=NULL && UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){ - hi_dci0_req_UE_MAC(UE_mac_inst[Mod_id].hi_dci0_req, Mod_id); - free(UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); - UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; - - free(UE_mac_inst[Mod_id].hi_dci0_req); - UE_mac_inst[Mod_id].hi_dci0_req = NULL; + if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){ + hi_dci0_req_UE_MAC(hi_dci0_req, Mod_id); } - else if(UE_mac_inst[Mod_id].hi_dci0_req!=NULL){ - free(UE_mac_inst[Mod_id].hi_dci0_req); - UE_mac_inst[Mod_id].hi_dci0_req = NULL; - } - if(nfapi_mode!=3) phy_procedures_UE_SL_TX(UE,proc); @@ -1084,19 +1079,8 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { // Panos: 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(UE_mac_inst[Mod_id].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(UE_mac_inst[Mod_id].ul_config_req, timer_frame, timer_subframe, Mod_id); - if(UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ - free(UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list); - UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; - } - free(UE_mac_inst[Mod_id].ul_config_req); - UE_mac_inst[Mod_id].ul_config_req = NULL; - - } - else if(UE_mac_inst[Mod_id].ul_config_req!=NULL){ - free(UE_mac_inst[Mod_id].ul_config_req); - UE_mac_inst[Mod_id].ul_config_req = NULL; + 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, Mod_id); } } @@ -1105,11 +1089,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { } //for (Mod_id=0; Mod_id<NB_UE_INST; Mod_id++) - if(tx_request_pdu_list!=NULL){ - free(tx_request_pdu_list); - tx_request_pdu_list = NULL; - } - if (UL_INFO->crc_ind.crc_indication_body.number_of_crcs>0) { @@ -1164,6 +1143,40 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) { free(UL_INFO); UL_INFO = NULL; + // De-allocate memory of nfapi requests copies before next subframe round + if(dl_config_req!=NULL){ + if(dl_config_req->vendor_extension) + free(dl_config_req->vendor_extension); + if(dl_config_req->dl_config_request_body.dl_config_pdu_list!=NULL){ + free(dl_config_req->dl_config_request_body.dl_config_pdu_list); + dl_config_req->dl_config_request_body.dl_config_pdu_list = NULL; + } + free(dl_config_req); + dl_config_req = NULL; + } + if(tx_request_pdu_list!=NULL){ + free(tx_request_pdu_list); + tx_request_pdu_list = NULL; + } + if(ul_config_req!=NULL){ + if(ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ + free(ul_config_req->ul_config_request_body.ul_config_pdu_list); + ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; + } + free(ul_config_req); + ul_config_req = NULL; + } + + if(hi_dci0_req!=NULL){ + if(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){ + free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); + hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; + } + free(hi_dci0_req); + hi_dci0_req = NULL; + } + + } // thread finished @@ -1263,26 +1276,26 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { oai_subframe_ind(timer_frame, timer_subframe); - if(UE_mac_inst[Mod_id].dl_config_req!= NULL) { + if(dl_config_req!= NULL) { - dl_config_req_UE_MAC(UE_mac_inst[Mod_id].dl_config_req, Mod_id); + dl_config_req_UE_MAC(dl_config_req, Mod_id); } //if(UE_mac_inst[Mod_id].hi_dci0_req!= NULL){ - if (UE_mac_inst[Mod_id].hi_dci0_req!=NULL && UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){ + if (hi_dci0_req!=NULL && hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){ 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, Mod_id); + hi_dci0_req_UE_MAC(hi_dci0_req, Mod_id); //if(UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list!=NULL){ - free(UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); - UE_mac_inst[Mod_id].hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; + free(hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list); + hi_dci0_req->hi_dci0_request_body.hi_dci0_pdu_list = NULL; //} - free(UE_mac_inst[Mod_id].hi_dci0_req); - UE_mac_inst[Mod_id].hi_dci0_req = NULL; + free(hi_dci0_req); + hi_dci0_req = NULL; } - else if(UE_mac_inst[Mod_id].hi_dci0_req!=NULL){ - free(UE_mac_inst[Mod_id].hi_dci0_req); - UE_mac_inst[Mod_id].hi_dci0_req = NULL; + else if(hi_dci0_req!=NULL){ + free(hi_dci0_req); + hi_dci0_req = NULL; } if (nfapi_mode != 3) @@ -1302,7 +1315,7 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { proc->subframe_tx, subframe_select(&UE->frame_parms,proc->subframe_tx), 0, - 0/*FIXME CC_id*/); + 0); if ( ret != CONNECTION_OK) { char *txt; switch (ret) { @@ -1352,19 +1365,19 @@ static void *UE_phy_stub_thread_rxn_txnp4(void *arg) { // Panos: 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(UE_mac_inst[Mod_id].ul_config_req!= NULL && UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ + if(ul_config_req!= NULL && ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ //LOG_I(MAC, "UE_phy_stub_thread_rxn_txnp4 ul_config_req is not NULL \n"); - ul_config_req_UE_MAC(UE_mac_inst[Mod_id].ul_config_req, timer_frame, timer_subframe, Mod_id); - if(UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ - free(UE_mac_inst[Mod_id].ul_config_req->ul_config_request_body.ul_config_pdu_list); - 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, Mod_id); + if(ul_config_req->ul_config_request_body.ul_config_pdu_list != NULL){ + free(ul_config_req->ul_config_request_body.ul_config_pdu_list); + ul_config_req->ul_config_request_body.ul_config_pdu_list = NULL; } - free(UE_mac_inst[Mod_id].ul_config_req); - UE_mac_inst[Mod_id].ul_config_req = NULL; + free(ul_config_req); + ul_config_req = NULL; } - else if(UE_mac_inst[Mod_id].ul_config_req!=NULL){ - free(UE_mac_inst[Mod_id].ul_config_req); - UE_mac_inst[Mod_id].ul_config_req = NULL; + else if(ul_config_req!=NULL){ + free(ul_config_req); + ul_config_req = NULL; } }