Commit b57a4049 authored by Laurent Thomas's avatar Laurent Thomas

fix ocp-enb memory init

parent f20d2804
......@@ -81,16 +81,16 @@ int otg_enabled;
uint64_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
int split73;
char * split73_config;
char *split73_config;
int split73;
AGENT_RRC_xface *agent_rrc_xface[NUM_MAX_ENB]= {0};
AGENT_MAC_xface *agent_mac_xface[NUM_MAX_ENB]= {0};
void flexran_agent_slice_update(mid_t module_idP) {
}
int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p){
int proto_agent_start(mod_id_t mod_id, const cudu_params_t *p) {
return 0;
}
void proto_agent_stop(mod_id_t mod_id){
void proto_agent_stop(mod_id_t mod_id) {
}
static void *ru_thread( void *param );
......@@ -111,7 +111,6 @@ void exit_function(const char *file, const char *function, const int line, const
close_log_mem();
oai_exit = 1;
sleep(1); //allow lte-softmodem threads to exit first
exit(1);
}
......@@ -147,9 +146,11 @@ void init_RU_proc(RU_t *ru) {
case SPLIT73_CU:
threadCreate(&t, cu_fs6, (void *)ru, "MainCu", -1, OAI_PRIORITY_RT_MAX);
break;
case SPLIT73_DU:
threadCreate(&t, du_fs6, (void *)ru, "MainDuRx", -1, OAI_PRIORITY_RT_MAX);
break;
default:
threadCreate(&t, ru_thread, (void *)ru, "MainRu", -1, OAI_PRIORITY_RT_MAX);
}
......@@ -160,7 +161,7 @@ void init_transport(PHY_VARS_eNB *eNB) {
LTE_DL_FRAME_PARMS *fp = &eNB->frame_parms;
LOG_I(PHY, "Initialise transport\n");
for (int i=0; i<NUMBER_OF_UE_MAX; i++) {
for (int i=0; i<NUMBER_OF_DLSCH_MAX; i++) {
LOG_D(PHY,"Allocating Transport Channel Buffers for DLSCH, UE %d\n",i);
for (int j=0; j<2; j++) {
......@@ -169,7 +170,9 @@ void init_transport(PHY_VARS_eNB *eNB) {
eNB->dlsch[i][j]->rnti=0;
LOG_D(PHY,"dlsch[%d][%d] => %p rnti:%d\n",i,j,eNB->dlsch[i][j], eNB->dlsch[i][j]->rnti);
}
}
for (int i=0; i<NUMBER_OF_ULSCH_MAX; i++) {
LOG_D(PHY,"Allocating Transport Channel Buffer for ULSCH, UE %d\n",i);
AssertFatal((eNB->ulsch[1+i] = new_eNB_ulsch(MAX_TURBO_ITERATIONS,fp->N_RB_UL, 0)) != NULL,
"Can't get eNB ulsch structures\n");
......@@ -197,6 +200,9 @@ void init_transport(PHY_VARS_eNB *eNB) {
eNB->FULL_MUMIMO_transmissions = 0;
eNB->check_for_SUMIMO_transmissions = 0;
fp->pucch_config_common.deltaPUCCH_Shift = 1;
if (eNB->use_DTX == 0)
fill_subframe_mask(eNB);
}
void init_eNB_afterRU(void) {
......@@ -227,20 +233,18 @@ void init_eNB_afterRU(void) {
for (int ce_level=0; ce_level<4; ce_level++)
eNB->prach_vars_br.rxsigF[ce_level][aa] = eNB->RU_list[ru_id]->prach_rxsigF_br[ce_level][i];
}
}
AssertFatal( eNB->frame_parms.nb_antennas_rx > 0 && eNB->frame_parms.nb_antennas_rx < 5, "");
AssertFatal( eNB->frame_parms.nb_antennas_tx > 0 && eNB->frame_parms.nb_antennas_rx < 5, "");
phy_init_lte_eNB(eNB,0,0);
// need to copy rxdataF after L1 variables are allocated
for (int inst=0; inst<RC.nb_inst; inst++) {
for (int CC_id=0; CC_id<RC.nb_CC[inst]; CC_id++) {
PHY_VARS_eNB *eNB = RC.eNB[inst][CC_id];
for (int ru_id=0,aa=0; ru_id<eNB->num_RU; ru_id++) {
for (int i=0; i<eNB->RU_list[ru_id]->nb_rx; aa++,i++)
eNB->common_vars.rxdataF[aa] = eNB->RU_list[ru_id]->common.rxdataF[i];
......@@ -346,7 +350,8 @@ void fill_rf_config(RU_t *ru, char *rf_config_file) {
cfg->samples_per_frame = 19200;
cfg->tx_bw = 1.5e6;
cfg->rx_bw = 1.5e6;
} else AssertFatal(1==0,"Unknown N_RB_DL %d\n",fp->N_RB_DL);
} else
AssertFatal(1==0,"Unknown N_RB_DL %d\n",fp->N_RB_DL);
if (fp->frame_type==TDD)
cfg->duplex_mode = duplex_mode_TDD;
......@@ -467,7 +472,8 @@ void ocp_rx_prach(PHY_VARS_eNB *eNB,
((prach_mask&(1<<(i+1))) > 0)) { // check that prach CE level is active now
// if first reception in group of repetitions store frame for later (in RA-RNTI for Msg2)
if (eNB->prach_vars_br.repetition_number[i]==0) eNB->prach_vars_br.first_frame[i]=proc->frame_prach_br;
if (eNB->prach_vars_br.repetition_number[i]==0)
eNB->prach_vars_br.first_frame[i]=proc->frame_prach_br;
// increment repetition number
eNB->prach_vars_br.repetition_number[i]++;
......@@ -770,7 +776,8 @@ static void *ru_thread( void *param ) {
// Start RF device if any
if (ru->rfdevice.trx_start_func(&ru->rfdevice) != 0)
LOG_E(HW,"Could not start the RF device\n");
else LOG_I(PHY,"RU %d rf device ready\n",ru->idx);
else
LOG_I(PHY,"RU %d rf device ready\n",ru->idx);
// This is a forever while loop, it loops over subframes which are scheduled by incoming samples from HW devices
while (!oai_exit) {
......@@ -830,7 +837,6 @@ void ocp_init_RU(RU_t *ru, char *rf_config_file, int send_dmrssync) {
RC.eNB[i][CC_id]->num_RU=0;
LOG_D(PHY,"Process RUs RC.nb_RU:%d\n",RC.nb_RU);
ru->rf_config_file = rf_config_file;
ru->idx = 0;
ru->ts_offset = 0;
......@@ -884,7 +890,7 @@ void stop_RU(int nb_ru) {
/* --------------------------------------------------------*/
/* from here function to use configuration module */
static int DEFBFW[] = {0x00007fff};
void ocpRCconfig_RU(RU_t* ru) {
void ocpRCconfig_RU(RU_t *ru) {
paramdef_t RUParams[] = RUPARAMS_DESC;
paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0};
config_getlist( &RUParamList,RUParams,sizeof(RUParams)/sizeof(paramdef_t), NULL);
......@@ -963,7 +969,6 @@ void ocpRCconfig_RU(RU_t* ru) {
ru->nb_rx = *(vals[RU_NB_RX_IDX].uptr);
ru->att_tx = *(vals[RU_ATT_TX_IDX].uptr);
ru->att_rx = *(vals[RU_ATT_RX_IDX].uptr);
return;
}
......@@ -1077,7 +1082,6 @@ void terminate_task(module_id_t mod_id, task_id_t from, task_id_t to) {
int stop_L1L2(module_id_t enb_id) {
LOG_W(ENB_APP, "stopping lte-softmodem\n");
/* these tasks need to pick up new configuration */
terminate_task(enb_id, TASK_ENB_APP, TASK_RRC_ENB);
oai_exit = 1;
......@@ -1108,11 +1112,9 @@ int restart_L1L2(module_id_t enb_id) {
pthread_mutex_lock(&sync_mutex);
sync_var = -1;
pthread_mutex_unlock(&sync_mutex);
/* copy the changed frame parameters to the RU */
/* TODO this should be done for all RUs associated to this eNB */
memcpy(&ru->frame_parms, &RC.eNB[enb_id][0]->frame_parms, sizeof(LTE_DL_FRAME_PARMS));
/* reset the list of connected UEs in the MAC, since in this process with
* loose all UEs (have to reconnect) */
init_UE_info(&RC.mac[enb_id]->UE_info);
......@@ -1177,7 +1179,6 @@ int main ( int argc, char **argv ) {
// some initialization is necessary and init_ru_vnf do this.
RU_t ru;
/* We need to read RU configuration before FlexRAN starts so it knows what
* splits to report. Actual RU start comes later. */
if ( NFAPI_MODE != NFAPI_MODE_VNF) {
......@@ -1188,9 +1189,10 @@ int main ( int argc, char **argv ) {
}
if ( strlen(get_softmodem_params()->split73) > 0 ) {
char tmp[1024]={0};
char tmp[1024]= {0};
strncpy(tmp,get_softmodem_params()->split73, 1023);
tmp[2]=0;
if ( strncasecmp(tmp,"cu", 2)==0 )
split73=SPLIT73_CU;
else if ( strncasecmp(tmp,"du", 2)==0 )
......@@ -1283,17 +1285,14 @@ int main ( int argc, char **argv ) {
printf("About to Init RU threads RC.nb_RU:%d\n", RC.nb_RU);
if (RC.nb_RU >0 && NFAPI_MODE!=NFAPI_MODE_VNF) {
printf("Initializing RU threads\n");
ocp_init_RU(&ru,
get_softmodem_params()->rf_config_file,
get_softmodem_params()->send_dmrs_sync);
ru.rf_map.card=0;
ru.rf_map.chain=CC_id+(get_softmodem_params()->chain_offset);
init_RU_proc(&ru);
config_sync_var=0;
if (NFAPI_MODE==NFAPI_MODE_PNF) { // PNF
......@@ -1364,7 +1363,6 @@ int main ( int argc, char **argv ) {
pthread_cond_destroy(&nfapi_sync_cond);
pthread_mutex_destroy(&nfapi_sync_mutex);
pthread_mutex_destroy(&ue_pf_po_mutex);
}
terminate_opt();
......
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