Commit b44c83ef authored by Xu Bo's avatar Xu Bo

add remove ue info of pre_scd thread to freeList and for ru_thread to remove the UE in the freeList

parent 70da4b59
...@@ -958,6 +958,24 @@ typedef struct { ...@@ -958,6 +958,24 @@ typedef struct {
boolean_t active[NUMBER_OF_UE_MAX]; boolean_t active[NUMBER_OF_UE_MAX];
} UE_list_t; } UE_list_t;
#ifdef UE_EXPANSION
/*! \brief deleting control information*/
typedef struct {
///rnti of UE
rnti_t rnti;
///remove UE context flag
boolean_t removeContextFlg;
} UE_free_ctrl;
/*! \brief REMOVE UE list used by eNB to order UEs/CC for deleting*/
typedef struct {
/// deleting control info
UE_free_ctrl UE_free_ctrl[NUMBER_OF_UE_MAX+1];
int num_UEs;
int head_freelist; ///the head position of the delete list
int tail_freelist; ///the tail position of the delete list
} UE_free_list_t;
#endif
/*! \brief eNB common channels */ /*! \brief eNB common channels */
typedef struct { typedef struct {
int physCellId; int physCellId;
...@@ -1102,6 +1120,9 @@ typedef struct eNB_MAC_INST_s { ...@@ -1102,6 +1120,9 @@ typedef struct eNB_MAC_INST_s {
time_stats_t schedule_mch; time_stats_t schedule_mch;
/// processing time of eNB ULSCH reception /// processing time of eNB ULSCH reception
time_stats_t rx_ulsch_sdu; // include rlc_data_ind time_stats_t rx_ulsch_sdu; // include rlc_data_ind
#ifdef UE_EXPANSION
UE_free_list_t UE_free_list;
#endif
} eNB_MAC_INST; } eNB_MAC_INST;
/* /*
......
...@@ -470,4 +470,11 @@ void openair_rrc_top_init_ue( ...@@ -470,4 +470,11 @@ void openair_rrc_top_init_ue(
uint8_t HO_active uint8_t HO_active
); );
#ifdef UE_EXPANSION
pthread_mutex_t lock_ue_freelist;
void remove_UE_from_freelist(module_id_t mod_id, rnti_t rnti);
void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, boolean_t removeFlag);
void release_UE_in_freeList(module_id_t mod_id);
#endif
/** @}*/ /** @}*/
...@@ -372,6 +372,7 @@ rrc_rx_tx( ...@@ -372,6 +372,7 @@ rrc_rx_tx(
ue_context_p->ue_context.ue_release_timer_thres_rrc) { ue_context_p->ue_context.ue_release_timer_thres_rrc) {
LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti); LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti);
ue_to_be_removed = ue_context_p; ue_to_be_removed = ue_context_p;
ue_context_p->ue_context.ue_release_timer_rrc = 0;
break; break;
} }
} }
...@@ -395,6 +396,9 @@ rrc_rx_tx( ...@@ -395,6 +396,9 @@ rrc_rx_tx(
ue_context_p->ue_context.ue_release_timer_thres) { ue_context_p->ue_context.ue_release_timer_thres) {
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
ue_to_be_removed = ue_context_p; ue_to_be_removed = ue_context_p;
#ifdef UE_EXPANSION
ue_context_p->ue_context.ue_release_timer = 0;
#endif
break; break;
} }
} }
......
...@@ -780,11 +780,13 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* ...@@ -780,11 +780,13 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
(void)ue_module_id; (void)ue_module_id;
#endif #endif
rnti_t rnti = ue_context_pP->ue_context.rnti; rnti_t rnti = ue_context_pP->ue_context.rnti;
#ifndef UE_EXPANSION
int i, j , CC_id, pdu_number; int i, j , CC_id, pdu_number;
LTE_eNB_ULSCH_t *ulsch = NULL; LTE_eNB_ULSCH_t *ulsch = NULL;
nfapi_ul_config_request_body_t *ul_req_tmp = NULL; nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
PHY_VARS_eNB *eNB_PHY = NULL; PHY_VARS_eNB *eNB_PHY = NULL;
eNB_MAC_INST *eNB_MAC = RC.mac[enb_mod_idP]; eNB_MAC_INST *eNB_MAC = RC.mac[enb_mod_idP];
#endif
AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %x!", enb_mod_idP, NB_eNB_INST, rnti); AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %x!", enb_mod_idP, NB_eNB_INST, rnti);
/* ue_context_p = rrc_eNB_get_ue_context( /* ue_context_p = rrc_eNB_get_ue_context(
...@@ -813,6 +815,7 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* ...@@ -813,6 +815,7 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
oai_emulation.info.eNB_ue_module_id_to_rnti[enb_mod_idP][ue_module_id] = NOT_A_RNTI; oai_emulation.info.eNB_ue_module_id_to_rnti[enb_mod_idP][ue_module_id] = NOT_A_RNTI;
#endif #endif
#endif #endif
#ifndef UE_EXPANSION
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
eNB_PHY = RC.eNB[enb_mod_idP][CC_id]; eNB_PHY = RC.eNB[enb_mod_idP][CC_id];
for (i=0; i<NUMBER_OF_UE_MAX; i++) { for (i=0; i<NUMBER_OF_UE_MAX; i++) {
...@@ -848,9 +851,116 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* ...@@ -848,9 +851,116 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
&ctxt, &ctxt,
RC.rrc[enb_mod_idP], RC.rrc[enb_mod_idP],
(struct rrc_eNB_ue_context_s*) ue_context_pP); (struct rrc_eNB_ue_context_s*) ue_context_pP);
#else
// add UE info to freeList
LOG_I(RRC, "put UE %x into freeList\n", rnti);
put_UE_in_freelist(enb_mod_idP, rnti, 1);
#endif
} }
} }
#ifdef UE_EXPANSION
void remove_UE_from_freelist(module_id_t mod_id, rnti_t rnti)
{
eNB_MAC_INST *eNB_MAC = RC.mac[mod_id];
pthread_mutex_lock(&lock_ue_freelist);
UE_free_list_t *free_list = &eNB_MAC->UE_free_list;
free_list->UE_free_ctrl[free_list->head_freelist].rnti = 0;
free_list->head_freelist = (free_list->head_freelist + 1) % (NUMBER_OF_UE_MAX+1);
free_list->num_UEs--;
pthread_mutex_unlock(&lock_ue_freelist);
}
void put_UE_in_freelist(module_id_t mod_id, rnti_t rnti, boolean_t removeFlag)
{
UE_free_list_t *free_list = NULL;
eNB_MAC_INST *eNB_MAC = RC.mac[mod_id];
pthread_mutex_lock(&lock_ue_freelist);
free_list = &eNB_MAC->UE_free_list;
free_list->UE_free_ctrl[free_list->tail_freelist].rnti = rnti;
free_list->UE_free_ctrl[free_list->tail_freelist].removeContextFlg = removeFlag;
free_list->num_UEs++;
free_list->tail_freelist = (free_list->tail_freelist + 1) % (NUMBER_OF_UE_MAX+1);
pthread_mutex_unlock(&lock_ue_freelist);
}
void release_UE_in_freeList(module_id_t mod_id)
{
int i, j , CC_id, pdu_number;
protocol_ctxt_t ctxt;
LTE_eNB_ULSCH_t *ulsch = NULL;
nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
PHY_VARS_eNB *eNB_PHY = NULL;
struct rrc_eNB_ue_context_s *ue_context_pP = NULL;
eNB_MAC_INST *eNB_MAC = RC.mac[mod_id];
boolean_t remove_UEContext;
rnti_t rnti;
int head, tail, ue_num;
pthread_mutex_lock(&lock_ue_freelist);
head = eNB_MAC->UE_free_list.head_freelist;
tail = eNB_MAC->UE_free_list.tail_freelist;
if(head == tail){
pthread_mutex_unlock(&lock_ue_freelist);
return;
}
if(tail < head){
tail = head + eNB_MAC->UE_free_list.num_UEs;
}
pthread_mutex_unlock(&lock_ue_freelist);
for(ue_num = head; ue_num < tail; ue_num++){
ue_num = ue_num % (NUMBER_OF_UE_MAX+1);
rnti = eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].rnti;
if(rnti != 0){
remove_UEContext = eNB_MAC->UE_free_list.UE_free_ctrl[ue_num].removeContextFlg;
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, mod_id, ENB_FLAG_YES, rnti, 0, 0,mod_id);
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
eNB_PHY = RC.eNB[mod_id][CC_id];
for (i=0; i<=NUMBER_OF_UE_MAX; i++) {
ulsch = eNB_PHY->ulsch[i];
if((ulsch != NULL) && (ulsch->rnti == rnti)){
LOG_I(RRC, "clean_eNb_ulsch ulsch[%d] UE %x\n", i, rnti);
clean_eNb_ulsch(ulsch);
}
}
for(j = 0; j < 10; j++){
ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body;
if(ul_req_tmp){
pdu_number = ul_req_tmp->number_of_pdus;
for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){
if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti){
LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number);
if(pdu_index < pdu_number -1){
memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t));
}
ul_req_tmp->number_of_pdus--;
}
}
}
}
}
rrc_mac_remove_ue(mod_id,rnti);
rrc_rlc_remove_ue(&ctxt);
pdcp_remove_UE(&ctxt);
if(remove_UEContext){
ue_context_pP = rrc_eNB_get_ue_context(
RC.rrc[mod_id],rnti);
if(ue_context_pP){
rrc_eNB_remove_ue_context(&ctxt,RC.rrc[mod_id],
(struct rrc_eNB_ue_context_s*) ue_context_pP);
}
}
LOG_I(RRC, "[release_UE_in_freeList] remove UE %x from freeList\n", rnti);
remove_UE_from_freelist(mod_id, rnti);
}
}
}
#endif
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void void
rrc_eNB_process_RRCConnectionSetupComplete( rrc_eNB_process_RRCConnectionSetupComplete(
...@@ -5034,6 +5144,9 @@ rrc_enb_task( ...@@ -5034,6 +5144,9 @@ rrc_enb_task(
int CC_id; int CC_id;
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
#ifdef UE_EXPANSION
pthread_mutex_init(&lock_ue_freelist, NULL);
#endif
itti_mark_task_ready(TASK_RRC_ENB); itti_mark_task_ready(TASK_RRC_ENB);
LOG_I(RRC,"Entering main loop of RRC message task\n"); LOG_I(RRC,"Entering main loop of RRC message task\n");
while (1) { while (1) {
......
...@@ -167,6 +167,10 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam ...@@ -167,6 +167,10 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam
wakeup_prach_eNB_br(eNB,NULL,proc->frame_rx,proc->subframe_rx); wakeup_prach_eNB_br(eNB,NULL,proc->frame_rx,proc->subframe_rx);
#endif #endif
} }
#ifdef UE_EXPANSION
release_UE_in_freeList(eNB->Mod_id);
#endif
// UE-specific RX processing for subframe n // UE-specific RX processing for subframe n
phy_procedures_eNB_uespec_RX(eNB, proc, no_relay ); phy_procedures_eNB_uespec_RX(eNB, proc, no_relay );
......
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