code review comments

This commit is contained in:
laurent
2023-02-15 13:50:44 +01:00
parent 2a49e1fbdb
commit 38a908a4ec
11 changed files with 143 additions and 580 deletions
-10
View File
@@ -2337,16 +2337,6 @@ void init_RU_proc(RU_t *ru) {
if (opp_enabled == 1)
pthread_create(&ru->ru_stats_thread, NULL, ru_stats_thread, (void *)ru);
/*
if (ru->function == eNodeB_3GPP) {
usleep(10000);
LOG_I(PHY, "Signaling main thread that RU %d (is_slave %d,send_dmrs %d) is ready in state %s\n",ru->idx,ru->is_slave,ru->generate_dmrs_sync,ru_states[ru->state]);
AssertFatal((ret=pthread_mutex_lock(ru->ru_mutex))==0,"mutex_lock returns %d\n",ret);
*ru->ru_mask &= ~(1<<ru->idx);
pthread_cond_signal(ru->ru_cond);
AssertFatal((ret=pthread_mutex_unlock(ru->ru_mutex))==0,"mutex_unlock returns %d\n",ret);
}
*/
}
+8 -169
View File
@@ -790,9 +790,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
#endif
}
#if UE_TIMING_TRACE
start_meas(&UE->generic_stat);
#endif
start_UE_TIMING(UE->generic_stat);
if (UE->mac_enabled==1) {
int ret = ue_scheduler(UE->Mod_id,
@@ -810,9 +808,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
}
}
#if UE_TIMING_TRACE
stop_meas(&UE->generic_stat);
#endif
stop_UE_TIMING(UE->generic_stat);
// Prepare the future Tx data
@@ -1082,9 +1078,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) {
for (ue_index = 0; ue_index < ue_num; ue_index++) {
ue_Mod_id = ue_thread_id + NB_THREAD_INST * ue_index; // Always 0 in standalone pnf mode
UE = PHY_vars_UE_g[ue_Mod_id][0];
#if UE_TIMING_TRACE
start_meas(&UE->generic_stat);
#endif
start_UE_TIMING(UE->generic_stat);
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);
@@ -1105,10 +1099,7 @@ static void *UE_phy_stub_standalone_pnf_task(void *arg) {
}
}
#if UE_TIMING_TRACE
stop_meas(&UE->generic_stat);
#endif
stop_UE_TIMING(UE->generic_stat);
// Prepare the future Tx data
if ((subframe_select(&UE->frame_parms, NFAPI_SFNSF2SF(sfn_sf)) == SF_UL) ||
(UE->frame_parms.frame_type == FDD)) {
@@ -1499,9 +1490,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
phy_procedures_UE_SL_TX(UE,proc);
}
#if UE_TIMING_TRACE
start_meas(&UE->generic_stat);
#endif
start_UE_TIMING(UE->generic_stat);
if (UE->mac_enabled==1) {
ret = ue_scheduler(ue_Mod_id,
@@ -1519,10 +1508,7 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
}
}
#if UE_TIMING_TRACE
stop_meas(&UE->generic_stat);
#endif
stop_UE_TIMING(UE->generic_stat);
// Prepare the future Tx data
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
@@ -1699,160 +1685,13 @@ static void *UE_phy_stub_single_thread_rxn_txnp4(void *arg) {
* \returns a pointer to an int. The storage is not on the heap and must not be freed.
*/
static void *UE_phy_stub_thread_rxn_txnp4(void *arg) {
#if 0
thread_top_init("UE_phy_stub_thread_rxn_txnp4",1,870000L,1000000L,1000000L);
module_id_t Mod_id = 0;
static __thread int UE_thread_rxtx_retval;
struct rx_tx_thread_data *rtd = arg;
UE_rxtx_proc_t *proc = rtd->proc;
PHY_VARS_UE *UE = rtd->UE;
phy_stub_ticking->ticking_var = -1;
proc->subframe_rx=proc->sub_frame_start;
// CAREFUL HERE!
wait_sync("UE_phy_stub_thread_rxn_txnp4");
while (!oai_exit) {
if (pthread_mutex_lock(&phy_stub_ticking->mutex_ticking) != 0) {
LOG_E( MAC, "[SCHED][UE] error locking mutex for UE RXTX\n" );
exit_fun("nothing to add");
}
while (phy_stub_ticking->ticking_var < 0) {
// most of the time, the thread is waiting here
//pthread_cond_wait( &proc->cond_rxtx, &proc->mutex_rxtx )
LOG_D(MAC,"Waiting for ticking_var\n");
pthread_cond_wait( &phy_stub_ticking->cond_ticking, &phy_stub_ticking->mutex_ticking);
}
phy_stub_ticking->ticking_var--;
if (pthread_mutex_unlock(&phy_stub_ticking->mutex_ticking) != 0) {
LOG_E( MAC, "[SCHED][UE] error unlocking mutex for UE RXn_TXnp4\n" );
exit_fun("nothing to add");
}
proc->subframe_rx=timer_subframe;
proc->frame_rx = timer_frame;
proc->subframe_tx=(timer_subframe+4)%10;
proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0);
// Process Rx data for one sub-frame
lte_subframe_t sf_type = subframe_select( &UE->frame_parms, proc->subframe_rx);
if ((sf_type == SF_DL) ||
(UE->frame_parms.frame_type == FDD) ||
(sf_type == SF_S)) {
if (UE->frame_parms.frame_type == TDD) {
LOG_D(PHY, "TDD%d,%s: calling UE_RX\n",
UE->frame_parms.tdd_config,
(sf_type==SF_DL? "SF_DL" :
(sf_type==SF_UL? "SF_UL" :
(sf_type==SF_S ? "SF_S" : "UNKNOWN_SF_TYPE"))));
} else {
LOG_D(PHY, "%s,%s: calling UE_RX\n",
(UE->frame_parms.frame_type==FDD? "FDD":
(UE->frame_parms.frame_type==TDD? "TDD":"UNKNOWN_DUPLEX_MODE")),
(sf_type==SF_DL? "SF_DL" :
(sf_type==SF_UL? "SF_UL" :
(sf_type==SF_S ? "SF_S" : "UNKNOWN_SF_TYPE"))));
}
phy_procedures_UE_SL_RX(UE,proc);
oai_subframe_ind(timer_frame, timer_subframe);
if(dl_config_req!= NULL) {
AssertFatal(0, "dl_config_req_UE_MAC() not handled\n");
//dl_config_req_UE_MAC(dl_config_req, Mod_id);
}
//if(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) {
AssertFatal(0, "hi_dci0_req_UE_MAC() not handled\n");
//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(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;
} else if(hi_dci0_req!=NULL) {
free(hi_dci0_req);
hi_dci0_req = NULL;
}
if (NFAPI_MODE!=NFAPI_UE_STUB_PNF)
phy_procedures_UE_SL_TX(UE,proc);
}
#if UE_TIMING_TRACE
start_meas(&UE->generic_stat);
#endif
if (UE->mac_enabled==1) {
int ret = ue_scheduler(UE->Mod_id,
proc->frame_rx,
proc->subframe_rx,
proc->frame_tx,
proc->subframe_tx,
subframe_select(&UE->frame_parms,proc->subframe_tx),
0,
0);
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) );
}
#if UE_TIMING_TRACE
stop_meas(&UE->generic_stat);
#endif
// Prepare the future Tx data
if ((subframe_select( &UE->frame_parms, proc->subframe_tx) == SF_UL) ||
(UE->frame_parms.frame_type == FDD) )
if ((UE_mac_inst[Mod_id].UE_mode[0] == PRACH) ) {
// check if we have PRACH opportunity
if (is_prach_subframe(&UE->frame_parms,proc->frame_tx, proc->subframe_tx)) {
PRACH_RESOURCES_t *prach_resources = ue_get_rach(Mod_id, 0, proc->frame_tx, 0, proc->subframe_tx);
if(prach_resources!=NULL) {
fill_rach_indication_UE_MAC(Mod_id, proc->frame_tx,proc->subframe_tx, UL_INFO, prach_resources->ra_PreambleIndex, prach_resources->ra_RNTI);
Msg1_transmitted(Mod_id, 0, proc->frame_tx, 0);
UE_mac_inst[Mod_id].UE_mode[0] = RA_RESPONSE;
}
//ue_prach_procedures(ue,proc,eNB_id,abstraction_flag,mode);
}
} // mode is PRACH
// 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 && 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(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(ul_config_req);
ul_config_req = NULL;
} else if(ul_config_req!=NULL) {
free(ul_config_req);
ul_config_req = NULL;
}
}
#endif // disabled
static void *UE_phy_stub_thread_rxn_txnp4(void *arg)
{
// thread finished
free(arg);
return NULL; //return &UE_thread_rxtx_retval;
}
/*!
* \brief This is the main UE thread.
* This thread controls the other three UE threads: