Commit 439f1be7 authored by Xu Bo's avatar Xu Bo

Merge remote-tracking branch 'remotes/origin/issue271_hundreds_of_ues' into ues_test

parents b11d9671 326aeb86
......@@ -972,6 +972,24 @@ typedef struct {
boolean_t active[NUMBER_OF_UE_MAX];
} 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 */
typedef struct {
int physCellId;
......@@ -1122,6 +1140,9 @@ typedef struct eNB_MAC_INST_s {
time_stats_t rx_ulsch_sdu; // include rlc_data_ind
/// processing time of eNB PCH scheduler
time_stats_t schedule_pch;
#ifdef UE_EXPANSION
UE_free_list_t UE_free_list;
#endif
} eNB_MAC_INST;
/*
......
......@@ -490,4 +490,11 @@ void openair_rrc_top_init_ue(
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
/** @}*/
......@@ -417,6 +417,7 @@ rrc_rx_tx(
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);
ue_to_be_removed = ue_context_p;
ue_context_p->ue_context.ue_release_timer_rrc = 0;
break;
}
}
......@@ -439,6 +440,9 @@ rrc_rx_tx(
ue_context_p->ue_context.ue_release_timer_thres) {
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
ue_to_be_removed = ue_context_p;
#ifdef UE_EXPANSION
ue_context_p->ue_context.ue_release_timer = 0;
#endif
break;
}
}
......
......@@ -803,11 +803,13 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
(void)ue_module_id;
#endif
rnti_t rnti = ue_context_pP->ue_context.rnti;
#ifndef UE_EXPANSION
int i, j , CC_id, pdu_number;
LTE_eNB_ULSCH_t *ulsch = NULL;
nfapi_ul_config_request_body_t *ul_req_tmp = NULL;
PHY_VARS_eNB *eNB_PHY = NULL;
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);
/* ue_context_p = rrc_eNB_get_ue_context(
......@@ -840,6 +842,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;
#endif
#endif
#ifndef UE_EXPANSION
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
eNB_PHY = RC.eNB[enb_mod_idP][CC_id];
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
......@@ -876,9 +879,116 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s*
&ctxt,
RC.rrc[enb_mod_idP],
(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
rrc_eNB_process_RRCConnectionSetupComplete(
......@@ -6615,6 +6725,9 @@ rrc_enb_task(
int CC_id;
protocol_ctxt_t ctxt;
#ifdef UE_EXPANSION
pthread_mutex_init(&lock_ue_freelist, NULL);
#endif
itti_mark_task_ready(TASK_RRC_ENB);
LOG_I(RRC,"Entering main loop of RRC message task\n");
while (1) {
......
......@@ -168,6 +168,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);
#endif
}
#ifdef UE_EXPANSION
release_UE_in_freeList(eNB->Mod_id);
#endif
// UE-specific RX processing for subframe n
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