Commit c321f9b5 authored by Robert Schmidt's avatar Robert Schmidt

Make UE mem alloc for UL_INFO only once in PHY stub mode

parent 5f851d45
...@@ -992,6 +992,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -992,6 +992,19 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
phy_stub_ticking->num_single_thread[ue_thread_id] = -1; phy_stub_ticking->num_single_thread[ue_thread_id] = -1;
UE = rtd->UE; UE = rtd->UE;
UL_INFO = (UL_IND_t *)malloc(sizeof(UL_IND_t));
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_rx_indication_pdu_t));
UL_INFO->rx_ind.rx_indication_body.number_of_pdus = 0;
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_crc_indication_pdu_t));
UL_INFO->crc_ind.crc_indication_body.number_of_crcs = 0;
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_harq_indication_pdu_t));
UL_INFO->harq_ind.harq_indication_body.number_of_harqs = 0;
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_sr_indication_pdu_t));
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_cqi_indication_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = calloc(NB_UE_INST, sizeof(nfapi_cqi_indication_raw_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
if(ue_thread_id == 0) { if(ue_thread_id == 0) {
phy_stub_ticking->ticking_var = -1; phy_stub_ticking->ticking_var = -1;
proc->subframe_rx=proc->sub_frame_start; proc->subframe_rx=proc->sub_frame_start;
...@@ -1064,20 +1077,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1064,20 +1077,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
initRefTimes(t3); initRefTimes(t3);
pickTime(current); pickTime(current);
updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/ updateTimes(proc->gotIQs, &t2, 10000, "Delay to wake up UE_Thread_Rx (case 2)");*/
// 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->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->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->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->cqi_ind.cqi_indication_body.cqi_pdu_list = (nfapi_cqi_indication_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = (nfapi_cqi_indication_raw_pdu_t *)malloc(NB_UE_INST*sizeof(nfapi_cqi_indication_raw_pdu_t));
UL_INFO->cqi_ind.cqi_indication_body.number_of_cqis = 0;
if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) { if (pthread_mutex_lock(&phy_stub_ticking->mutex_single_thread) != 0) {
LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id); LOG_E( MAC, "[SCHED][UE] error locking mutex for ue_thread_id %d (mutex_single_thread)\n",ue_thread_id);
...@@ -1267,30 +1266,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1267,30 +1266,6 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0; UL_INFO->sr_ind.sr_indication_body.number_of_srs = 0;
} }
// Free UL_INFO messages
//if(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list != NULL){
free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list);
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL;
//}
//if(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list != NULL){
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list);
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
//}
//if(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list !=NULL){
free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list);
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL;
//}
//if(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list!=NULL){
free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list);
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL;
//}
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list);
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL;
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list);
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL;
free(UL_INFO);
UL_INFO = NULL;
// De-allocate memory of nfapi requests copies before next subframe round // De-allocate memory of nfapi requests copies before next subframe round
if(dl_config_req!=NULL) { if(dl_config_req!=NULL) {
if(dl_config_req->vendor_extension!=NULL) { if(dl_config_req->vendor_extension!=NULL) {
...@@ -1334,6 +1309,22 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) ...@@ -1334,6 +1309,22 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg)
} }
} }
// Free UL_INFO messages
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list);
UL_INFO->cqi_ind.cqi_indication_body.cqi_raw_pdu_list = NULL;
free(UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list);
UL_INFO->cqi_ind.cqi_indication_body.cqi_pdu_list = NULL;
free(UL_INFO->sr_ind.sr_indication_body.sr_pdu_list);
UL_INFO->sr_ind.sr_indication_body.sr_pdu_list = NULL;
free(UL_INFO->harq_ind.harq_indication_body.harq_pdu_list);
UL_INFO->harq_ind.harq_indication_body.harq_pdu_list = NULL;
free(UL_INFO->crc_ind.crc_indication_body.crc_pdu_list);
UL_INFO->crc_ind.crc_indication_body.crc_pdu_list = NULL;
free(UL_INFO->rx_ind.rx_indication_body.rx_pdu_list);
UL_INFO->rx_ind.rx_indication_body.rx_pdu_list = NULL;
free(UL_INFO);
UL_INFO = NULL;
// thread finished // thread finished
free(arg); free(arg);
return &UE_thread_rxtx_retval; return &UE_thread_rxtx_retval;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment