Commit 738ca2d2 authored by mir's avatar mir

4G Simulator

parent e976c66b
......@@ -546,17 +546,21 @@ int main ( int argc, char **argv )
printf("Initializing eNB threads single_thread_flag:%d wait_for_sync:%d\n", get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync);
init_eNB(get_softmodem_params()->single_thread_flag,get_softmodem_params()->wait_for_sync);
}
#ifdef TASK_MANAGER_LTE
int const log_cores = get_nprocs_conf();
assert(log_cores > 0);
task_manager_t man = {0};
// Assuming: Physical cores = Logical cores / 2
init_task_manager(&man, log_cores);
#endif
for (int x=0; x < RC.nb_L1_inst; x++)
for (int CC_id=0; CC_id<RC.nb_L1_CC[x]; CC_id++) {
L1_rxtx_proc_t *L1proc= &RC.eNB[x][CC_id]->proc.L1_proc;
L1_rxtx_proc_t *L1proctx= &RC.eNB[x][CC_id]->proc.L1_proc_tx;
#ifdef TASK_MANAGER_LTE
int const log_cores = get_nprocs_conf();
assert(log_cores > 0);
// Assuming: Physical cores = Logical cores / 2
init_task_manager(&RC.eNB[x][CC_id]->proc.man, log_cores);
L1proc->man = &RC.eNB[x][CC_id]->proc.man;
L1proctx->man = &RC.eNB[x][CC_id]->proc.man;
L1proc->man = &man;
L1proctx->man = &man;
#else
L1proc->respDecode=(notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
// Most likely a bug. Do you want a thread pool per CC ?
......
......@@ -283,7 +283,7 @@ static void TPencode(void * arg) {
#ifdef TASK_MANAGER_LTE
assert(atomic_load(rdata->tasks_remaining) == 0);
atomic_store_explicit(rdata->tasks_remaining,1, memory_order_seq_cst);
atomic_store_explicit(rdata->tasks_remaining, 1, memory_order_seq_cst);
#endif
}
......@@ -384,7 +384,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
rdata->G=G;
#ifdef TASK_MANAGER_LTE
task_t t = {.func = TPencode, .args = rdata};
task_t t = {.func = TPencode, .args = rdata};
async_task_manager(proc->man, t);
#else
pushTpool(proc->threadPool, req);
......
......@@ -390,6 +390,10 @@ static int ulsch_decoding_data(PHY_VARS_eNB *eNB, L1_rxtx_proc_t *proc, int UE_i
r_offset+=E;
offset+=sz;
}
#ifdef TASK_MANAGER_LTE
trigger_all_task_manager(proc->man);
#endif
return(ret);
}
......
......@@ -419,10 +419,6 @@ typedef struct L1_proc_t_s {
/// for waking up tx procedure
RU_proc_t *ru_proc;
struct PHY_VARS_eNB_s *eNB;
#ifdef TASK_MANAGER_LTE
task_manager_t man;
#endif
} L1_proc_t;
......
......@@ -1418,10 +1418,11 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
}
} // for (i=0; i<NUMBER_OF_ULSCH_MAX; i++)
const bool decode = proc->nbDecode;
#ifdef TASK_MANAGER_LTE
if (proc->nbDecode) {
// Not needed, but won't hurt performance
trigger_all_task_manager(proc->man);
wait_spin_all_atomics_one(t_info.len, t_info.tasks_remaining);
for(int i = 0; i < t_info.len; ++i){
postDecode(proc, &arr[i]);
......@@ -1429,7 +1430,6 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
//printf("Decoding time %ld \n", time_now_ns() - t0);
}
#else
while (proc->nbDecode > 0) {
notifiedFIFO_elt_t *req=pullTpool(proc->respDecode, proc->threadPool);
if (req == NULL)
......@@ -1439,14 +1439,10 @@ void pusch_procedures(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc) {
merge_meas(&eNB->ulsch_turbo_decoding_stats, &ts);
delNotifiedFIFO_elt(req);
}
#endif
if (decode)
stop_meas(&eNB->ulsch_decoding_stats);
}
extern int oai_exit;
......
......@@ -589,6 +589,10 @@ int main(int argc, char **argv) {
nfapi_tx_request_t TX_req;
Sched_Rsp_t sched_resp;
int pa=dB0;
#ifdef TASK_MANAGER_LTE
task_manager_t man = {0};
#endif
cpu_freq_GHz = get_cpu_freq_GHz();
printf("Detected cpu_freq %f GHz\n",cpu_freq_GHz);
memset((void *)&sched_resp,0,sizeof(sched_resp));
......@@ -1256,14 +1260,15 @@ int main(int argc, char **argv) {
L1_rxtx_proc_t *proc_eNB = &eNB->proc.L1_proc;
proc_eNB->respDecode=(notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(proc_eNB->respDecode);
//#ifdef TASK_MANAGER
// int const log_cores = get_nprocs_conf();
// assert(log_cores > 0);
// init_task_manager(&proc_eNB->man, log_cores);
//#else
#ifdef TASK_MANAGER_LTE
int const log_cores = get_nprocs_conf();
assert(log_cores > 0);
init_task_manager(&man, log_cores);
proc_eNB->man = &man;
#else
proc_eNB->threadPool = (tpool_t *)malloc(sizeof(tpool_t));
initTpool("n", proc_eNB->threadPool, true);
//#endif
#endif
proc_eNB->frame_tx=0;
......
......@@ -363,6 +363,11 @@ int main(int argc, char **argv) {
static double maxDoppler = 0.0;
static int srs_flag = 0;
static int N_RB_DL=25,osf=1;
#ifdef TASK_MANAGER_LTE
task_manager_t man = {0};
#endif
//uint8_t cyclic_shift = 0;
static uint8_t beta_ACK=0,beta_RI=0,beta_CQI=2,cqi_size=11;
static uint8_t tdd_config=3,frame_type=FDD;
......@@ -788,14 +793,16 @@ int main(int argc, char **argv) {
proc_rxtx_ue->subframe_tx = proc_rxtx->subframe_rx;
proc_rxtx_ue->subframe_rx = (proc_rxtx->subframe_tx+6)%10;
//#ifdef TASK_MANAGER
// int const log_cores = get_nprocs_conf();
// assert(log_cores > 0);
// init_task_manager(&proc_rxtx->man, log_cores);
//#else
#ifdef TASK_MANAGER_LTE
int const log_cores = get_nprocs_conf();
assert(log_cores > 0);
init_task_manager(&man, log_cores);
proc_rxtx->man = &man;
#else
proc_rxtx->threadPool = (tpool_t *)malloc(sizeof(tpool_t));
initTpool("n", proc_rxtx->threadPool, true);
//#endif
#endif
proc_rxtx->respDecode=(notifiedFIFO_t*) malloc(sizeof(notifiedFIFO_t));
initNotifiedFIFO(proc_rxtx->respDecode);
......
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