Commit 6e1f1414 authored by Jerome Peraldi's avatar Jerome Peraldi

Merge branch 'private/bugz129492' into 'sqn/3GPP_TTCN_System_Simulator'

bug #129492 [L3 SIMU] follow up of bug 127412 better management of RAN RRC database

See merge request sequans/system/ttcn/openairinterface5g!43
parents 20544bec e6d3389d
......@@ -138,7 +138,8 @@ extern struct rrc_eNB_ue_context_s *get_first_ue_context(eNB_RRC_INST *rrc_insta
pthread_mutex_t rrc_release_freelist;
RRC_release_list_t rrc_release_info;
pthread_mutex_t lock_ue_freelist;
pthread_mutex_t lock_rrc_ttcn;
pthread_mutex_t lock_cell_si_config;
pthread_mutex_t cond_cell_si_config;
uint8_t ul_sqn,dl_sqn;
......@@ -6574,20 +6575,15 @@ char openair_rrc_eNB_configuration(
}
}
bool is_update_needed = false;
for (CC_id = 0; CC_id < RC.nb_CC[0]; CC_id++) {
if (RC.ss.CC_update_flag[CC_id]) {
is_update_needed = true;
if (RC.ss.rrc_sysinfo_value_tag_transition == false){
init_SI(&ctxt, CC_id, configuration);
RC.ss.CC_update_flag[CC_id] = 0;
}
pthread_mutex_lock(&lock_cell_si_config);
init_SI(&ctxt, CC_id, configuration);
RC.ss.CC_update_flag[CC_id] = 0;
pthread_cond_signal(&cond_cell_si_config);
pthread_mutex_unlock(&lock_cell_si_config);
}
}
if (RC.ss.mode >= SS_SOFTMODEM && is_update_needed == true){
//the mutex is there to notify TTCN SYS port that SIBxx have been processed
pthread_mutex_unlock(&lock_rrc_ttcn);
}
if(need_init) {
rrc_init_global_param();
......@@ -8606,7 +8602,8 @@ void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t *const ctxt_pP,
void rrc_enb_init(void) {
pthread_mutex_init(&lock_ue_freelist, NULL);
pthread_mutex_init(&rrc_release_freelist, NULL);
pthread_mutex_init(&lock_rrc_ttcn, NULL);
pthread_mutex_init(&lock_cell_si_config, NULL);
pthread_cond_init(&cond_cell_si_config, NULL);
memset(&rrc_release_info,0,sizeof(RRC_release_list_t));
}
......
......@@ -83,7 +83,6 @@ void init_ss_context(SS_Cell_Context_t SSCell_list[]){
memset(SSCell_list, 0, (sizeof(SS_Cell_Context_t) * 8));
memset(RC.ss.l1macind,0,sizeof(RC.ss.l1macind));
memset(RC.ss.CC_update_flag,0, (sizeof(RC.ss.CC_update_flag)));
RC.ss.rrc_sysinfo_value_tag_transition = false;
memset(RC.ss.CC_conf_flag,0, (sizeof(RC.ss.CC_conf_flag)));
for(int Cell_idx = 0; Cell_idx < 8; Cell_idx++){
SSCell_list[Cell_idx].eutra_cellId = -1;
......
......@@ -65,7 +65,8 @@ extern pthread_mutex_t sys_confirm_done_mutex;
extern int sys_confirm_done;
extern RAN_CONTEXT_t RC;
extern uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn);
extern pthread_mutex_t lock_rrc_ttcn;
extern pthread_mutex_t lock_cell_si_config;
extern pthread_mutex_t cond_cell_si_config;
#ifndef NR_RRC_VERSION
extern pthread_cond_t cell_config_done_cond;
......@@ -93,10 +94,23 @@ int proxy_send_port = 7776;
int proxy_recv_port = 7770;
bool reqCnfFlag_g = false;
static int cell_active_update_prohibition = 0;
// This is counting per cell, if 3 cells count can be in fact done 3 times
#define CELL_ACTIVE_UPDATE_PROHIBITION_COUNT 0
/*
* Function : wait_cell_si_config
* Description: Waiting for SI cond_cell_si_config signal
* from rrc_eNB, which indicate the cell system information
* configuration complete. After receiving the signal the SS
* ready to perform the next SystemRequest_Type_Cell request.
*/
static void wait_cell_si_config(int cell_index)
{
LOG_D(ENB_SS_SYS_TASK, "Waiting the SI configuration complete for cell: %d\n", cell_index);
pthread_mutex_lock(&lock_cell_si_config);
while (RC.ss.CC_update_flag[cell_index] == 1)
{
pthread_cond_wait(&cond_cell_si_config, &lock_cell_si_config);
}
pthread_mutex_unlock(&lock_cell_si_config);
}
void sys_handle_pdcch_order(struct RA_PDCCH_Order_Type *pdcchOrder);
......@@ -512,13 +526,6 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
}
RRC_CONFIGURATION_REQ(msg_p).schedulingInfo_count[cell_index] = count;
RRC_CONFIGURATION_REQ(msg_p).num_plmn[cell_index] = SIB1_CELL_ACCESS_REL_INFO.plmn_IdentityList.d;
if (RRC_CONFIGURATION_REQ(msg_p).systemInfoValueTag[cell_index] != SIDL_SIB1_VAL.c1.v.systemInformationBlockType1.systemInfoValueTag){
RC.ss.CC_update_flag[cell_index] = 1;
RC.ss.rrc_sysinfo_value_tag_transition = true;
LOG_I (ENB_SS_SYS_TASK,"SystemInfo value tag has been updated old value: %d, new value: %d\n",
RRC_CONFIGURATION_REQ(msg_p).systemInfoValueTag[cell_index],
SIDL_SIB1_VAL.c1.v.systemInformationBlockType1.systemInfoValueTag);
}
RRC_CONFIGURATION_REQ(msg_p).systemInfoValueTag[cell_index] = SIDL_SIB1_VAL.c1.v.systemInformationBlockType1.systemInfoValueTag;
RRC_CONFIGURATION_REQ(msg_p).num_plmn[cell_index] = SIB1_CELL_ACCESS_REL_INFO.plmn_IdentityList.d;
......@@ -837,10 +844,6 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
LOG_A(ENB_SS_SYS_TASK, "Sending Cell configuration to RRC from SYSTEM_CTRL_REQ \n");
itti_send_msg_to_task(TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
if (RC.ss.CC_update_flag[cell_index] == 1){
pthread_mutex_lock(&lock_rrc_ttcn);
//RC.ss.CC_update_flag[cell_index] = 0;
}
/* Active Config for ULGrant Params */
bool destTaskMAC = false;
for (int enb_id = 0; enb_id < RC.nb_inst; enb_id++)
......@@ -1056,8 +1059,6 @@ int sys_handle_cell_config_req(struct SYSTEM_CTRL_REQ *req)
assert(req);
struct CellConfigRequest_Type *Cell=&(req->Request.v.Cell);
assert(Cell);
struct CellConfigInfo_Type *AddOrReconfigure = &(Cell->v.AddOrReconfigure);
assert(AddOrReconfigure);
switch (Cell->d)
{
......@@ -1076,11 +1077,7 @@ int sys_handle_cell_config_req(struct SYSTEM_CTRL_REQ *req)
{
//The flag is used to initilize the cell in the RRC layer during init_SI funciton
RC.ss.CC_conf_flag[cell_index] = 1;
if (AddOrReconfigure->Basic.v.BcchConfig.v.BcchInfo.v.SIB1.v.message.v.c1.v.systemInformationBlockType1.systemInfoValueTag == 0){
RC.ss.CC_update_flag[cell_index] = 1;
LOG_I (ENB_SS_SYS_TASK,"SYS task requests to update RRC configuration current cell:%d\n",cell_index);
}
RC.ss.CC_update_flag[cell_index] = 1;
returnState = SS_STATE_CELL_CONFIGURED;
//Increment nb_cc only from 2nd cell as the initilization is done for 1 CC
if (cell_index)
......@@ -1100,19 +1097,13 @@ int sys_handle_cell_config_req(struct SYSTEM_CTRL_REQ *req)
}
else
{
RC.ss.CC_update_flag[cell_index] = 1;
LOG_I (ENB_SS_SYS_TASK,"[SYS] CC-MGMT configured RC.nb_CC %d current updated CC_index %d RC.nb_mac_CC %d\n",
RC.nb_CC[0],cell_index,*RC.nb_mac_CC);
if (RC.ss.rrc_sysinfo_value_tag_transition == false){
RC.ss.CC_update_flag[cell_index] = 1;
} else{
LOG_D (ENB_SS_SYS_TASK,"[SYS] CC-MGMT Updating SI processing... , count: %d\n", cell_active_update_prohibition);
if (cell_active_update_prohibition >= CELL_ACTIVE_UPDATE_PROHIBITION_COUNT) {
RC.ss.rrc_sysinfo_value_tag_transition = false;
cell_active_update_prohibition = 0;
} else{
cell_active_update_prohibition ++;
}
}
}
if (status)
{
wait_cell_si_config(cell_index);
}
break;
case CellConfigRequest_Type_Release: /**TODO: NOT IMPLEMNTED */
......
......@@ -105,10 +105,6 @@ typedef struct ss_config_s {
ss_crnti_config_t ss_crnti[MAX_NUM_CCs];
RrcHOAsSecurityConfig_t HOASSecurityCOnfig;
uint8_t CC_update_flag[MAX_NUM_CCs];
//We have a race when SIB needs to be updated from TTCN with system_info_value_tag updated. We need to wait that update operated at TTCN/SS level before updating SIB
//there is clearly better to do Memory access@SS level (RRC configuration) is not protected at all causing bad behaviour sometimes
//SS code and interactions with RRC will be updated in better manner
bool rrc_sysinfo_value_tag_transition;
} ss_config_t;
/**
typedef enum {
......
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