Commit b285e2f6 authored by Haruki NAOI's avatar Haruki NAOI

Add semi-persistent scheduling and change pre_scd non-realtime task.

(cherry picked from commit eae86561aea29b07afbcda79b6c2ad90162069f6)

# Conflicts:
#	openair2/ENB_APP/enb_config.c
#	openair2/LAYER2/MAC/eNB_scheduler_fairRR.c
#	targets/RT/USER/lte-enb.c
#	targets/RT/USER/lte-ru.c
parent 26ecf308
......@@ -280,6 +280,7 @@ typedef struct {
TASK_DEF(TASK_BM, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_PHY_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_MAC_ENB_PRE_SCD, TASK_PRIORITY_MED_LEAST, 200, NULL, NULL) \
TASK_DEF(TASK_RLC_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_RRC_ENB_NB_IoT, TASK_PRIORITY_MED, 200, NULL, NULL) \
TASK_DEF(TASK_PDCP_ENB, TASK_PRIORITY_MED, 200, NULL, NULL) \
......
......@@ -273,14 +273,6 @@ typedef struct RU_proc_t_s {
pthread_cond_t cond_rf_tx;
/// \internal This variable is protected by \ref mutex_rf_tx.
int instance_cnt_rf_tx;
#endif
#if defined(PRE_SCD_THREAD)
pthread_t pthread_pre_scd;
/// condition variable for time processing thread
pthread_cond_t cond_pre_scd;
/// mutex for time thread
pthread_mutex_t mutex_pre_scd;
int instance_pre_scd;
#endif
int emulate_rf_busy;
} RU_proc_t;
......
......@@ -158,6 +158,7 @@ typedef struct RadioResourceConfig_s {
long ue_TimersAndConstants_n311;
long ue_TransmissionMode;
long ue_multiple_max;
long volte_ul_buffersize;
#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0))
//SIB2 BR Options
long* preambleTransMax_CE_r13;
......
......@@ -279,6 +279,14 @@ void RCconfig_macrlc(int macrlc_has_f1[MAX_MAC_INST]) {
global_scheduler_mode=SCHED_MODE_DEFAULT;
printf("sched mode = default %d [%s]\n",global_scheduler_mode,*(MacRLC_ParamList.paramarray[j][MACRLC_SCHED_MODE_IDX].strptr));
}
// Volte cycle num
for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++){
RC.mac[j]->volte_ul_cycle[CC_id] = 0;
RC.mac[j]->volte_dl_cycle[CC_id] = 0;
}
}// j=0..num_inst
} /*else {// MacRLC_ParamList.numelt > 0 // ignore it
......@@ -1816,6 +1824,28 @@ int RCconfig_RRC(uint32_t i, eNB_RRC_INST *rrc, int macrlc_has_f1) {
exit_fun("Failed to parse eNB configuration file");
}
// VoLTE configuration
// RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].volte_ul_cycle= ccparams_lte.volte_ul_cycle;
// if ((ccparams_lte.volte_ul_cycle < 10) ||
// (ccparams_lte.volte_ul_cycle > 200))
// AssertFatal (0,
// "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for volte_ul_cycle choice: 10..200!\n",
// RC.config_file_name, i, ccparams_lte.volte_ul_cycle);
// RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].volte_dl_cycle= ccparams_lte.volte_dl_cycle;
// if ((ccparams_lte.volte_dl_cycle < 10) ||
// (ccparams_lte.volte_dl_cycle > 200))
// AssertFatal (0,
// "Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for volte_dl_cycle choice: 10..200!\n",
// RC.config_file_name, i, ccparams_lte.volte_dl_cycle);
RRC_CONFIGURATION_REQ (msg_p).radioresourceconfig[j].volte_ul_buffersize= ccparams_lte.volte_ul_buffersize;
if ((ccparams_lte.volte_ul_buffersize < 0) ||
(ccparams_lte.volte_ul_buffersize > 255))
AssertFatal (0,
"Failed to parse eNB configuration file %s, enb %d unknown value \"%d\" for volte_ul_buffersize choice: 0..255!\n",
RC.config_file_name, i, ccparams_lte.volte_ul_buffersize);
// eMBMS configuration
RRC_CONFIGURATION_REQ(msg_p).eMBMS_configured = 0;
printf("No eMBMS configuration, skipping it\n");
......
......@@ -397,6 +397,9 @@ typedef enum {
#define ENB_CONFIG_STRING_UETIMERS_N311 "ue_TimersAndConstants_n311"
#define ENB_CONFIG_STRING_UE_TRANSMISSION_MODE "ue_TransmissionMode"
#define ENB_CONFIG_STRING_UE_MULTIPLE_MAX "ue_multiple_max"
#define ENB_CONFIG_STRING_VOLTE_UL_CYCLE "volte_ul_cycle"
#define ENB_CONFIG_STRING_VOLTE_DL_CYCLE "volte_dl_cycle"
#define ENB_CONFIG_STRING_VOLTE_UL_BUFFERSIZE "volte_ul_buffersize"
//SIB1-MBMS
#define ENB_CONFIG_STRING_MBMS_DEDICATED_SERVING_CELL "mbms_dedicated_serving_cell"
......@@ -540,6 +543,9 @@ typedef struct ccparams_lte_s {
int32_t ue_TimersAndConstants_n311;
int32_t ue_TransmissionMode;
int32_t ue_multiple_max;
int32_t volte_ul_cycle;
int32_t volte_dl_cycle;
int32_t volte_ul_buffersize;
char *mbms_dedicated_serving_cell;
int32_t srb1_timer_poll_retransmit;
int32_t srb1_timer_reordering;
......@@ -750,7 +756,8 @@ typedef struct ccparams_lte_s {
{ENB_CONFIG_STRING_UETIMERS_N311, NULL, 0, iptr:&ccparams.ue_TimersAndConstants_n311, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_UE_TRANSMISSION_MODE, NULL, 0, iptr:&ccparams.ue_TransmissionMode, defintval:1, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_UE_MULTIPLE_MAX, NULL, 0, iptr:&ccparams.ue_multiple_max, defintval:4, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_MBMS_DEDICATED_SERVING_CELL, NULL, 0, strptr:&ccparams.mbms_dedicated_serving_cell, defstrval:"DISABLE", TYPE_STRING, 0} \
{ENB_CONFIG_STRING_VOLTE_UL_BUFFERSIZE, NULL, 0, iptr:&ccparams.volte_ul_buffersize, defintval:38, TYPE_UINT, 0}, \
{ENB_CONFIG_STRING_MBMS_DEDICATED_SERVING_CELL, NULL, 0, strptr:&ccparams.mbms_dedicated_serving_cell, defstrval:"DISABLE", TYPE_STRING, 0} \
}
......
......@@ -1404,3 +1404,83 @@ void eNB_Config_Local_DRX(
break;
}
}
//-----------------------------------------------------------------------------
/*
* Configure VoLTE
*/
void eNB_mac_config_VoLTE(
module_id_t Mod_idP,
rnti_t rntiP,
u_int8_t voice_flg,
u_int8_t logicalChannelGroup,
u_int8_t logicalChannelIdentity
)
//-----------------------------------------------------------------------------
{
int UE_id,CC_id;
UE_list_t *UE_list = &(RC.mac[Mod_idP]->UE_list);
UE_sched_ctrl_t *UE_scheduling_control;
static int Volte_ue_num[MAX_NUM_CCs] = {0};
UE_id = find_UE_id(Mod_idP, rntiP);
CC_id = UE_PCCID(Mod_idP, UE_id);
if (UE_id < 0) {
LOG_E(MAC, "Configuration received for unknown UE (%x), shouldn't happen\n", rntiP);
return;
}
UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id]);
if (voice_flg == 1) { // voice
UE_scheduling_control->volte_configured = TRUE;
UE_scheduling_control->volte_lcid = logicalChannelIdentity;
UE_scheduling_control->volte_lcg = logicalChannelGroup;
UE_scheduling_control->ul_periodic_timer = 0;
UE_scheduling_control->dl_periodic_timer = 0;
UE_scheduling_control->dl_volte_ue_select_flag = FALSE; /* VoLTE UE select flag init */
UE_scheduling_control->ul_periodic_timer_exp_flag = FALSE;
LOG_I(RRC, "VoLTE configured LCID%u, LCG%u for UE:%d\n",
logicalChannelIdentity,
logicalChannelGroup,
UE_id);
Volte_ue_num[CC_id]++;
if(0 < Volte_ue_num[CC_id] && Volte_ue_num[CC_id] < 32){
RC.mac[Mod_idP]->volte_ul_cycle[CC_id] = 20;
RC.mac[Mod_idP]->volte_dl_cycle[CC_id] = 20;
}
else if(32 <= Volte_ue_num[CC_id] && Volte_ue_num[CC_id] < 64){
RC.mac[Mod_idP]->volte_ul_cycle[CC_id] = 40;
RC.mac[Mod_idP]->volte_dl_cycle[CC_id] = 40;
}else{
RC.mac[Mod_idP]->volte_ul_cycle[CC_id] = 80;
RC.mac[Mod_idP]->volte_dl_cycle[CC_id] = 80;
}
} else {
if ((UE_scheduling_control->volte_configured == TRUE) && (UE_scheduling_control->volte_lcid == logicalChannelIdentity)) {
UE_scheduling_control->volte_configured = FALSE;
UE_scheduling_control->ul_periodic_timer_exp_flag = FALSE;
Volte_ue_num[CC_id]--;
if (Volte_ue_num[CC_id] < 0){
Volte_ue_num[CC_id] = 0;
}
if(Volte_ue_num[CC_id] == 0){
RC.mac[Mod_idP]->volte_ul_cycle[CC_id] = 0;
RC.mac[Mod_idP]->volte_dl_cycle[CC_id] = 0;
}
else if(0 < Volte_ue_num[CC_id] && Volte_ue_num[CC_id] < 32){
RC.mac[Mod_idP]->volte_ul_cycle[CC_id] = 20;
RC.mac[Mod_idP]->volte_dl_cycle[CC_id] = 20;
}
else if(32 <= Volte_ue_num[CC_id] && Volte_ue_num[CC_id] < 64){
RC.mac[Mod_idP]->volte_ul_cycle[CC_id] = 40;
RC.mac[Mod_idP]->volte_dl_cycle[CC_id] = 40;
}else{
RC.mac[Mod_idP]->volte_ul_cycle[CC_id] = 80;
RC.mac[Mod_idP]->volte_dl_cycle[CC_id] = 80;
}
}
}
}
\ No newline at end of file
......@@ -597,6 +597,8 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
UE_list_t *UE_list = &(eNB->UE_list);
COMMON_channels_t *cc = eNB->common_channels;
UE_sched_ctrl_t *UE_scheduling_control = NULL;
uint8_t volte_ul_cycle[MAX_NUM_CCs];
uint8_t volte_ul_buffersize[MAX_NUM_CCs];
start_meas(&(eNB->eNB_scheduler));
......@@ -616,11 +618,19 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
cc[CC_id].mcch_active = 0;
#endif
clear_nfapi_information(RC.mac[module_idP], CC_id, frameP, subframeP);
volte_ul_cycle[CC_id] = eNB->volte_ul_cycle[CC_id];
if (volte_ul_cycle[CC_id] != 0){
volte_ul_buffersize[CC_id] = ( RC.rrc[module_idP]->configuration.radioresourceconfig[CC_id].volte_ul_buffersize * (volte_ul_cycle[CC_id] / 20) );
}else{
volte_ul_buffersize[CC_id] = RC.rrc[module_idP]->configuration.radioresourceconfig[CC_id].volte_ul_buffersize;
}
}
/* Refresh UE list based on UEs dropped by PHY in previous subframe */
for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) {
if (UE_list->active[UE_id]) {
UE_TEMPLATE *UE_template = NULL;
rnti = UE_RNTI(module_idP, UE_id);
CC_id = UE_PCCID(module_idP, UE_id);
......@@ -642,10 +652,27 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME(VCD_SIGNAL_DUMPER_VARIABLES_UE0_BSR, RC.eNB[module_idP][CC_id]->pusch_stats_bsr[UE_id][(frameP * 10) + subframeP]);
}
/* increment VoLTE related timers */
if (UE_scheduling_control->volte_configured == TRUE) {
UE_scheduling_control->dl_periodic_timer++;
UE_scheduling_control->ul_periodic_timer++;
if (UE_scheduling_control->ul_periodic_timer >= volte_ul_cycle[CC_id]) {
/* Update buffer info */
UE_template = &(UE_list->UE_template[CC_id][UE_id]);
UE_template->ul_buffer_info[UE_scheduling_control->volte_lcg] += volte_ul_buffersize[CC_id];
UE_template->estimated_ul_buffer =
UE_template->ul_buffer_info[LCGID0] +
UE_template->ul_buffer_info[LCGID1] +
UE_template->ul_buffer_info[LCGID2] +
UE_template->ul_buffer_info[LCGID3];
UE_scheduling_control->ul_periodic_timer = 0;
UE_scheduling_control->ul_periodic_timer_exp_flag = TRUE;
}
}
/* Set and increment CDRX related timers */
if (UE_scheduling_control->cdrx_configured == TRUE) {
boolean_t harq_active_time_condition = FALSE;
UE_TEMPLATE *UE_template = NULL;
unsigned long active_time_condition = 0; // variable used only for tracing purpose
......@@ -854,6 +881,35 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
UE_scheduling_control->ul_inactivity_timer++;
UE_scheduling_control->cqi_req_timer++;
// various timers update
struct rrc_eNB_ue_context_s *ue_context_p = NULL;
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[module_idP]->rrc_ue_head)) {
if (ue_context_p->ue_context.ul_failure_timer > 0) {
ue_context_p->ue_context.ul_failure_timer++;
}
if (ue_context_p->ue_context.ue_release_timer_s1 > 0) {
ue_context_p->ue_context.ue_release_timer_s1++;
}
if (ue_context_p->ue_context.ue_release_timer_rrc > 0) {
ue_context_p->ue_context.ue_release_timer_rrc++;
}
if ((ue_context_p->ue_context.ue_rrc_inactivity_timer > 0) && (RC.rrc[module_idP]->configuration.rrc_inactivity_timer_thres > 0)) {
ue_context_p->ue_context.ue_rrc_inactivity_timer++;
}
if (ue_context_p->ue_context.ue_reestablishment_timer > 0) {
ue_context_p->ue_context.ue_reestablishment_timer++;
}
if (ue_context_p->ue_context.ue_release_timer > 0) {
ue_context_p->ue_context.ue_release_timer++;
}
} // end RB_FOREACH
LOG_D(MAC, "UE %d/%x : ul_inactivity %d, cqi_req %d\n",
UE_id,
rnti,
......
This diff is collapsed.
......@@ -2657,6 +2657,9 @@ add_new_ue(module_id_t mod_idP,
UE_list->UE_sched_ctrl[UE_id].pusch_bler[cc_idP] = 0;
UE_list->UE_sched_ctrl[UE_id].mcs_offset[cc_idP] = 0;
UE_list->UE_sched_ctrl[UE_id].volte_configured = FALSE;
UE_list->UE_sched_ctrl[UE_id].ul_periodic_timer_exp_flag = FALSE;
for (j = 0; j < 8; j++) {
UE_list->UE_template[cc_idP][UE_id].oldNDI[j][TB1] = (j == 0) ? 1 : 0; // 1 because first transmission is with format1A (Msg4) for harq_pid 0
UE_list->UE_template[cc_idP][UE_id].oldNDI[j][TB2] = 1;
......@@ -2816,7 +2819,6 @@ rrc_mac_remove_ue(module_id_t mod_idP,
pthread_mutex_unlock(&rrc_release_freelist);
}
pthread_mutex_unlock(&rrc_release_freelist);
return 0;
}
......
......@@ -1040,7 +1040,16 @@ typedef struct {
int32_t uplane_inactivity_timer;
uint8_t crnti_reconfigurationcomplete_flag;
uint8_t cqi_req_flag;
/* VoLTE related info */
boolean_t volte_configured;
uint8_t volte_lcg;
uint8_t volte_lcid;
uint8_t ul_periodic_timer;
uint8_t dl_periodic_timer;
uint8_t dl_volte_ue_select_flag; // list of VoLTE data Flag by UE
uint8_t ul_periodic_timer_exp_flag;
/* HARQ RRT Timers */
/// (UL) HARQ RTT timers, especially used for CDRX operations, one timer per cell per harq process (and per user)
uint8_t harq_rtt_timer[NFAPI_CC_MAX][8];
......@@ -1520,6 +1529,11 @@ typedef struct eNB_MAC_INST_s {
int32_t puSch10xSnr;
int32_t puCch10xSnr;
// for volte cycle
int volte_ul_cycle[MAX_NUM_CCs];
int volte_dl_cycle[MAX_NUM_CCs];
} eNB_MAC_INST;
/*
......
......@@ -78,9 +78,7 @@ extern uint8_t rb_table[34];
#if defined(PRE_SCD_THREAD)
extern uint16_t pre_nb_rbs_required[2][MAX_NUM_CCs][NUMBER_OF_UE_MAX];
extern uint8_t dlsch_ue_select_tbl_in_use;
extern uint8_t new_dlsch_ue_select_tbl_in_use;
extern uint32_t dl_buffer_total[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX];
extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
#endif
......
......@@ -1323,8 +1323,7 @@ void sort_lcid_priority(module_id_t module_id, int UE_id, int dl_dtch_num, int *
void pre_scd_nb_rbs_required( module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP,
int min_rb_unit[MAX_NUM_CCs],
uint16_t nb_rbs_required[MAX_NUM_CCs][NUMBER_OF_UE_MAX]);
int min_rb_unit[MAX_NUM_CCs]);
#endif
/* Slice related functions */
......@@ -1336,6 +1335,9 @@ int ue_ul_slice_membership(module_id_t mod_id, int UE_id, int slice_idx);
/* Configure local DRX timers and thresholds in UE context, following the drx_configuration input */
void eNB_Config_Local_DRX(module_id_t Mod_id, rnti_t rnti, LTE_DRX_Config_t *drx_Configuration);
/* VoLTE Configuration */
void eNB_mac_config_VoLTE(module_id_t Mod_idP, rnti_t rntiP, u_int8_t voice_flg, u_int8_t logicalChannelGroup, u_int8_t logicalChannelIdentity);
/* from here: prototypes to get rid of compilation warnings: doc to be written by function author */
uint8_t ul_subframe2_k_phich(COMMON_channels_t * cc, sub_frame_t ul_subframe);
#endif
......
......@@ -1321,6 +1321,42 @@ int rrc_eNB_previous_SRB2(rrc_eNB_ue_context_t* ue_context_pP)
}
//-----------------------------------------------------------------------------
/*
* Check if e_rab_id is for voice.
* return : voice (1), not (0)
*/
uint8_t rrc_eNB_get_voice_flg(rrc_eNB_ue_context_t* ue_context_pP, uint8_t e_rab_idP, const uint8_t xid)
//-----------------------------------------------------------------------------
{
uint8_t i;
uint8_t ret = 0;
uint8_t qci = 0;
if (ue_context_pP->ue_context.nb_of_modify_e_rabs > 0) {
for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_e_rabs; i++) {
if (e_rab_idP == ue_context_pP->ue_context.modify_e_rab[i].param.e_rab_id) {
if (xid == ue_context_pP->ue_context.modify_e_rab[i].xid) {
qci = ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci;
break;
}
}
}
} else {
for (i = 0; i < ue_context_pP->ue_context.setup_e_rabs; i++) {
if (ue_context_pP->ue_context.e_rab[i].param.e_rab_id == e_rab_idP) {
qci = ue_context_pP->ue_context.e_rab[i].param.qos.qci;
break;
}
}
}
if (qci == 1){
ret = 1;
}
return ret;
}
//-----------------------------------------------------------------------------
/*
* Process the rrc connection setup complete message from UE (SRB1 Active)
*/
void
......@@ -3991,7 +4027,7 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt
DRB_ul_SpecificParameters->bucketSizeDuration = LTE_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50;
// LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM)
logicalchannelgroup_drb = CALLOC(1, sizeof(long));
*logicalchannelgroup_drb = 1;
*logicalchannelgroup_drb = 3;
DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb;
ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
......@@ -6636,6 +6672,8 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
uint8_t *kRRCenc = NULL;
uint8_t *kRRCint = NULL;
uint8_t *kUPenc = NULL;
uint8_t e_rab_id;
uint8_t voice_flg;
LTE_DRB_ToAddModList_t *DRB_configList = ue_context_pP->ue_context.DRB_configList2[xid];
LTE_SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid];
LTE_DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid];
......@@ -6854,8 +6892,15 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
(LTE_SystemInformationBlockType1_MBMS_r14_t *) NULL,
(LTE_MBSFN_AreaInfoList_r9_t *) NULL
#endif
);
}
);
e_rab_id = (u_int8_t)*DRB_configList->list.array[i]->eps_BearerIdentity;
voice_flg = rrc_eNB_get_voice_flg(ue_context_pP, e_rab_id, xid);
eNB_mac_config_VoLTE(ctxt_pP->module_id,
ue_context_pP->ue_context.rnti,
voice_flg,
(u_int8_t)*DRB_configList->list.array[i]->logicalChannelConfig->ul_SpecificParameters->logicalChannelGroup,
DRB2LCHAN[i]);
}
} else { // remove LCHAN from MAC/PHY
#if 0
if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
......@@ -6934,6 +6979,11 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
(LTE_MBSFN_AreaInfoList_r9_t *) NULL
#endif
);
eNB_mac_config_VoLTE(ctxt_pP->module_id,
ue_context_pP->ue_context.rnti,
0,
0,
(u_int8_t)(drb_id + 2));
}
} // end else of if (ue_context_pP->ue_context.DRB_active[drb_id] == 0)
} // end if (DRB_configList->list.array[i])
......@@ -6962,6 +7012,13 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
ue_context_pP->ue_context.DRB_active[drb_id] = 0;
if (NODE_IS_MONOLITHIC(RC.rrc[ctxt_pP->module_id]->node_type)) {
eNB_mac_config_VoLTE(ctxt_pP->module_id,
ue_context_pP->ue_context.rnti,
0,
0,
(u_int8_t)(drb_id + 2));
}
}
}
}
......@@ -8843,8 +8900,6 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id)
}
if (ue_context_p->ue_context.ul_failure_timer > 0) {
ue_context_p->ue_context.ul_failure_timer++;
if (ue_context_p->ue_context.ul_failure_timer >= 20000) {
// remove UE after 20 seconds after MAC (or else) has indicated UL failure
LOG_I(RRC, "Removing UE %x instance, because of uplink failure timer timeout\n",
......@@ -8855,8 +8910,6 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id)
}
if (ue_context_p->ue_context.ue_release_timer_s1 > 0) {
ue_context_p->ue_context.ue_release_timer_s1++;
if (ue_context_p->ue_context.ue_release_timer_s1 >= ue_context_p->ue_context.ue_release_timer_thres_s1) {
LOG_I(RRC, "Removing UE %x instance, because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n",
ue_context_p->ue_context.rnti,
......@@ -8873,8 +8926,6 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id)
} // end if timer_s1 > 0 (S1 UE_CONTEXT_RELEASE_REQ ongoing)
if (ue_context_p->ue_context.ue_release_timer_rrc > 0) {
ue_context_p->ue_context.ue_release_timer_rrc++;
if (ue_context_p->ue_context.ue_release_timer_rrc >= ue_context_p->ue_context.ue_release_timer_thres_rrc) {
LOG_I(RRC, "Removing UE %x instance after UE_CONTEXT_RELEASE_Complete (ue_release_timer_rrc timeout)\n",
ue_context_p->ue_context.rnti);
......@@ -8954,8 +9005,6 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id)
pthread_mutex_unlock(&rrc_release_freelist);
if ((ue_context_p->ue_context.ue_rrc_inactivity_timer > 0) && (RC.rrc[ctxt_pP->module_id]->configuration.rrc_inactivity_timer_thres > 0)) {
ue_context_p->ue_context.ue_rrc_inactivity_timer++;
if (ue_context_p->ue_context.ue_rrc_inactivity_timer >= RC.rrc[ctxt_pP->module_id]->configuration.rrc_inactivity_timer_thres) {
LOG_I(RRC, "Removing UE %x instance because of rrc_inactivity_timer timeout\n",
ue_context_p->ue_context.rnti);
......@@ -8965,8 +9014,6 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id)
}
if (ue_context_p->ue_context.ue_reestablishment_timer > 0) {
ue_context_p->ue_context.ue_reestablishment_timer++;
if (ue_context_p->ue_context.ue_reestablishment_timer >= ue_context_p->ue_context.ue_reestablishment_timer_thres) {
LOG_I(RRC, "Removing UE %x instance because of reestablishment_timer timeout\n",
ue_context_p->ue_context.rnti);
......@@ -8978,8 +9025,6 @@ void rrc_subframe_process(protocol_ctxt_t *const ctxt_pP, const int CC_id)
}
if (ue_context_p->ue_context.ue_release_timer > 0) {
ue_context_p->ue_context.ue_release_timer++;
if (ue_context_p->ue_context.ue_release_timer >= ue_context_p->ue_context.ue_release_timer_thres) {
LOG_I(RRC, "Removing UE %x instance because of RRC Connection Setup timer timeout\n",
ue_context_p->ue_context.rnti);
......
......@@ -352,6 +352,12 @@ void *rrc_enb_process_itti_msg(void *);
\param void *args_p Pointer on arguments to start the task. */
void *rrc_enb_task(void *args_p);
#if defined(PRE_SCD_THREAD)
/**\brief MAC eNB Pre SCD task.
\param void *args_p Pointer on arguments to start the task. */
void *pre_scd_task(void *args_p);
#endif
/**\brief RRC UE task.
\param void *args_p Pointer on arguments to start the task. */
void *rrc_ue_task(void *args_p);
......@@ -676,4 +682,6 @@ 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);
uint8_t rrc_eNB_get_voice_flg(rrc_eNB_ue_context_t *ue_context_pP, uint8_t e_rab_idP, const uint8_t xid);
/** @}*/
File mode changed from 100644 to 100755
......@@ -165,9 +165,6 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
//L1_rxtx_proc_t *L1_proc_tx = &eNB->proc.L1_proc_tx;
// *******************************************************************
#if defined(PRE_SCD_THREAD)
RU_t *ru = RC.ru[0];
#endif
if (eNB ==NULL) {
LOG_D(PHY,"%s:%d: rxtx invalid argument, eNB pointer is NULL",__FILE__,__LINE__);
......@@ -232,38 +229,9 @@ static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name
#if defined(PRE_SCD_THREAD)
if (NFAPI_MODE==NFAPI_MODE_VNF) {
new_dlsch_ue_select_tbl_in_use = dlsch_ue_select_tbl_in_use;
dlsch_ue_select_tbl_in_use = !dlsch_ue_select_tbl_in_use;
// L2-emulator can work only one eNB.
// memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
// memcpy(&pre_scd_activeUE, &RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX);
memcpy(&pre_scd_eNB_UE_stats,&RC.mac[0]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
memcpy(&pre_scd_activeUE, &RC.mac[0]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX);
if ((ret= pthread_mutex_lock(&ru->proc.mutex_pre_scd))!=0) {
LOG_E(PHY,"[eNB] error locking proc mutex for eNB pre scd, return %d\n",ret);
return -1;
}
ru->proc.instance_pre_scd++;
if (ru->proc.instance_pre_scd == 0) {
if (pthread_cond_signal(&ru->proc.cond_pre_scd) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB pre scd\n" );
exit_fun( "ERROR pthread_cond_signal cond_pre_scd" );
}
} else {
LOG_E( PHY, "[eNB] frame %d subframe %d rxtx busy instance_pre_scd %d\n",
proc->frame_rx,proc->subframe_rx,ru->proc.instance_pre_scd );
}
if ((ret= pthread_mutex_unlock(&ru->proc.mutex_pre_scd))!=0) {
LOG_E(PHY,"[eNB] error unlocking proc mutex for eNB pre scd, return %d\n",ret);
return -1;
}
}
#endif
if ((ret= pthread_mutex_lock(&eNB->UL_INFO_mutex))!=0) {
LOG_E(PHY,"error locking UL_INFO_mutex, return %d\n",ret);
......
......@@ -1683,39 +1683,6 @@ void *ru_thread_tx( void *param ) {
return 0;
}
#if defined(PRE_SCD_THREAD)
int wakeup_prescd(RU_t* ru, int frame , int subframe){
new_dlsch_ue_select_tbl_in_use = dlsch_ue_select_tbl_in_use;
dlsch_ue_select_tbl_in_use = !dlsch_ue_select_tbl_in_use;
memcpy(&pre_scd_eNB_UE_stats,&RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
memcpy(&pre_scd_activeUE, &RC.mac[ru->eNB_list[0]->Mod_id]->UE_list.active, sizeof(boolean_t)*NUMBER_OF_UE_MAX);
if (pthread_mutex_lock(&ru->proc.mutex_pre_scd)!= 0) {
LOG_E( PHY, "[eNB] error locking proc mutex for eNB pre scd\n");
exit_fun("error locking mutex_time");
}
ru->proc.instance_pre_scd++;
if (ru->proc.instance_pre_scd == 0) {
if (pthread_cond_signal(&ru->proc.cond_pre_scd) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB pre scd\n" );
exit_fun( "ERROR pthread_cond_signal cond_pre_scd" );
return -1;
}
}else{
LOG_E( PHY, "[eNB] frame %d subframe %d rxtx busy instance_pre_scd %d\n",
frame,subframe,ru->proc.instance_pre_scd );
}
if (pthread_mutex_unlock(&ru->proc.mutex_pre_scd)!= 0) {
LOG_E( PHY, "[eNB] error unlocking mutex_pre_scd mutex for eNB pre scd\n");
exit_fun("error unlocking mutex_pre_scd");
return -1;
}
return 0;
}
#endif
void *ru_thread( void *param ) {
RU_t *ru = (RU_t *)param;
......@@ -1725,13 +1692,11 @@ void *ru_thread( void *param ) {
int frame =1023;
int resynch_done = 0;
int ret;
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
// set default return value
#if defined(PRE_SCD_THREAD)
dlsch_ue_select_tbl_in_use = 1;
#endif
// set default return value
thread_top_init("ru_thread",1,400000,500000,500000);
//CPU_SET(1, &cpuset);
......@@ -2013,11 +1978,6 @@ void *ru_thread( void *param ) {
return NULL;
}
#if defined(PRE_SCD_THREAD)
if (NFAPI_MODE == NFAPI_MONOLITHIC) {
wakeup_prescd(ru, frame, subframe);
}
#endif
// wakeup all eNB processes waiting for this RU
if (ru->num_eNB>0) wakeup_L1s(ru);
......@@ -2130,35 +2090,62 @@ void *ru_thread_synch(void *arg) {
}
#if defined(PRE_SCD_THREAD)
void *pre_scd_thread( void *param ) {
void *pre_scd_task( void *param ) {
static int eNB_pre_scd_status;
protocol_ctxt_t ctxt;
int frame;
int subframe;
int min_rb_unit[MAX_NUM_CCs];
int CC_id;
int Mod_id;
RU_t *ru = (RU_t *)param;
int old_subframe;
eNB_MAC_INST *eNB;
UE_list_t *UE_list;
MessageDef *msg_p = NULL;
/* init */
old_subframe = 0x7FFFFFFF;
itti_mark_task_ready (TASK_MAC_ENB_PRE_SCD);
LOG_I(MAC,"Entering main loop of eNB MAC PreSCD task\n");
// L2-emulator can work only one eNB
if( NFAPI_MODE==NFAPI_MODE_VNF)
Mod_id = 0;
else
Mod_id = ru->eNB_list[0]->Mod_id;
Mod_id = RC.ru[0]->eNB_list[0]->Mod_id;
frame = 0;
subframe = 4;
thread_top_init("pre_scd_thread",1,870000,1000000,1000000);
eNB = RC.mac[Mod_id];
UE_list = &eNB->UE_list;
while (!oai_exit) {
if (wait_on_condition(&ru->proc.mutex_pre_scd,&ru->proc.cond_pre_scd,&ru->proc.instance_pre_scd,"pre_scd_thread") < 0) break;
if(oai_exit) {
break;
}
// Wait for a message
itti_poll_msg(TASK_MAC_ENB_PRE_SCD, &msg_p); /* reception of one message, non-blocking */
if (msg_p != NULL) {
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
LOG_W(MAC, " *** Exiting eNB MAC PreSCD thread\n");
itti_exit_task();
break;
default:
break;
}
}
if(old_subframe == eNB->subframe){
continue;
}
memcpy(&pre_scd_eNB_UE_stats,&UE_list->eNB_UE_stats, sizeof(eNB_UE_STATS)*MAX_NUM_CCs*NUMBER_OF_UE_MAX);
memcpy(&pre_scd_activeUE, &UE_list->active, sizeof(boolean_t)*NUMBER_OF_UE_MAX);
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, Mod_id, ENB_FLAG_YES,
NOT_A_RNTI, frame, subframe,Mod_id);
NOT_A_RNTI, eNB->frame, eNB->subframe,Mod_id);
pdcp_run(&ctxt);
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
......@@ -2170,17 +2157,9 @@ void *pre_scd_thread( void *param ) {
}
}
pre_scd_nb_rbs_required(Mod_id, frame, subframe,min_rb_unit,pre_nb_rbs_required[new_dlsch_ue_select_tbl_in_use]);
pre_scd_nb_rbs_required(Mod_id, eNB->frame, eNB->subframe,min_rb_unit);
if (subframe==9) {
subframe=0;
frame++;
frame&=1023;
} else {
subframe++;
}
if (release_thread(&ru->proc.mutex_pre_scd,&ru->proc.instance_pre_scd,"pre_scd_thread") < 0) break;
old_subframe = eNB->subframe;
}
eNB_pre_scd_status = 0;
......@@ -2442,13 +2421,13 @@ void init_RU_proc(RU_t *ru) {
#if defined(PRE_SCD_THREAD)
if (NFAPI_MODE == NFAPI_MONOLITHIC) {
proc->instance_pre_scd = -1;
pthread_mutex_init( &proc->mutex_pre_scd, NULL);
pthread_cond_init( &proc->cond_pre_scd, NULL);
pthread_create(&proc->pthread_pre_scd, NULL, pre_scd_thread, (void *)ru);
pthread_setname_np(proc->pthread_pre_scd, "pre_scd_thread");
int rc;
LOG_I(MAC,"Creating MAC eNB PreSCD Task\n");
rc = itti_create_task (TASK_MAC_ENB_PRE_SCD, pre_scd_task, (void *)ru);
AssertFatal(rc >= 0, "Create task for MAC eNB PreSCD failed\n");
}
#endif
#ifdef PHY_TX_THREAD
pthread_create( &proc->pthread_phy_tx, NULL, eNB_thread_phy_tx, (void *)ru );
pthread_setname_np( proc->pthread_phy_tx, "phy_tx_thread" );
......@@ -2531,23 +2510,6 @@ void init_RU_proc(RU_t *ru) {
void kill_RU_proc(RU_t *ru) {
int ret;
RU_proc_t *proc = &ru->proc;
#if defined(PRE_SCD_THREAD)
if (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_VNF) {
if ((ret=pthread_mutex_lock(&proc->mutex_pre_scd))!=0) {
LOG_E(PHY,"mutex_lock returns %d\n",ret);
return;
}
ru->proc.instance_pre_scd = 0;
pthread_cond_signal(&proc->cond_pre_scd);
if ((ret=pthread_mutex_unlock(&proc->mutex_pre_scd))!=0) {
LOG_E(PHY,"mutex_unlock returns %d\n",ret);
return;
}
pthread_join(proc->pthread_pre_scd, NULL);
pthread_mutex_destroy(&proc->mutex_pre_scd);
pthread_cond_destroy(&proc->cond_pre_scd);
}
#endif
#ifdef PHY_TX_THREAD
if ((ret=pthread_mutex_lock(&proc->mutex_phy_tx))!=0) {
LOG_E(PHY,"mutex_lock returns %d\n",ret);
......@@ -3008,19 +2970,10 @@ void init_RU(char *rf_config_file, clock_source_t clock_source,clock_source_t ti
void stop_ru(RU_t *ru) {
#if defined(PRE_SCD_THREAD) || defined(PHY_TX_THREAD)
#if defined(PHY_TX_THREAD)
int *status;
#endif
printf("Stopping RU %p processing threads\n",(void*)ru);
#if defined(PRE_SCD_THREAD)
if(ru && (NFAPI_MODE == NFAPI_MONOLITHIC || NFAPI_MODE == NFAPI_MODE_VNF)){
ru->proc.instance_pre_scd = 0;
pthread_cond_signal( &ru->proc.cond_pre_scd );
pthread_join(ru->proc.pthread_pre_scd, (void**)&status );
pthread_mutex_destroy(&ru->proc.mutex_pre_scd );
pthread_cond_destroy(&ru->proc.cond_pre_scd );
}
#endif
#ifdef PHY_TX_THREAD
if(ru){
ru->proc.instance_cnt_phy_tx = 0;
......@@ -3051,11 +3004,9 @@ void stop_RU(int nb_ru)
void init_ru_vnf(void) {
int ru_id;
RU_t *ru;
RU_proc_t *proc;
// PHY_VARS_eNB *eNB0= (PHY_VARS_eNB *)NULL;
int i;
int CC_id;
dlsch_ue_select_tbl_in_use = 1;
// create status mask
RC.ru_mask = 0;
pthread_mutex_init(&RC.ru_mutex,NULL);
......@@ -3120,17 +3071,13 @@ void init_ru_vnf(void) {
}
}
*/
LOG_I(PHY,"Initializing RRU descriptor %d : (%s,%s,%d)\n",ru_id,ru_if_types[ru->if_south],eNB_timing[ru->if_timing],ru->function);
// set_function_spec_param(ru);
LOG_I(PHY,"Starting ru_thread %d\n",ru_id);
// init_RU_proc(ru);
proc = &ru->proc;
memset((void *)proc,0,sizeof(RU_proc_t));
proc->instance_pre_scd = -1;
pthread_mutex_init( &proc->mutex_pre_scd, NULL);
pthread_cond_init( &proc->cond_pre_scd, NULL);
pthread_create(&proc->pthread_pre_scd, NULL, pre_scd_thread, (void *)ru);
pthread_setname_np(proc->pthread_pre_scd, "pre_scd_thread");
{
int rc;
LOG_I(MAC,"Creating MAC eNB PreSCD Task\n");
rc = itti_create_task (TASK_MAC_ENB_PRE_SCD, pre_scd_task, (void *)ru);
AssertFatal(rc >= 0, "Create task for MAC eNB PreSCD failed\n");
}
} // for ru_id
// sleep(1);
......
......@@ -419,6 +419,7 @@ int stop_L1L2(module_id_t enb_id) {
/* these tasks need to pick up new configuration */
terminate_task(enb_id, TASK_ENB_APP, TASK_RRC_ENB);
terminate_task(enb_id, TASK_ENB_APP, TASK_MAC_ENB_PRE_SCD);
oai_exit = 1;
LOG_I(ENB_APP, "calling kill_RU_proc() for instance %d\n", enb_id);
kill_RU_proc(RC.ru[enb_id]);
......@@ -470,6 +471,15 @@ int restart_L1L2(module_id_t enb_id) {
LOG_I(RRC, "Re-created task for RRC eNB successfully\n");
}
#if defined(PRE_SCD_THREAD)
if (itti_create_task (TASK_MAC_ENB_PRE_SCD, pre_scd_task, NULL) < 0) {
LOG_E(MAC,"Create task for MAC eNB PreSCD failed\n");
return -1;
} else {
LOG_I(RRC, "Re-created task for MAC eNB PreSCD successfully\n");
}
#endif
/* pass a reconfiguration request which will configure everything down to
* RC.eNB[i][j]->frame_parms, too */
msg_p = itti_alloc_new_message(TASK_ENB_APP, RRC_CONFIGURATION_REQ);
......
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