Commit 7b3615de authored by laurent's avatar laurent

fix bugs

parent bc53a9af
all: measurement_display thread-pool-test all: measurement_display thread-pool-test
measurement_display: measurement_display.c thread-pool.h measurement_display: measurement_display.c thread-pool.h
gcc measurement_display.c -I /data/openairinterface5g.nr/common/utils/ -I. /data/openairinterface5g.nr/common/utils/backtrace.c -lpthread -D TEST_THREAD_POOL -I../LOG -I../../utils/T -o measurement_display gcc measurement_display.c -I ${OPENAIR_DIR}/ -I ${OPENAIR_DIR}/common/utils/ -I. ${OPENAIR_DIR}/common/utils/backtrace.c -lpthread -D TEST_THREAD_POOL -I../LOG -I../../utils/T -o measurement_display
thread-pool-test: thread-pool.c thread-pool.h thread-pool-test: thread-pool.c thread-pool.h
gcc -g thread-pool.c -I /data/openairinterface5g.nr/common/utils/ -I. /data/openairinterface5g.nr/common/utils/backtrace.c -lpthread -D TEST_THREAD_POOL -I../LOG -I../../utils/T -o thread-pool-test gcc -g thread-pool.c -I ${OPENAIR_DIR}/ -I ${OPENAIR_DIR}/common/utils/ -I. ${OPENAIR_DIR}/common/utils/backtrace.c -I ${OPENAIR_DIR}/openair2/COMMON ${OPENAIR_DIR}/common/utils/LOG/log.c ${OPENAIR_DIR}/common/config/config_userapi.c ${OPENAIR_DIR}/common/config/config_load_configmodule.c ${OPENAIR_DIR}/common/config/config_cmdline.c -lpthread -ldl -D TEST_THREAD_POOL -I../LOG -I../../utils/T -o thread-pool-test
...@@ -151,6 +151,9 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { ...@@ -151,6 +151,9 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
#ifdef TEST_THREAD_POOL #ifdef TEST_THREAD_POOL
void exit_function(const char *file, const char *function, const int line, const char *s) {
}
struct testData { struct testData {
int id; int id;
char txt[30]; char txt[30];
......
...@@ -530,6 +530,7 @@ int computeSamplesShift(PHY_VARS_NR_UE *UE) { ...@@ -530,6 +530,7 @@ int computeSamplesShift(PHY_VARS_NR_UE *UE) {
//LOG_I(PHY,"!!!adjusting +1 samples!!!\n"); //LOG_I(PHY,"!!!adjusting +1 samples!!!\n");
return 1; return 1;
} }
return 0; return 0;
} }
...@@ -605,6 +606,10 @@ void *UE_thread(void *arg) { ...@@ -605,6 +606,10 @@ void *UE_thread(void *arg) {
decoded_frame_rx=proc->decoded_frame_rx; decoded_frame_rx=proc->decoded_frame_rx;
// we do ++ first in the regular processing, so it will be 0; // we do ++ first in the regular processing, so it will be 0;
absolute_slot=decoded_frame_rx*nb_slot_frame + nb_slot_frame -1; absolute_slot=decoded_frame_rx*nb_slot_frame + nb_slot_frame -1;
while (tryPullTpool(&nf, Tpool) != NULL) {
};
continue; continue;
} }
...@@ -683,20 +688,6 @@ void *UE_thread(void *arg) { ...@@ -683,20 +688,6 @@ void *UE_thread(void *arg) {
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0; UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0;
notifiedFIFO_elt_t *res; notifiedFIFO_elt_t *res;
if (getenv("RFSIMULATOR")) {
// FixMe: Wait previous thread is done, because race conditions seems too bad
// in case of actual RF board, the overlap between threads mitigate the issue
// We must receive one message, that proves the slot processing is done
while ((res=tryPullTpool(&nf, Tpool)) == NULL)
usleep(200);
nbSlotProcessing--;
processingData_t *tmp=(processingData_t *)res->msgData;
if (tmp->proc.decoded_frame_rx != -1)
decoded_frame_rx=tmp->proc.decoded_frame_rx;
}
while (nbSlotProcessing >= RX_NB_TH ) { while (nbSlotProcessing >= RX_NB_TH ) {
if ( (res=tryPullTpool(&nf, Tpool)) != NULL ) { if ( (res=tryPullTpool(&nf, Tpool)) != NULL ) {
nbSlotProcessing--; nbSlotProcessing--;
...@@ -705,6 +696,7 @@ void *UE_thread(void *arg) { ...@@ -705,6 +696,7 @@ void *UE_thread(void *arg) {
if (tmp->proc.decoded_frame_rx != -1) if (tmp->proc.decoded_frame_rx != -1)
decoded_frame_rx=tmp->proc.decoded_frame_rx; decoded_frame_rx=tmp->proc.decoded_frame_rx;
} }
usleep(200); usleep(200);
} }
...@@ -712,8 +704,21 @@ void *UE_thread(void *arg) { ...@@ -712,8 +704,21 @@ void *UE_thread(void *arg) {
((decoded_frame_rx+1) % MAX_FRAME_NUMBER) != proc->frame_rx ) ((decoded_frame_rx+1) % MAX_FRAME_NUMBER) != proc->frame_rx )
LOG_D(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n", LOG_D(PHY,"Decoded frame index (%d) is not compatible with current context (%d), UE should go back to synch mode\n",
decoded_frame_rx, proc->frame_rx); decoded_frame_rx, proc->frame_rx);
nbSlotProcessing++; nbSlotProcessing++;
processingMsg[thread_idx]->key=slot_nr;
pushTpool(Tpool, processingMsg[thread_idx]); pushTpool(Tpool, processingMsg[thread_idx]);
if (getenv("RFSIMULATOR")) {
// FixMe: Wait previous thread is done, because race conditions seems too bad
// in case of actual RF board, the overlap between threads mitigate the issue
// We must receive one message, that proves the slot processing is done
res=pullTpool(&nf, Tpool);
nbSlotProcessing--;
processingData_t *tmp=(processingData_t *)res->msgData;
if (tmp->proc.decoded_frame_rx != -1)
decoded_frame_rx=tmp->proc.decoded_frame_rx;
}
} // while !oai_exit } // while !oai_exit
return NULL; return NULL;
...@@ -739,20 +744,17 @@ void init_UE(int nb_inst) { ...@@ -739,20 +744,17 @@ void init_UE(int nb_inst) {
nr_l2_init_ue(); nr_l2_init_ue();
mac_inst = get_mac_inst(inst); mac_inst = get_mac_inst(inst);
mac_inst->if_module = UE->if_inst; mac_inst->if_module = UE->if_inst;
// Initial bandwidth part configuration -- full carrier bandwidth // Initial bandwidth part configuration -- full carrier bandwidth
mac_inst->initial_bwp_dl.bwp_id = 0; mac_inst->initial_bwp_dl.bwp_id = 0;
mac_inst->initial_bwp_dl.location = 0; mac_inst->initial_bwp_dl.location = 0;
mac_inst->initial_bwp_dl.scs = UE->frame_parms.subcarrier_spacing; mac_inst->initial_bwp_dl.scs = UE->frame_parms.subcarrier_spacing;
mac_inst->initial_bwp_dl.N_RB = UE->frame_parms.N_RB_DL; mac_inst->initial_bwp_dl.N_RB = UE->frame_parms.N_RB_DL;
mac_inst->initial_bwp_dl.cyclic_prefix = UE->frame_parms.Ncp; mac_inst->initial_bwp_dl.cyclic_prefix = UE->frame_parms.Ncp;
mac_inst->initial_bwp_ul.bwp_id = 0; mac_inst->initial_bwp_ul.bwp_id = 0;
mac_inst->initial_bwp_ul.location = 0; mac_inst->initial_bwp_ul.location = 0;
mac_inst->initial_bwp_ul.scs = UE->frame_parms.subcarrier_spacing; mac_inst->initial_bwp_ul.scs = UE->frame_parms.subcarrier_spacing;
mac_inst->initial_bwp_ul.N_RB = UE->frame_parms.N_RB_UL; mac_inst->initial_bwp_ul.N_RB = UE->frame_parms.N_RB_UL;
mac_inst->initial_bwp_ul.cyclic_prefix = UE->frame_parms.Ncp; mac_inst->initial_bwp_ul.cyclic_prefix = UE->frame_parms.Ncp;
LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]); LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
AssertFatal(0 == pthread_create(&threads[inst], AssertFatal(0 == pthread_create(&threads[inst],
&attr, &attr,
......
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