Commit 6891bc66 authored by Swetank Srivastava's avatar Swetank Srivastava Committed by Vijay C

initial checkin. eNB crashing RRC received SCM and tried applying integrity

parent f85040c9
......@@ -204,6 +204,7 @@ hashtable_rc_t hashtable_dump_content (const hash_table_t *const hashtblP, char
*/
hashtable_rc_t hashtable_insert(hash_table_t *const hashtblP, const hash_key_t keyP, void *dataP) {
hash_node_t *node = NULL;
hash_node_t *node_prev = NULL;
hash_size_t hash = 0;
if (hashtblP == NULL) {
......@@ -211,6 +212,7 @@ hashtable_rc_t hashtable_insert(hash_table_t *const hashtblP, const hash_key_t k
}
hash=hashtblP->hashfunc(keyP)%hashtblP->size;
/*
node=hashtblP->nodes[hash];
while(node) {
......@@ -238,6 +240,23 @@ hashtable_rc_t hashtable_insert(hash_table_t *const hashtblP, const hash_key_t k
}
hashtblP->nodes[hash]=node;
*/
/* insert the new node to tail of the node list with same key */
if(!(node=malloc(sizeof(hash_node_t)))) return -1;
node->key=keyP;
node->data=dataP;
node->next = NULL;
node_prev = hashtblP->nodes[hash];
if(!node_prev){
hashtblP->nodes[hash] = node;
} else {
while(node_prev->next){
node_prev = node_prev->next;
}
node_prev->next = node;
}
return HASH_TABLE_OK;
}
//-------------------------------------------------------------------------------------------------------------------------------
......
......@@ -322,6 +322,15 @@ extern "C" {
return 0;
}
int itti_create_task_prio(task_id_t task_id,
void *(*start_routine)(void *),
void *args_p,int addprio) {
task_list_t *t=tasks[task_id];
threadCreate (&t->thread, start_routine, args_p, (char *)itti_get_task_name(task_id),-1,(OAI_PRIORITY_RT)+addprio);
LOG_I(ITTI,"Created Posix thread %s\n", itti_get_task_name(task_id) );
return 0;
}
void itti_exit_task(void) {
pthread_exit (NULL);
}
......
......@@ -524,6 +524,10 @@ int itti_create_task(task_id_t task_id,
void *(*start_routine) (void *),
void *args_p);
int itti_create_task_prio(task_id_t task_id,
void *(*start_routine)(void *),
void *args_p,int addprio);
int itti_create_queue(const task_info_t *task_info);
/** \brief Exit the current task.
......
......@@ -95,7 +95,7 @@ int create_tasks(uint32_t enb_nb) {
AssertFatal(rc >= 0, "Create task for SS VTP failed\n");
/* Task for support Virtual Time timer management */
rc = itti_create_task(TASK_VT_TIMER, ss_eNB_vt_timer_task, NULL);
rc = itti_create_task_prio(TASK_VT_TIMER, ss_eNB_vt_timer_task, NULL, 10);
AssertFatal(rc >= 0, "Create task for SS_VT_TIMER failed\n");
}
......@@ -104,7 +104,7 @@ int create_tasks(uint32_t enb_nb) {
AssertFatal(rc >= 0, "Create task for eNB APP failed\n");
LOG_I(RRC,"Creating RRC eNB Task\n");
rc = itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL);
rc = itti_create_task_prio (TASK_RRC_ENB, rrc_enb_task, NULL, 6);
AssertFatal(rc >= 0, "Create task for RRC eNB failed\n");
if (get_softmodem_params()->emulate_l1 || (EPC_MODE_ENABLED && split73 != SPLIT73_DU)) {
......
......@@ -271,11 +271,13 @@ static inline int rxtx(PHY_VARS_eNB *eNB,
printf("Error in itti_send_msg_to_task");
// LOG_E( PHY, "[SS] Error in L1_Thread itti_send_msg_to_task"); /** TODO: Need separate logging for SS */
}
LOG_D(PHY, "[SS] SS_UPD_TIM_INFO from L1_Thread to SYS task itti_send_msg_to_task sfn %d sf %d",
LOG_D(PHY, "[MAC] SS_UPD_TIM_INFO from L1_Thread to SYS task itti_send_msg_to_task sfn %d sf %d",
eNB->UL_INFO.subframe, eNB->UL_INFO.frame); /** TODO: Need separate logging for SS */
}
if (RC.ss.vtp_ready)
#ifdef VVJ
MessageDef *message_p_vt_timer = itti_alloc_new_message(TASK_ENB_APP, 0, SS_UPD_TIM_INFO);
if (message_p_vt_timer)
{
MessageDef *message_p_vt_timer = itti_alloc_new_message(TASK_ENB_APP, 0, SS_UPD_TIM_INFO);
if (message_p_vt_timer)
......@@ -291,7 +293,10 @@ static inline int rxtx(PHY_VARS_eNB *eNB,
LOG_D(PHY, "[SS] SS_UPD_TIM_INFO from L1_Thread to TASK_VT_TIMER task itti_send_msg_to_task sfn %d sf %d",
eNB->UL_INFO.subframe, eNB->UL_INFO.frame); /** TODO: Need separate logging for SS */
}
LOG_D(PHY, "[MAC] SS_UPD_TIM_INFO from L1_Thread to TASK_VT_TIMER task itti_send_msg_to_task sfn %d sf %d",
eNB->UL_INFO.subframe, eNB->UL_INFO.frame); /** TODO: Need separate logging for SS */
}
#endif
if (eNB->UL_INFO.subframe == 0) {
MessageDef *message_p_vtp = itti_alloc_new_message(TASK_ENB_APP, 0, SS_UPD_TIM_INFO);
......@@ -319,6 +324,26 @@ int tem_proc_ccid = proc->CC_id;
proc->CC_id = CC_id;//Temp solution need to be fixed later
eNB->if_inst->UL_indication(&eNB->UL_INFO, (void*)proc);
}
if (RC.ss.mode >= SS_SOFTMODEM)
{
//#endif /** ENB_SS */
MessageDef *message_p_vt_timer = itti_alloc_new_message(TASK_ENB_APP, 0, SS_UPD_TIM_INFO);
if (message_p_vt_timer)
{
SS_UPD_TIM_INFO(message_p_vt_timer).sf = eNB->UL_INFO.subframe;
SS_UPD_TIM_INFO(message_p_vt_timer).sfn = eNB->UL_INFO.frame;
int send_res = itti_send_msg_to_task(TASK_VT_TIMER, 0, message_p_vt_timer);
if (send_res < 0)
{
printf("Error in itti_send_msg_to_task");
// LOG_E( PHY, "[SS] Error in L1_Thread itti_send_msg_to_task"); /** TODO: Need separate logging for SS */
}
LOG_D(PHY, "[SS] SS_UPD_TIM_INFO from L1_Thread to TASK_VT_TIMER task itti_send_msg_to_task sfn %d sf %d\n",
eNB->UL_INFO.subframe, eNB->UL_INFO.frame); /** TODO: Need separate logging for SS */
}
}
proc->CC_id = tem_proc_ccid;
//#endif /** ENB_SS */
......@@ -341,7 +366,7 @@ int tem_proc_ccid = proc->CC_id;
/* CONFLICT RESOLUTION: END */
stop_meas( &softmodem_stats_rxtx_sf );
LOG_D(PHY,"%s() Exit proc[rx:%d%d tx:%d%d]\n", __FUNCTION__, proc->frame_rx, proc->subframe_rx, proc->frame_tx, proc->subframe_tx);
LOG_D(PHY, "rxtx:%lld nfapi:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld ",
LOG_D(PHY, "rxtx:%lld nfapi:%lld tx:%lld rx:%lld prach:%lld ofdm:%lld \n",
softmodem_stats_rxtx_sf.p_time, nfapi_meas.p_time,
TICK_TO_US(eNB->phy_proc_tx),
TICK_TO_US(eNB->phy_proc_rx),
......@@ -349,7 +374,7 @@ int tem_proc_ccid = proc->CC_id;
TICK_TO_US(eNB->ofdm_mod_stats)
);
LOG_D(PHY,
"dlsch[enc:%lld mod:%lld scr:%lld rm:%lld t:%lld i:%lld] rx_dft:%lld ",
"dlsch[enc:%lld mod:%lld scr:%lld rm:%lld t:%lld i:%lld] rx_dft:%lld \n",
TICK_TO_US(eNB->dlsch_encoding_stats),
TICK_TO_US(eNB->dlsch_modulation_stats),
TICK_TO_US(eNB->dlsch_scrambling_stats),
......@@ -357,13 +382,13 @@ int tem_proc_ccid = proc->CC_id;
TICK_TO_US(eNB->dlsch_turbo_encoding_stats),
TICK_TO_US(eNB->dlsch_interleaving_stats),
TICK_TO_US(eNB->rx_dft_stats));
LOG_D(PHY," ulsch[ch:%lld freq:%lld dec:%lld demod:%lld ru:%lld ",
LOG_D(PHY," ulsch[ch:%lld freq:%lld dec:%lld demod:%lld ru:%lld \n",
TICK_TO_US(eNB->ulsch_channel_estimation_stats),
TICK_TO_US(eNB->ulsch_freq_offset_estimation_stats),
TICK_TO_US(eNB->ulsch_decoding_stats),
TICK_TO_US(eNB->ulsch_demodulation_stats),
TICK_TO_US(eNB->ulsch_rate_unmatching_stats));
LOG_D(PHY, "td:%lld dei:%lld dem:%lld llr:%lld tci:%lld ",
LOG_D(PHY, "td:%lld dei:%lld dem:%lld llr:%lld tci:%lld \n",
TICK_TO_US(eNB->ulsch_turbo_decoding_stats),
TICK_TO_US(eNB->ulsch_deinterleaving_stats),
TICK_TO_US(eNB->ulsch_demultiplexing_stats),
......
......@@ -56,4 +56,4 @@ MESSAGE_DEF(SS_VT_TIME_OUT, MESSAGE_PRIORITY_MED, ss_vt_time_o
MESSAGE_DEF(SS_L1MACIND_CTRL, MESSAGE_PRIORITY_MED, ss_l1macind_ctrl_t , ss_l1macind_ctrl)
MESSAGE_DEF(SS_SYSTEM_IND, MESSAGE_PRIORITY_MED, ss_system_ind_t , ss_system_ind)
MESSAGE_DEF(SS_ULGRANT_INFO, MESSAGE_PRIORITY_MED, ss_ulgrant_info_t , ss_ulgrant_info)
......@@ -49,6 +49,7 @@
#define SS_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.ss_paging_ind
#define SS_NR_PAGING_IND(mSGpTR) (mSGpTR)->ittiMsg.ss_nr_paging_ind
#define SS_L1MACIND_CTRL(mSGpTR) (mSGpTR)->ittiMsg.ss_l1macind_ctrl
#define SS_ULGRANT_INFO(mSGpTR) (mSGpTR)->ittiMsg.ss_ulgrant_info
/** VNG */
#define SS_VNG_PROXY_REQ(mSGpTR) (mSGpTR)->ittiMsg.ss_vng_proxy_req
......@@ -70,7 +71,7 @@
/** NR SRB */
#define SS_RRC_PDU_REQ(mSGpTR) (mSGpTR)->ittiMsg.ss_rrc_pdu_req
#define SS_RRC_PDU_IND(mSGpTR) (mSGpTR)->ittiMsg.ss_rrc_pdu_ind
#define SS_ULGRANT_INFO(mSGpTR) (mSGpTR)->ittiMsg.ss_ulgrant_info
/** PORTMAN */
typedef struct ss_sys_port_msg_ind {
struct SYSTEM_CTRL_REQ* req;
......@@ -385,6 +386,7 @@ typedef struct harq_error_s {
typedef struct ss_system_ind_s
{
bool bitmask; //Flag for presence of optional parameter repetitionsPerPreambleAttempt
uint16_t hsfn;
frame_t sfn;
sub_frame_t sf;
int physCellId;
......@@ -397,4 +399,39 @@ typedef struct ss_system_ind_s
} ss_system_ind_t;
typedef union _ULGrantPeriodicity_u
{
int duration;
uint8_t onlyOnce;
}ULGrantPeriodicity_u;
typedef struct _transRep_type
{
uint8_t Continuous; /* This can have value '0' or '1'*/
int NumOfCycles;
}transRep_type_t;
typedef struct _periodicGrantType
{
uint8_t ULGrantPeriodType;
ULGrantPeriodicity_u period;
transRep_type_t transRepType;
uint32_t subframe_counter;
}periodicGrantType_t;
#define ON_SR_RECEPTION_PRESENT 1
#define PERIODIC_PRESENT 2
#define PERIODIC_ON_SR_RECEPTION_PRESENT 3
#define NONE_PRESENT 4
typedef struct _ss_ulgrant_info_t
{
uint8_t ulGrantType;
periodicGrantType_t periodiGrantInfo;
uint32_t cell_index;
}ss_ulgrant_info_t;
#endif /* SS_MESSAGES_TYPES_H_ */
......@@ -1008,7 +1008,11 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP,
void (*schedule_ulsch_p)(module_id_t module_idP, frame_t frameP, sub_frame_t subframe) = NULL;
void (*schedule_ue_spec_p)(module_id_t module_idP, frame_t frameP, sub_frame_t subframe, int *mbsfn_flag) = NULL;
if (eNB->scheduler_mode == SCHED_MODE_DEFAULT) {
if (RC.ss.mode >= SS_SOFTMODEM) {
schedule_ulsch_p = schedule_ulsch_ss;
schedule_ue_spec_p = schedule_dlsch_ss;
}
else if (eNB->scheduler_mode == SCHED_MODE_DEFAULT) {
schedule_ulsch_p = schedule_ulsch;
schedule_ue_spec_p = schedule_dlsch;
} else if (eNB->scheduler_mode == SCHED_MODE_FAIR_RR) {
......
......@@ -2503,3 +2503,62 @@ schedule_PCH(module_id_t module_idP,
stop_meas(&eNB->schedule_pch);
return;
}
void
schedule_dlsch_ss(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP, int *mbsfn_flag) {
if (is_pmch_subframe(frameP, subframeP, &RC.eNB[module_idP][0]->frame_parms))
return;
for (int CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++) {
// for TDD: check that we have to act here, otherwise skip
COMMON_channels_t *cc = &RC.mac[module_idP]->common_channels[CC_id];
if (cc->tdd_Config) {
int tdd_sfa = cc->tdd_Config->subframeAssignment;
switch (subframeP) {
case 0:
// always continue
break;
case 1:
case 2:
continue;
case 3:
if (tdd_sfa != 2 && tdd_sfa != 5)
continue;
break;
case 4:
if (tdd_sfa != 1 && tdd_sfa != 2 && tdd_sfa != 4 && tdd_sfa != 5)
continue;
break;
case 5:
break;
case 6:
case 7:
if (tdd_sfa != 3 && tdd_sfa != 4 && tdd_sfa != 5)
continue;
break;
case 8:
if (tdd_sfa != 2 && tdd_sfa != 3 && tdd_sfa != 4 && tdd_sfa != 5)
continue;
break;
case 9:
if (tdd_sfa == 0)
continue;
break;
}
}
if (mbsfn_flag[CC_id] != 0)
continue;
schedule_ue_spec(module_idP, CC_id, frameP, subframeP);
}
}
......@@ -495,6 +495,7 @@ rx_sdu(const module_id_t enb_mod_idP,
}
UE_template_ptr->ul_SR = 1;
LOG_D(MAC, "swetank: fxn:%s line:%d rnti:%d ul_SR=1\n", __FUNCTION__, __LINE__, UE_RNTI(enb_mod_idP, UE_id));
UE_scheduling_control->crnti_reconfigurationcomplete_flag = 1;
UE_info->UE_template[UE_PCCID(enb_mod_idP, UE_id)][UE_id].configured = 1;
cancel_ra_proc(enb_mod_idP,
......@@ -558,6 +559,7 @@ rx_sdu(const module_id_t enb_mod_idP,
}
UE_template_ptr->ul_SR = 1;
LOG_D(MAC, "swetank: fxn:%s line:%d rnti:%d ul_SR=1\n", __FUNCTION__, __LINE__, UE_RNTI(enb_mod_idP, UE_id));
UE_scheduling_control->crnti_reconfigurationcomplete_flag = 1;
} else {
cancel_ra_proc(enb_mod_idP, CC_idP, frameP, current_rnti);
......@@ -1894,6 +1896,7 @@ schedule_ulsch_rnti(module_id_t module_idP,
//uint8_t aggregation = 2;
int sched_frame = frameP;
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
if (sched_subframeP < subframeP) {
sched_frame++;
......@@ -1919,7 +1922,11 @@ schedule_ulsch_rnti(module_id_t module_idP,
for (int UE_id = UE_info->list.head; UE_id >= 0; UE_id = UE_info->list.next[UE_id]) {
if (UE_info->UE_template[CC_id][UE_id].rach_resource_type > 0)
{
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
continue;
}
// don't schedule if Msg5 is not received yet
if (UE_info->UE_template[CC_id][UE_id].configured == false) {
......@@ -2455,3 +2462,293 @@ schedule_ulsch_rnti(module_id_t module_idP,
} // end of round > 0
} // loop over UE_ids
}
bool check_ulGrant_Schedule(frame_t frameP, sub_frame_t subframeP, int CC_id, uint8_t SR_received)
{
static uint8_t first_scheduling = 0;
static frame_t next_scheduling_frame = 0;
static sub_frame_t next_scheduling_subframe = 0;
static uint32_t num_frame = 0;
static uint32_t num_subframe = 0;
LOG_I(MAC, "%s current frame:%d subframe:%d subframe_counter value:%d\n", __FUNCTION__, frameP, subframeP, RC.ss.ulgrant_info[CC_id].periodiGrantInfo.subframe_counter);
if (RC.ss.ulgrant_info[CC_id].ulGrantType == NONE_PRESENT)
{
LOG_I(MAC, "%s ulGrantType = NONE_PRESENT\n", __FUNCTION__);
return true;
}
if (RC.ss.ulgrant_info[CC_id].ulGrantType == ON_SR_RECEPTION_PRESENT )
{
LOG_I(MAC, "%s ulGrantType = ON_SR_RECEPTION_PRESENT\n", __FUNCTION__);
if (SR_received == 1)
{
LOG_D(MAC, " %s ULGrantType: ON_SR_RECEPTION_PRESENT. ULGrant Scheduled at frame:%d subframe:%d\n",
__FUNCTION__,
frameP,
subframeP);
return true;
}
else
{
LOG_I(MAC, "%s ulGrantType = ON_SR_RECEPTION_PRESENT but NOT scheduling\n", __FUNCTION__);
return false;
}
}
/* Handling periodic UL_Grant Configuration */
RC.ss.ulgrant_info[CC_id].periodiGrantInfo.subframe_counter++;
if (RC.ss.ulgrant_info[CC_id].periodiGrantInfo.transRepType.Continuous == 1)
RC.ss.ulgrant_info[CC_id].periodiGrantInfo.transRepType.NumOfCycles = 1;
LOG_I(MAC, "fxn:%s CC_id:%d RC.ss.ulgrant_info[CC_id].periodiGrantInfo.transRepType.Continuous:%d RC.ss.ulgrant_info[CC_id].periodiGrantInfo.transRepType.NumOfCycles:%d \n",
__FUNCTION__,
CC_id,
RC.ss.ulgrant_info[CC_id].periodiGrantInfo.transRepType.Continuous,
RC.ss.ulgrant_info[CC_id].periodiGrantInfo.transRepType.NumOfCycles);
while (RC.ss.ulgrant_info[CC_id].periodiGrantInfo.transRepType.NumOfCycles)
{
if ((RC.ss.ulgrant_info[CC_id].periodiGrantInfo.subframe_counter % RC.ss.ulgrant_info[CC_id].periodiGrantInfo.period.duration) == 0)
{
LOG_I(MAC, "%s subframe_counter value:%d\n", __FUNCTION__, RC.ss.ulgrant_info[CC_id].periodiGrantInfo.subframe_counter);
LOG_I(MAC, "%s ULGrant scheduled for current Frame %d Subframe:%d. Next ULGrant will be after %d subframe\n",
__FUNCTION__,
frameP,
subframeP,
RC.ss.ulgrant_info[CC_id].periodiGrantInfo.period.duration);
if (RC.ss.ulgrant_info[CC_id].periodiGrantInfo.transRepType.Continuous == 0)
RC.ss.ulgrant_info[CC_id].periodiGrantInfo.transRepType.NumOfCycles--;
return true;
}
else
{
return false;
}
}
RC.ss.ulgrant_info[CC_id].periodiGrantInfo.subframe_counter = 0;
/* When below return is hit, it means now ULGrant will be scheduled in all subframes */
return true;
}
void
schedule_ulsch_ss(module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP)
{
eNB_MAC_INST *mac = NULL;
COMMON_channels_t *cc = NULL;
int sched_subframe;
int sched_frame;
/* Init */
mac = RC.mac[module_idP];
start_meas(&(mac->schedule_ulsch));
sched_subframe = (subframeP + 4) % 10;
sched_frame = frameP;
bool schedule = false;
UE_info_t *UE_info = &RC.mac[module_idP]->UE_info;
int UE_id = 0;
uint8_t ue_found = 0;
/* Note: RC.nb_mac_CC[module_idP] should be lower than or equal to NFAPI_CC_MAX */
LOG_D(MAC, "swetank: num CC:%d\n", RC.nb_mac_CC[module_idP]);
for (int CC_id = 0; CC_id < RC.nb_mac_CC[module_idP]; CC_id++, cc++) {
/* MultiCell: Common channels modify for multiple CC */
cc = &RC.mac[module_idP]->common_channels[CC_id];
for (UE_id = 0; UE_id < MAX_MOBILES_PER_ENB; UE_id++) {
if (UE_info->active[CC_id][UE_id])
{
ue_found = 1;
LOG_D(MAC, "%s UE found with rnti:%d\n", __FUNCTION__, UE_RNTI(module_idP, UE_id));
break;
}
}
if (ue_found == 0)
{
LOG_D(MAC, "%s No UE found\n", __FUNCTION__);
return;
}
/* if schedule is false, it means SFN/SF for ULGrant had not yet arrived */
schedule = check_ulGrant_Schedule(frameP, subframeP, CC_id, UE_info->UE_template[CC_id][UE_id].ul_SR);
if (schedule == false )
continue;
LOG_D(MAC, "fxn:%s Scheduling ULGrant\n", __FUNCTION__);
/* For TDD: check subframes where we have to act and return if nothing should be done now */
if (cc->tdd_Config) { // Done only for CC_id = 0, assume tdd_Config for all CC_id
int tdd_sfa = cc->tdd_Config->subframeAssignment;
switch (subframeP) {
case 0:
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
if ((tdd_sfa == 0) || (tdd_sfa == 3))
sched_subframe = 4;
else if (tdd_sfa == 6)
sched_subframe = 7;
else
return;
break;
case 1:
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
if ((tdd_sfa == 0) || (tdd_sfa == 1))
sched_subframe = 7;
else if (tdd_sfa == 6)
sched_subframe = 8;
else
return;
break;
case 2: // Don't schedule UL in subframe 2 for TDD
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
return;
case 3:
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
if (tdd_sfa == 2)
sched_subframe = 7;
else
return;
break;
case 4:
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
if (tdd_sfa == 1)
sched_subframe = 8;
else
return;
break;
case 5:
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
if (tdd_sfa == 0)
sched_subframe = 9;
else if (tdd_sfa == 6)
sched_subframe = 2;
else
return;
break;
case 6:
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
if (tdd_sfa == 0 || tdd_sfa == 1)
sched_subframe = 2;
else if (tdd_sfa == 6)
sched_subframe = 3;
else
return;
break;
case 7:
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
return;
case 8:
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
if ((tdd_sfa >= 2) && (tdd_sfa <= 5))
sched_subframe = 2;
else
return;
break;
case 9:
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
if ((tdd_sfa == 1) || (tdd_sfa == 3) || (tdd_sfa == 4))
sched_subframe = 3;
else if (tdd_sfa == 6)
sched_subframe = 4;
else
return;
break;
default:
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
return;
}
}
if (sched_subframe < subframeP) {
sched_frame++;
sched_frame %= 1024;
}
int emtc_active[5];
memset(emtc_active, 0, 5 * sizeof(int));
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
schedule_ulsch_rnti_emtc(module_idP, frameP, subframeP, sched_subframe, emtc_active);
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
if (is_prach_subframe0(cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0,cc->tdd_Config!=NULL ? 1 : 0,
cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex,
sched_frame, sched_subframe)) {
int start_rb = get_prach_prb_offset(cc->tdd_Config!=NULL ? 1 : 0,
cc->tdd_Config!=NULL ? cc->tdd_Config->subframeAssignment : 0,
to_prb(cc->ul_Bandwidth),
cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_ConfigIndex,
cc->radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset,
0, // tdd_mapindex
sched_frame); // Nf
for (int i = 0; i < 6; i++)
cc->vrb_map_UL[start_rb + i] = 1;
}
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
/* HACK: let's remove the PUCCH from available RBs
* we suppose PUCCH size is:
* - for 25 RBs: 1 RB (top and bottom of ressource grid)
* - for 50: 2 RBs
* - for 100: 3 RBs
* This is totally arbitrary and might even be wrong.
*/
switch (to_prb(cc->ul_Bandwidth)) {
case 25:
cc->vrb_map_UL[0] = 1;
cc->vrb_map_UL[24] = 1;
break;
case 50:
cc->vrb_map_UL[0] = 1;
cc->vrb_map_UL[1] = 1;
cc->vrb_map_UL[48] = 1;
cc->vrb_map_UL[49] = 1;
break;
case 100:
cc->vrb_map_UL[0] = 1;
cc->vrb_map_UL[1] = 1;
cc->vrb_map_UL[2] = 1;
cc->vrb_map_UL[97] = 1;
cc->vrb_map_UL[98] = 1;
cc->vrb_map_UL[99] = 1;
break;
default:
LOG_E(MAC, "RBs setting not handled. Todo.\n");
exit(1);
}
LOG_D(MAC, "swetank: fxn:%s line:%d\n", __FUNCTION__, __LINE__);
schedule_ulsch_rnti(module_idP, CC_id, frameP, subframeP, sched_subframe);
}
LOG_D(MAC, "Exit from fxn:%s\n", __FUNCTION__);
stop_meas(&mac->schedule_ulsch);
}
......@@ -546,7 +546,8 @@ typedef enum {
/*!\brief scheduler mode */
typedef enum {
SCHED_MODE_DEFAULT = 0, /// default cheduler
SCHED_MODE_FAIR_RR /// fair raund robin
SCHED_MODE_FAIR_RR, /// fair raund robin
SCHED_MODE_SS // Scheduler for SS_SOFTMODEM mode
} SCHEDULER_MODES;
/*! \brief temporary struct for ULSCH sched */
......
......@@ -33,6 +33,11 @@
#include "PHY/defs_common.h" // for PRACH_RESOURCES_t and lte_subframe_t
#include "openair2/COMMON/mac_messages_types.h"
void schedule_dlsch_ss(module_id_t module_idP, frame_t frameP,
sub_frame_t subframe, int *mbsfn_flag);
/** \fn void schedule_fembms_mib(module_id_t module_idP,frame_t frameP,sub_frame_t subframe);
\brief MIB scheduling for PBCH. This function requests the MIB from RRC and provides it to L1.
@param Mod_id Instance ID of eNB
......@@ -1036,6 +1041,8 @@ uint8_t frame_subframe2_dl_harq_pid(LTE_TDD_Config_t *tdd_Config, int abs_frameP
uint8_t ul_subframe2_k_phich(COMMON_channels_t *cc, sub_frame_t ul_subframe);
void schedule_ulsch_ss(module_id_t module_idP, frame_t frameP, sub_frame_t subframe);
unsigned char ul_ACK_subframe2M(LTE_TDD_Config_t *tdd_Config,unsigned char subframe);
int to_rbg(int dl_Bandwidth);
......
......@@ -324,6 +324,20 @@ void *mac_enb_task(void *arg)
}
break;
case SS_ULGRANT_INFO:
/* This information will be used by scheduler function schedule_ulsch_ss & schedule_ue_spec_ss */
LOG_I(MAC, "Received SS_ULGRANT_INFO from SS for cell_index:%d\n", received_msg->ittiMsg.ss_ulgrant_info.cell_index);
memset(&RC.ss.ulgrant_info[received_msg->ittiMsg.ss_ulgrant_info.cell_index], 0, sizeof(ss_ulgrant_info_t));
memcpy(&RC.ss.ulgrant_info[received_msg->ittiMsg.ss_ulgrant_info.cell_index], &received_msg->ittiMsg.ss_ulgrant_info, sizeof(ss_ulgrant_info_t));
LOG_I(MAC,"cell_index:%d duration:%d numCycles:%d\n",
received_msg->ittiMsg.ss_ulgrant_info.cell_index,
received_msg->ittiMsg.ss_ulgrant_info.periodiGrantInfo.period.duration,
received_msg->ittiMsg.ss_ulgrant_info.periodiGrantInfo.transRepType.NumOfCycles);
LOG_I(MAC,"RC: duration:%d numCycles:%d\n",
RC.ss.ulgrant_info[received_msg->ittiMsg.ss_ulgrant_info.cell_index].periodiGrantInfo.period.duration,
RC.ss.ulgrant_info[received_msg->ittiMsg.ss_ulgrant_info.cell_index].periodiGrantInfo.transRepType.NumOfCycles);
break;
case TERMINATE_MESSAGE:
LOG_W(MAC, " *** Exiting MAC thread\n");
itti_exit_task();
......
......@@ -477,15 +477,15 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP,
if ((pdcp_p->security_activated != 0) &&
(((pdcp_p->cipheringAlgorithm) != 0) ||
((pdcp_p->integrityProtAlgorithm) != 0))) {
uint8_t ciphyeringAlgorithm = pdcp_p->cipheringAlgorithm;
uint8_t ciphyeringAlgorithm = pdcp_p->cipheringAlgorithm;
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
if (RC.ss.mode >= SS_SOFTMODEM) {
if(srb_flagP && rb_idP==1){
LTE_DL_DCCH_Message_t *dl_dcch_msg = NULL;
uper_decode(NULL, &asn_DEF_LTE_DL_DCCH_Message,
(void **)&dl_dcch_msg,
(const void *)sdu_buffer_pP,
sdu_buffer_sizeP, 0, 0);
if(srb_flagP && rb_idP==1){
LTE_DL_DCCH_Message_t *dl_dcch_msg = NULL;
uper_decode(NULL, &asn_DEF_LTE_DL_DCCH_Message,
(void **)&dl_dcch_msg,
(const void *)sdu_buffer_pP,
sdu_buffer_sizeP, 0, 0);
if(dl_dcch_msg){
if(dl_dcch_msg->message.choice.c1.present == LTE_DL_DCCH_MessageType__c1_PR_securityModeCommand){
pdcp_p->cipheringAlgorithm = 0;
......@@ -494,20 +494,20 @@ bool pdcp_data_req(protocol_ctxt_t *ctxt_pP,
ASN_STRUCT_FREE(asn_DEF_LTE_DL_DCCH_Message,dl_dcch_msg);
}
}
}
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].apply_security);
}
start_meas(&eNB_pdcp_stats[ctxt_pP->module_id].apply_security);
} else {
start_meas(&UE_pdcp_stats[ctxt_pP->module_id].apply_security);
}
pdcp_apply_security(ctxt_pP,
pdcp_p,
srb_flagP,
rb_idP % LTE_maxDRB,
pdcp_header_len,
current_sn,
pdcp_pdu_p->data,
sdu_buffer_sizeP);
pdcp_p,
srb_flagP,
rb_idP % LTE_maxDRB,
pdcp_header_len,
current_sn,
pdcp_pdu_p->data,
sdu_buffer_sizeP);
if (ctxt_pP->enb_flag == ENB_FLAG_YES) {
pdcp_p->cipheringAlgorithm = ciphyeringAlgorithm;
......@@ -1493,7 +1493,9 @@ pdcp_run (
RRC_DCCH_DATA_REQ (msg_p).muip,
RRC_DCCH_DATA_REQ (msg_p).confirmp,
RRC_DCCH_DATA_REQ (msg_p).mode);
LOG_D(PDCP, "Before calling pdcp_data_req from pdcp_run! RRC_DCCH_DATA_REQ (msg_p).rb_id: %ld \n", RRC_DCCH_DATA_REQ (msg_p).rb_id);
LOG_D(PDCP, "Before calling pdcp_data_req from pdcp_run! RRC_DCCH_DATA_REQ (msg_p).rb_id: %ld frame %d subframe %d\n",
RRC_DCCH_DATA_REQ (msg_p).rb_id,ctxt_pP->frame,ctxt_pP->subframe);
result = pdcp_data_req (&ctxt,
SRB_FLAG_YES,
RRC_DCCH_DATA_REQ (msg_p).rb_id,
......
......@@ -324,9 +324,9 @@ rlc_op_status_t rlc_data_req (const protocol_ctxt_t *const ctxt_pP,
if (MBMS_flagP == MBMS_FLAG_YES)
rnti = 0xfffd;
LOG_D(RLC, "%s rnti %d srb_flag %d rb_id %d mui %d confirm %d sdu_size %d MBMS_flag %d\n",
LOG_D(RLC, "%s rnti %d srb_flag %d rb_id %d mui %d confirm %d sdu_size %d MBMS_flag %d frame % subframe %d\n",
__FUNCTION__, rnti, srb_flagP, (int)rb_idP, muiP, confirmP, sdu_sizeP,
MBMS_flagP);
MBMS_flagP,ctxt_pP->frame,ctxt_pP->subframe);
if (ctxt_pP->enb_flag)
T(T_ENB_RLC_DL, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->rntiMaybeUEid), T_INT(rb_idP), T_INT(sdu_sizeP));
......
......@@ -380,7 +380,7 @@ mac_rrc_data_ind(
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0);
if((srb_idP & RAB_OFFSET) == CCCH) {
LOG_D(RRC, "[eNB %d] Received SDU for CCCH on SRB %ld\n", module_idP, srb_idP);
LOG_D(RRC, "[eNB %d] Received SDU for CCCH on SRB %ld SFN:%d SF:%d\n", module_idP, srb_idP, frameP, sub_frameP);
ctxt.brOption = brOption;
//#ifdef ENB_SS
......
......@@ -168,7 +168,7 @@ mac_rrc_data_ind_ue(
}
if(srb_idP == BCCH) {
LOG_D(RRC,"[UE %d] Received SDU for BCCH on SRB %ld from eNB %d\n",module_idP,srb_idP,eNB_indexP);
LOG_D(RRC,"[UE %d] Received SDU for BCCH on SRB %ld from eNB:%d SFN:%d SF:%d\n",module_idP,srb_idP,eNB_indexP, frameP, sub_frameP);
{
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_BCCH_DATA_IND (message_p).sdu);
......@@ -194,7 +194,7 @@ mac_rrc_data_ind_ue(
}
if(srb_idP == PCCH) {
LOG_D(RRC,"[UE %d] Received SDU for PCCH on SRB %ld from eNB %d\n",module_idP,srb_idP,eNB_indexP);
LOG_D(RRC,"[UE %d] Received SDU for PCCH on SRB %ld from eNB %d SFN:%d SF:%d\n",module_idP,srb_idP,eNB_indexP, frameP, sub_frameP);
decode_PCCH_DLSCH_Message(&ctxt,eNB_indexP,(uint8_t *)sduP,sdu_lenP);
}
......
......@@ -66,6 +66,7 @@ typedef struct SSConfigContext_s {
/** List of Cells */
SS_Cell_Context_t SSCell_list[8];
/** Timing info */
uint16_t hsfn;
uint16_t sfn;
uint8_t sf;
......
......@@ -51,6 +51,8 @@
#include "common/utils/LOG/ss-log.h"
#include "ss_eNB_context.h"
#include "ss_eNB_multicell_helper.h"
extern RAN_CONTEXT_t RC;
int get_cell_index(uint16_t cell_id, SS_Cell_Context_t SSCell_list[]){
for(int Cell_idx = 0; Cell_idx < 8; Cell_idx++){
......@@ -79,6 +81,8 @@ int get_cell_index_pci(uint16_t physCellId, SS_Cell_Context_t SSCell_list[]){
}
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));
for(int Cell_idx = 0; Cell_idx < 8; Cell_idx++){
SSCell_list[Cell_idx].eutra_cellId = -1;
}
......
......@@ -338,7 +338,7 @@ static inline void ss_eNB_read_from_socket(acpCtx_t ctx)
size_t msgSize = size; //2
unsigned char *buffer = (unsigned char *)acpMalloc(size);
assert(buffer);
LOG_D(ENB_SS, "Entry from fxn:%s\n", __FUNCTION__);
int userId = acpRecvMsg(ctx, &msgSize, buffer);
// Error handling
......@@ -349,17 +349,19 @@ static inline void ss_eNB_read_from_socket(acpCtx_t ctx)
// Message not mapped to user id,
// this error should not appear on server side for the messages
// received from clients
LOG_E(GNB_APP, "[SS-PORTMAN] Error: Message not mapped to user id\n");
}
else if (userId == -ACP_ERR_SIDL_FAILURE)
{
// Server returned service error,
// this error should not appear on server side for the messages
// received from clients
LOG_E(GNB_APP, "[SS-PORTMAN] Error: Server returned service error \n");
SidlStatus sidlStatus = -1;
acpGetMsgSidlStatus(msgSize, buffer, &sidlStatus);
}
else if (userId == -ACP_PEER_DISCONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer ordered shutdown\n");
LOG_E(GNB_APP, "[SS_SRB] Error: Peer ordered shutdown\n");
}
else if (userId == -ACP_PEER_CONNECTED){
LOG_A(GNB_APP, "[SS_SRB] Peer connection established\n");
......@@ -389,7 +391,7 @@ static inline void ss_eNB_read_from_socket(acpCtx_t ctx)
int send_res = itti_send_msg_to_task(TASK_SS_SRB, 0, message_p);
if (send_res < 0)
{
LOG_A(ENB_SS, "Error in sending Wake up signal /SS_RRC_PDU_IND (msg_Id:%d) to TASK_SS_SRB\n", SS_RRC_PDU_IND);
LOG_E(ENB_SS, "Error in sending Wake up signal /SS_RRC_PDU_IND (msg_Id:%d) to TASK_SS_SRB\n", SS_RRC_PDU_IND);
}
}
}
......@@ -404,16 +406,29 @@ static inline void ss_eNB_read_from_socket(acpCtx_t ctx)
if (userId == MSG_SysProcess_userId)
{
bool ret_Val = false;
struct SYSTEM_CTRL_REQ *sys_req = (struct SYSTEM_CTRL_REQ *)req;
if (sys_req->Request.d == SystemRequest_Type_EnquireTiming)
{
LOG_I(ENB_SS, "[SS-PORTMAN] Received EnquireTiming\n");
ret_Val = ss_eNB_port_man_handle_enquiryTiming(sys_req);
if (ret_Val == false)
LOG_E(ENB_SS, "Error Sending EnquiryTiming Respone to TTCN\n");
}
else
{
MessageDef *message_p = itti_alloc_new_message(TASK_SS_PORTMAN, 0, SS_SYS_PORT_MSG_IND);
if (message_p)
{
SS_SYS_PORT_MSG_IND(message_p).req = req;
SS_SYS_PORT_MSG_IND(message_p).userId = userId;
itti_send_msg_to_task(TASK_SYS, 0, message_p);
SS_SYS_PORT_MSG_IND(message_p).req = req;
SS_SYS_PORT_MSG_IND(message_p).userId = userId;
itti_send_msg_to_task(TASK_SYS, 0, message_p);
}
}
}
}
acpSysProcessFreeSrv(req);
LOG_D(ENB_SS, "Exit from fxn:%s\n", __FUNCTION__);
return;
}
......@@ -430,7 +445,7 @@ void *ss_port_man_process_itti_msg(void *notUsed)
{
MessageDef *received_msg = NULL;
int result;
LOG_D(ENB_SS, "Entry in fxn:%s\n", __FUNCTION__);
itti_poll_msg(TASK_SS_PORTMAN, &received_msg);
/* Check if there is a packet to handle */
......@@ -473,7 +488,7 @@ void *ss_port_man_process_itti_msg(void *notUsed)
}
ss_eNB_read_from_socket(ctx_g);
LOG_D(ENB_SS, "Exit from fxn:%s\n", __FUNCTION__);
return NULL;
}
......@@ -499,3 +514,60 @@ void *ss_eNB_port_man_task(void *arg)
return NULL;
}
bool ss_eNB_port_man_handle_enquiryTiming(struct SYSTEM_CTRL_REQ *sys_req)
{
struct SYSTEM_CTRL_CNF cnf;
const size_t msgSize = 16 * 1024;
unsigned char *buffer = (unsigned char *)acpMalloc(msgSize);
int status = 0;
if (!buffer)
return false;
memset(&cnf, 0, sizeof(cnf));
cnf.Common.CellId = sys_req->Common.CellId;
cnf.Common.RoutingInfo.d = RoutingInfo_Type_None;
cnf.Common.RoutingInfo.v.None = true;
cnf.Common.TimingInfo.d = TimingInfo_Type_SubFrame;
cnf.Common.TimingInfo.v.SubFrame.SFN.d = SystemFrameNumberInfo_Type_Number;
cnf.Common.TimingInfo.v.SubFrame.SFN.v.Number = SS_context.sfn;
cnf.Common.TimingInfo.v.SubFrame.Subframe.d = SubFrameInfo_Type_Number;
cnf.Common.TimingInfo.v.SubFrame.Subframe.v.Number = SS_context.sf;
cnf.Common.TimingInfo.v.SubFrame.HSFN.d = SystemFrameNumberInfo_Type_Number;
cnf.Common.TimingInfo.v.SubFrame.HSFN.v.Number = SS_context.hsfn;
cnf.Common.TimingInfo.v.SubFrame.Slot.d = SlotTimingInfo_Type_FirstSlot;
cnf.Common.TimingInfo.v.SubFrame.Slot.v.FirstSlot = true;
cnf.Common.Result.d = ConfirmationResult_Type_Success;
cnf.Common.Result.v.Success = true;
cnf.Confirm.d = SystemConfirm_Type_EnquireTiming;
cnf.Confirm.v.EnquireTiming = true;
/* Encode message */
if (acpSysProcessEncSrv(ctx_g, buffer, &msgSize, &cnf) != 0)
{
acpFree(buffer);
return false;
}
/* Send message */
status = acpSendMsg(ctx_g, msgSize, buffer);
if (status != 0)
{
LOG_A(ENB_SS, "[SS-PORTMAN] acpSendMsg failed for EnquiryTiming.\n");
acpFree(buffer);
return false;
}
LOG_A(ENB_SS, "[SS-PORTMAN] enquiryTiming CNF sent successfully for SFN:%d SF:%d\n",
cnf.Common.TimingInfo.v.SubFrame.SFN.v.Number,
cnf.Common.TimingInfo.v.SubFrame.Subframe.v.Number);
return true;
}
......@@ -21,8 +21,11 @@
#ifndef SS_ENB_TASK_PORT_MAN_H_
#define SS_ENB_TASK_PORT_MAN_H_
#include "acpSys.h"
void ss_eNB_port_man_init(void);
void *ss_eNB_port_man_task(void *arg);
void *ss_eNB_port_man_acp_task(void *arg);
bool ss_eNB_port_man_handle_enquiryTiming(struct SYSTEM_CTRL_REQ *sys_req);
#endif /* SS_ENB_TASK_PORT_MAN_H_ */
......@@ -32,7 +32,6 @@ typedef enum proxy_ss_message_id {
SS_VNG_CMD_RESP = 8,
SS_VTP_REQ = 9,
SS_VTP_RESP = 10,
SS_VTP_ENABLE = 11,
SS_INVALID_MSG = 0xFF
} proxy_ss_msgs_e;
......
......@@ -124,7 +124,7 @@ static void ss_send_srb_data(ss_rrc_pdu_ind_t *pdu_ind,int cell_index)
ind.Common.TimingInfo.v.SubFrame.Subframe.v.Number = pdu_ind->subframe;
ind.Common.TimingInfo.v.SubFrame.HSFN.d = SystemFrameNumberInfo_Type_Number;
ind.Common.TimingInfo.v.SubFrame.HSFN.v.Number = 0;
ind.Common.TimingInfo.v.SubFrame.HSFN.v.Number = 1;
ind.Common.TimingInfo.v.SubFrame.Slot.d = SlotTimingInfo_Type_Any;
ind.Common.TimingInfo.v.SubFrame.Slot.v.Any = true;
......@@ -260,19 +260,22 @@ static void ss_task_handle_rrc_pdu_req(struct EUTRA_RRC_PDU_REQ *req)
if (req->Common.TimingInfo.d == TimingInfo_Type_SubFrame)
{
ss_set_timinfo_t tinfo, timer_tinfo;
memset(&tinfo, 0, sizeof(tinfo));
memset(&timer_tinfo, 0, sizeof(timer_tinfo));
tinfo.sfn = req->Common.TimingInfo.v.SubFrame.SFN.v.Number;
tinfo.sf = req->Common.TimingInfo.v.SubFrame.Subframe.v.Number;
timer_tinfo = tinfo;
msg_queued = msg_can_be_queued(tinfo, &timer_tinfo);
LOG_I(ENB_SS, "msg_queued:%d\n",msg_queued);
LOG_A(ENB_SS,"VT_TIMER SRB task received MSG for future SFN %d , SF %d\n",tinfo.sfn,tinfo.sf);
if(msg_queued)
{
msg_queued = vt_timer_setup(timer_tinfo, TASK_RRC_ENB, instance_g,message_p);
}
LOG_A(ENB_SS, "RRC_PDU Queued as the scheduled SFN is %d SF: %d and curr SFN %d , SF %d\n",
LOG_A(ENB_SS, "RRC_PDU Queued as the scheduled SFN is %d SF: %d and curr SFN %d , SF %d",
tinfo.sfn,tinfo.sf, SS_context.sfn,SS_context.sf);
}
LOG_I(ENB_SS, "msg_queued2:%d\n",msg_queued);
}
if (!msg_queued)
......@@ -347,32 +350,32 @@ ss_eNB_read_from_srb_socket(acpCtx_t ctx)
}
}
else if (MSG_SysSrbProcessFromSS_userId == userId)
{
struct EUTRA_RRC_PDU_REQ *req = NULL;
LOG_A(ENB_SS, "[SS_SRB][EUTRA_RRC_PDU_REQ] EUTRA_RRC_PDU_REQ Received \n");
// Got the message
if (acpSysSrbProcessFromSSDecSrv(ctx, buffer, msgSize, &req) != 0)
{
LOG_A(ENB_SS, "[SS_SRB][EUTRA_RRC_PDU_REQ] acpSysSrbProcessFromSSDecSrv Failed\n");
break;
}
if(req->Common.CellId){
cell_index = get_cell_index(req->Common.CellId, SS_context.SSCell_list);
SS_context.SSCell_list[cell_index].eutra_cellId = req->Common.CellId;
LOG_A(ENB_SS,"[SS_SRB] cell_index: %d eutra_cellId: %d PhysicalCellId: %d \n",cell_index,SS_context.SSCell_list[cell_index].eutra_cellId,SS_context.SSCell_list[cell_index].PhysicalCellId);
}
if (SS_context.SSCell_list[cell_index].State >= SS_STATE_CELL_ACTIVE)
{
ss_task_handle_rrc_pdu_req(req);
}
else
{
LOG_A(ENB_SS, "ERROR [SS_SRB][EUTRA_RRC_PDU_REQ] received in SS state %d \n", SS_context.SSCell_list[cell_index].State);
}
acpSysSrbProcessFromSSFreeSrv(req);
return;
}
{
struct EUTRA_RRC_PDU_REQ *req = NULL;
LOG_A(ENB_SS, "[SS_SRB][EUTRA_RRC_PDU_REQ] EUTRA_RRC_PDU_REQ Received \n");
// Got the message
if (acpSysSrbProcessFromSSDecSrv(ctx, buffer, msgSize, &req) != 0)
{
LOG_A(ENB_SS, "[SS_SRB][EUTRA_RRC_PDU_REQ] acpSysSrbProcessFromSSDecSrv Failed\n");
break;
}
if(req->Common.CellId){
cell_index = get_cell_index(req->Common.CellId, SS_context.SSCell_list);
SS_context.SSCell_list[cell_index].eutra_cellId = req->Common.CellId;
LOG_A(ENB_SS,"[SS_SRB] cell_index: %d eutra_cellId: %d PhysicalCellId: %d \n",cell_index,SS_context.SSCell_list[cell_index].eutra_cellId,SS_context.SSCell_list[cell_index].PhysicalCellId);
}
if (SS_context.SSCell_list[cell_index].State >= SS_STATE_CELL_ACTIVE)
{
ss_task_handle_rrc_pdu_req(req);
}
else
{
LOG_A(ENB_SS, "ERROR [SS_SRB][EUTRA_RRC_PDU_REQ] received in SS state %d \n", SS_context.SSCell_list[cell_index].State);
}
acpSysSrbProcessFromSSFreeSrv(req);
return;
}
else if (MSG_SysSrbProcessToSS_userId == userId)
{
LOG_A(ENB_SS, "[SS_SRB][EUTRA_RRC_PDU_IND] EUTRA_RRC_PDU_IND Received; ignoring \n");
......
......@@ -309,6 +309,7 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
cellConfig->header.preamble = 0xFEEDC0DE;
cellConfig->header.msg_id = SS_CELL_CONFIG;
cellConfig->header.length = sizeof(proxy_ss_header_t);
MessageDef *msg_p = NULL;
for (int enb_id = 0; enb_id < RC.nb_inst; enb_id++)
{
......@@ -325,16 +326,16 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
/** TDD: 1 FDD: 0 in OAI */
switch (AddOrReconfigure->Basic.v.StaticCellInfo.v.Common.RAT.d)
{
case EUTRA_RAT_Type_FDD:
RRC_CONFIGURATION_REQ(msg_p).frame_type[cell_index] = 0; /** FDD */
break;
case EUTRA_RAT_Type_TDD:
RRC_CONFIGURATION_REQ(msg_p).frame_type[cell_index] = 1; /** TDD */
break;
case EUTRA_RAT_Type_HalfDuplexFDD:
case EUTRA_RAT_Type_UNBOUND_VALUE:
/* LOG */
return false;
case EUTRA_RAT_Type_FDD:
RRC_CONFIGURATION_REQ(msg_p).frame_type[cell_index] = 0; /** FDD */
break;
case EUTRA_RAT_Type_TDD:
RRC_CONFIGURATION_REQ(msg_p).frame_type[cell_index] = 1; /** TDD */
break;
case EUTRA_RAT_Type_HalfDuplexFDD:
case EUTRA_RAT_Type_UNBOUND_VALUE:
/* LOG */
return false;
}
int band = AddOrReconfigure->Basic.v.StaticCellInfo.v.Common.EutraBand;
......@@ -362,28 +363,28 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
switch (AddOrReconfigure->Basic.v.StaticCellInfo.v.Downlink.Bandwidth)
{
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n6:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 6;
break;
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n15:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 15;
break;
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n25:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 25;
break;
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n50:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 50;
break;
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n75:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 75;
break;
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n100:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 100;
break;
default:
/** LOG */
LOG_A(ENB_SS, "[SYS] CellConfigRequest Invalid DL Bandwidth configuration \n");
return false;
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n6:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 6;
break;
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n15:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 15;
break;
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n25:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 25;
break;
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n50:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 50;
break;
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n75:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 75;
break;
case SQN_CarrierBandwidthEUTRA_dl_Bandwidth_e_n100:
RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index] = 100;
break;
default:
/** LOG */
LOG_A(ENB_SS, "[SYS] CellConfigRequest Invalid DL Bandwidth configuration \n");
return false;
}
LOG_A(ENB_SS, "[SYS] DL Bandwidth for cellIndex(%d):%d\n", cell_index, RRC_CONFIGURATION_REQ(msg_p).N_RB_DL[cell_index]);
}
......@@ -402,40 +403,40 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
LOG_A(ENB_SS, "[SYS] CellConfigRequest PHICH Duration: %d\n", BCCH_CONFIG.v.BcchInfo.v.MIB.v.message.phich_Config.phich_Duration);
switch (AddOrReconfigure->Basic.v.BcchConfig.v.BcchInfo.v.MIB.v.message.phich_Config.phich_Duration)
{
case SQN_PHICH_Config_phich_Duration_e_normal:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_duration = LTE_PHICH_Config__phich_Duration_normal;
break;
case SQN_PHICH_Config_phich_Duration_e_extended:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_duration = LTE_PHICH_Config__phich_Duration_extended;
break;
default:
LOG_A(ENB_SS, "[SYS] CellConfigRequest Invalid PHICH Duration\n");
return false;
case SQN_PHICH_Config_phich_Duration_e_normal:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_duration = LTE_PHICH_Config__phich_Duration_normal;
break;
case SQN_PHICH_Config_phich_Duration_e_extended:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_duration = LTE_PHICH_Config__phich_Duration_extended;
break;
default:
LOG_A(ENB_SS, "[SYS] CellConfigRequest Invalid PHICH Duration\n");
return false;
}
LOG_A(ENB_SS, "[SYS] CellConfigRequest PHICH Resource: %d\n", BCCH_CONFIG.v.BcchInfo.v.MIB.v.message.phich_Config.phich_Resource);
switch (AddOrReconfigure->Basic.v.BcchConfig.v.BcchInfo.v.MIB.v.message.phich_Config.phich_Resource)
{
case SQN_PHICH_Config_phich_Resource_e_oneSixth:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_resource = LTE_PHICH_Config__phich_Resource_oneSixth;
break;
case SQN_PHICH_Config_phich_Resource_e_half:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_resource = LTE_PHICH_Config__phich_Resource_half;
break;
case SQN_PHICH_Config_phich_Resource_e_one:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_resource = LTE_PHICH_Config__phich_Resource_one;
break;
case SQN_PHICH_Config_phich_Resource_e_two:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_resource = LTE_PHICH_Config__phich_Resource_two;
break;
default:
LOG_A(ENB_SS, "[SYS] CellConfigRequest Invalid PHICH Resource\n");
return false;
case SQN_PHICH_Config_phich_Resource_e_oneSixth:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_resource = LTE_PHICH_Config__phich_Resource_oneSixth;
break;
case SQN_PHICH_Config_phich_Resource_e_half:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_resource = LTE_PHICH_Config__phich_Resource_half;
break;
case SQN_PHICH_Config_phich_Resource_e_one:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_resource = LTE_PHICH_Config__phich_Resource_one;
break;
case SQN_PHICH_Config_phich_Resource_e_two:
RRC_CONFIGURATION_REQ(msg_p).radioresourceconfig[cell_index].phich_resource = LTE_PHICH_Config__phich_Resource_two;
break;
default:
LOG_A(ENB_SS, "[SYS] CellConfigRequest Invalid PHICH Resource\n");
return false;
}
RRC_CONFIGURATION_REQ(msg_p).schedulingInfoSIB1_BR_r13[cell_index] = AddOrReconfigure->Basic.v.BcchConfig.v.BcchInfo.v.MIB.v.message.schedulingInfoSIB1_BR_r13;
}
/** TODO: FIXME: Possible bug if not checking boolean flag for presence */
/** TODO: FIXME: Possible bug if not checking boolean flag for presence */
#define SIDL_SIB1_VAL AddOrReconfigure->Basic.v.BcchConfig.v.BcchInfo.v.SIB1.v.message.v
#define SIB1_CELL_ACCESS_REL_INFO SIDL_SIB1_VAL.c1.v.systemInformationBlockType1.cellAccessRelatedInfo
#define SIB1_CELL_SEL_INFO SIDL_SIB1_VAL.c1.v.systemInformationBlockType1.cellSelectionInfo
......@@ -682,7 +683,7 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
{
msg_queued = vt_timer_setup(timer_tinfo, TASK_RRC_ENB, 0,msg_p);
LOG_A(ENB_SS, "Cell_Config Queued as the scheduled SFN is %d SF: %d and curr SFN %d , SF %d\n",
tinfo.sfn,tinfo.sf, SS_context.sfn,SS_context.sf);
tinfo.sfn,tinfo.sf, SS_context.sfn,SS_context.sf);
}
}
......@@ -698,18 +699,18 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
SS_context.SSCell_list[cell_index].maxRefPower = AddOrReconfigure->Basic.v.InitialCellPower.v.MaxReferencePower;
switch (AddOrReconfigure->Basic.v.InitialCellPower.v.Attenuation.d)
{
case Attenuation_Type_Value:
LOG_A(ENB_SS, "[SYS] [InitialCellPower.v.Attenuation.v.Value] Attenuation turned on value: %d dBm \n",
case Attenuation_Type_Value:
LOG_A(ENB_SS, "[SYS] [InitialCellPower.v.Attenuation.v.Value] Attenuation turned on value: %d dBm \n",
AddOrReconfigure->Basic.v.InitialCellPower.v.Attenuation.v.Value);
cellConfig->initialAttenuation = AddOrReconfigure->Basic.v.InitialCellPower.v.Attenuation.v.Value;
break;
case Attenuation_Type_Off:
LOG_A(ENB_SS, "[SYS] [InitialCellPower.v.Attenuation.v.Value] Attenuation turned off \n");
cellConfig->initialAttenuation = 80; /* attnVal hardcoded currently but Need to handle proper Attenuation_Type_Off */
break;
case Attenuation_Type_UNBOUND_VALUE:
default:
LOG_A(ENB_SS, "[SYS] [InitialCellPower.v.Attenuation.v.Value] Unbound or Invalid value received\n");
cellConfig->initialAttenuation = AddOrReconfigure->Basic.v.InitialCellPower.v.Attenuation.v.Value;
break;
case Attenuation_Type_Off:
LOG_A(ENB_SS, "[SYS] [InitialCellPower.v.Attenuation.v.Value] Attenuation turned off \n");
cellConfig->initialAttenuation = 80; /* attnVal hardcoded currently but Need to handle proper Attenuation_Type_Off */
break;
case Attenuation_Type_UNBOUND_VALUE:
default:
LOG_A(ENB_SS, "[SYS] [InitialCellPower.v.Attenuation.v.Value] Unbound or Invalid value received\n");
}
cellConfig->header.cell_id = SS_context.SSCell_list[cell_index].PhysicalCellId;
......@@ -717,9 +718,9 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
cellConfig->dl_earfcn = SS_context.SSCell_list[cell_index].dl_earfcn;
cellConfig->header.cell_index = cell_index;
LOG_A(ENB_SS, "===Cell configuration received for cell_id: %d Initial attenuation: %d Max ref power: %d for DL_EARFCN: %d cell_index %d=== \n",
cellConfig->header.cell_id,
cellConfig->initialAttenuation, cellConfig->maxRefPower,
cellConfig->dl_earfcn, cell_index);
cellConfig->header.cell_id,
cellConfig->initialAttenuation, cellConfig->maxRefPower,
cellConfig->dl_earfcn, cell_index);
sys_send_proxy((void *)cellConfig, sizeof(CellConfigReq_t), msg_queued, timer_tinfo);
}
}
......@@ -793,10 +794,118 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
}
LOG_A(ENB_APP, "SS: ActiveParamPresent: %d, RlcPduCCCH_Present: %d, RLC Container PDU size: %d \n", RRC_CONFIGURATION_REQ(msg_p).ActiveParamPresent[cell_index], RRC_CONFIGURATION_REQ(msg_p).RlcPduCCCH_Present[cell_index], RRC_CONFIGURATION_REQ(msg_p).RlcPduCCCH_Size[cell_index]);
// store the modified cell config back
memcpy(&(RC.rrc[enb_id]->configuration), &RRC_CONFIGURATION_REQ(msg_p), sizeof(RRC_CONFIGURATION_REQ(msg_p)));
memcpy(&(RC.rrc[enb_id]->configuration), &RRC_CONFIGURATION_REQ(msg_p), sizeof(RRC_CONFIGURATION_REQ(msg_p)));
LOG_A(ENB_SS, "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);
/* Active Config for ULGrant Params */
bool destTaskMAC = false;
for (int enb_id = 0; enb_id < RC.nb_inst; enb_id++)
{
if (AddOrReconfigure->Active.d == true)
{
do
{
if (AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.d == true)
{
msg_p = itti_alloc_new_message(TASK_ENB_APP, ENB_MODULE_ID_TO_INSTANCE(enb_id), SS_ULGRANT_INFO);
LOG_I(ENB_SS, "[SYS] Received ULGrant in Active State\n");
SS_ULGRANT_INFO(msg_p).cell_index = cell_index;
if (AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.d == UL_GrantConfig_Type_OnSR_Reception)
{
RC.ss.ulgrant_info[cell_index].ulGrantType = ON_SR_RECEPTION_PRESENT;
SS_ULGRANT_INFO(msg_p).ulGrantType = ON_SR_RECEPTION_PRESENT;
LOG_I(ENB_SS, "[SYS] Received ulGrantType ON_SR_RECEPTION\n");
}
else if (AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.d == UL_GrantConfig_Type_None)
{
RC.ss.ulgrant_info[cell_index].ulGrantType = NONE_PRESENT;
SS_ULGRANT_INFO(msg_p).ulGrantType = NONE_PRESENT;
LOG_I(ENB_SS, "[SYS] Received ulGrantType UL_GrantConfig_Type_None\n");
}
else if (AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.d == UL_GrantConfig_Type_Periodic)
{
SS_ULGRANT_INFO(msg_p).ulGrantType = PERIODIC_PRESENT;
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.ULGrantPeriodType =
AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.v.Periodic.Period.d;
LOG_I(ENB_SS, "[SYS] ULGrantPeriodType:%d\n", SS_ULGRANT_INFO(msg_p).periodiGrantInfo.ULGrantPeriodType);
if (AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.v.Periodic.Period.d == ULGrant_Period_Type_Duration)
{
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.period.duration =
AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.v.Periodic.Period.v.Duration;
LOG_I(ENB_SS, "[SYS] Received Periodic ULGrant type ULGrant_Period_Type_Duration: %d received:%d\n",
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.period.duration,
AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.v.Periodic.Period.v.Duration);
}
else if (AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.v.Periodic.Period.d == ULGrant_Period_Type_OnlyOnce)
{
LOG_I(ENB_SS, "[SYS] Received Periodic ULGrant type ULGrant_Period_Type_OnlyOnce\n");
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.period.onlyOnce = true;
}
if (AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.v.Periodic.NoOfRepetitions.d == 1)
{
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.transRepType.Continuous = 1;
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.transRepType.NumOfCycles = 0;
LOG_I(ENB_SS, "[SYS] line:%d Continuous:%d NumOfCycles:%d\n",
__LINE__,
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.transRepType.Continuous,
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.transRepType.NumOfCycles);
}
else if (AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.v.Periodic.NoOfRepetitions.d == 2)
{
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.transRepType.NumOfCycles =
AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.v.Periodic.NoOfRepetitions.v.NumOfCycles;
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.transRepType.Continuous = 0;
LOG_I(ENB_SS, "[SYS] line:%d Continuous:%d NumOfCycles:%d\n",
__LINE__,
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.transRepType.Continuous,
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.transRepType.NumOfCycles);
}
else
{
LOG_A(ENB_SS, "[SYS] Received invalid Transmission Repetation Type in Periodic ULGrant%d\n",
SS_ULGRANT_INFO(msg_p).periodiGrantInfo.ULGrantPeriodType);
break;
}
destTaskMAC = true;
}
else
{
LOG_A(ENB_SS, "[SYS] ULGrantType %d is not supported. Current supported ULGrant is OnSR_Reception & periodic only \n",
AddOrReconfigure->Active.v.CcchDcchDtchConfig.v.UL.v.UL_GrantConfig.v.d);
}
}
}while(0);
}
/* Currently only queuing UL_GrantConfig from Cell Config API. On timer expiry, message will be sent to MAC */
if (destTaskMAC == true)
{
uint8_t msg_queued = 0;
/* Checking if message have to be queued */
if (req->Common.TimingInfo.d == TimingInfo_Type_SubFrame)
{
ss_set_timinfo_t tinfo;
tinfo.sfn = req->Common.TimingInfo.v.SubFrame.SFN.v.Number;
tinfo.sf = req->Common.TimingInfo.v.SubFrame.Subframe.v.Number;
if (tinfo.sfn > SS_context.sfn || tinfo.sf > SS_context.sf)
{
msg_queued = vt_timer_setup(tinfo, TASK_MAC_ENB, 0, msg_p);
}
LOG_A(ENB_SS,"Enquiry Timing MSG queued for future SFN %d , SF %d\n",tinfo.sfn,tinfo.sf);
}
if (!msg_queued)
{
LOG_A(ENB_SS, "Sending SS_ULGRANT_INFO to MAC\n");
itti_send_msg_to_task(TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
}
}
}
}
return true;
}
/*
......@@ -813,9 +922,6 @@ static void send_sys_cnf(enum ConfirmationResult_Type_Sel resType,
enum SystemConfirm_Type_Sel cnfType,
void *msg)
{
struct SYSTEM_CTRL_CNF *msgCnf = CALLOC(1, sizeof(struct SYSTEM_CTRL_CNF));
MessageDef *message_p = itti_alloc_new_message(TASK_SYS, 0, SS_SYS_PORT_MSG_CNF);
/* The request has send confirm flag flase so do nothing in this funciton */
if (reqCnfFlag_g == false)
{
......@@ -823,6 +929,9 @@ static void send_sys_cnf(enum ConfirmationResult_Type_Sel resType,
return ;
}
struct SYSTEM_CTRL_CNF *msgCnf = CALLOC(1, sizeof(struct SYSTEM_CTRL_CNF));
MessageDef *message_p = itti_alloc_new_message(TASK_SYS, 0, SS_SYS_PORT_MSG_CNF);
if (message_p)
{
LOG_A(ENB_SS, "[SYS] Send SS_SYS_PORT_MSG_CNF\n");
......@@ -1718,27 +1827,11 @@ static void sys_handle_paging_req(struct PagingTrigger_Type *pagingRequest, ss_s
LOG_A(ENB_SS, "[SYS] Exit sys_handle_paging_req Paging_IND processing for Cell_id %d \n", cellId);
}
/*
* Function : sys_handle_enquire_timing
* Description: Sends the enquire timing update to PORTMAN
*/
static void sys_handle_enquire_timing(ss_set_timinfo_t *tinfo)
static void sys_vt_add_sf(uint16_t *frameP, uint8_t *subframeP, int offset)
{
MessageDef *message_p = itti_alloc_new_message(TASK_SYS, 0,SS_SET_TIM_INFO);
if (message_p)
{
LOG_A(ENB_SS, "[SYS] Reporting info sfn:%d\t sf:%d.\n", tinfo->sfn, tinfo->sf);
SS_SET_TIM_INFO(message_p).sf = tinfo->sf;
SS_SET_TIM_INFO(message_p).sfn = tinfo->sfn;
SS_SET_TIM_INFO(message_p).cell_index = cell_index;
*frameP = (*frameP + ((*subframeP + offset) / 10))%1024;
int send_res = itti_send_msg_to_task(TASK_SS_PORTMAN, 0, message_p);
if (send_res < 0)
{
LOG_A(ENB_SS, "[SYS] Error sending to [SS-PORTMAN]");
}
}
*subframeP = ((*subframeP + offset) % 10);
}
static void sys_handle_l1macind_ctrl(struct SYSTEM_CTRL_REQ *req)
......@@ -1803,6 +1896,7 @@ static void sys_handle_l1macind_ctrl(struct SYSTEM_CTRL_REQ *req)
if(msg_queued)
{
sys_vt_add_sf(&timer_tinfo.sfn,&timer_tinfo.sf,5);
msg_queued = vt_timer_setup(timer_tinfo, TASK_MAC_ENB, 0,message_p);
}
LOG_A(ENB_SS, "RRC_PDU Queued as the scheduled SFN is %d SF: %d and curr SFN %d , SF %d",
......@@ -2062,6 +2156,7 @@ static void sys_handle_as_security_req(struct SYSTEM_CTRL_REQ *req)
*/
static void ss_task_sys_handle_req(struct SYSTEM_CTRL_REQ *req, ss_set_timinfo_t *tinfo)
{
LOG_A(ENB_SS, "swetank1212: SFN:%d SF:%d\n", req->Common.TimingInfo.v.SubFrame.SFN.v.Number, req->Common.TimingInfo.v.SubFrame.Subframe.v.Number);
if(req->Common.CellId){
cell_index = get_cell_index(req->Common.CellId, SS_context.SSCell_list);
SS_context.SSCell_list[cell_index].eutra_cellId = req->Common.CellId;
......@@ -2132,11 +2227,6 @@ static void ss_task_sys_handle_req(struct SYSTEM_CTRL_REQ *req, ss_set_timinfo_t
LOG_A(ENB_SS, "[SYS] SystemRequest_Type_CellAttenuationList received\n");
sys_handle_cell_attn_req(req);
break;
case SystemRequest_Type_EnquireTiming:
sys_handle_enquire_timing(tinfo);
LOG_A(ENB_SS, "[SYS] SystemRequest_Type_EnquireTiming received\n");
break;
case SystemRequest_Type_PdcpCount:
LOG_A(ENB_SS, "[SYS] SystemRequest_Type PDCP_Count received\n");
sys_handle_pdcp_count_req(&(req->Request.v.PdcpCount));
......@@ -2257,14 +2347,6 @@ bool valid_sys_msg(struct SYSTEM_CTRL_REQ *req)
cnfType = SystemConfirm_Type_Cell;
}
break;
case SystemRequest_Type_EnquireTiming:
if (SS_context.SSCell_list[cell_index].State == SS_STATE_CELL_ACTIVE)
{
valid = true;
sendDummyCnf = false;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
}
break;
case SystemRequest_Type_CellAttenuationList:
if (SS_context.SSCell_list[cell_index].State == SS_STATE_CELL_ACTIVE)
{
......@@ -2367,9 +2449,11 @@ void *ss_eNB_sys_process_itti_msg(void *notUsed)
SS_context.sfn = tinfo.sfn;
SS_context.sf = tinfo.sf;
// SS_context.hsfn = tinfo.hsfn;
g_log->sfn = tinfo.sfn;
g_log->sf = (uint32_t)tinfo.sf;
LOG_A(ENB_SS_SYS_TASK_, "[SYS] received SS_UPD_TIM_INFO SFN: %d SF: %d\n", tinfo.sfn, tinfo.sf);
}
break;
......
......@@ -124,7 +124,11 @@ static void ss_send_sysind_data(ss_system_ind_t *p_ind,int cell_index)
LOG_A(ENB_SS, "[SS_SYSIND] SYSTEM_IND with UL HARQ %d\n", p_ind->UL_Harq);
ind.Indication.d = SystemIndication_Type_UL_HARQ;
if (p_ind->UL_Harq)
{
ind.Common.RlcBearerRouting.d = false ;
ind.Common.TimingInfo.v.SubFrame.HSFN.v.Number = 1;
ind.Indication.v.UL_HARQ = HARQ_Type_ack;
}
else
ind.Indication.v.UL_HARQ = HARQ_Type_nack;
}
......
......@@ -75,8 +75,8 @@ uint8_t msg_can_be_queued(ss_set_timinfo_t req_tinfo, ss_set_timinfo_t *timer_ti
/*It is nonsense to check req_tinfo is after curr_tinfo */
if(req_tinfo.sfn != curr_tinfo.sfn || ((req_tinfo.sfn == curr_tinfo.sfn) && (req_tinfo.sf - curr_tinfo.sf) > 0) )
{
LOG_A(ENB_APP,"VT_TIMER MSG to be queued TRUE for SFN %d , SF %d\n",timer_tinfo->sfn,timer_tinfo->sf);
vt_subtract_sf(&timer_tinfo->sfn,&timer_tinfo->sf, 4); /* queued ahead of 4 subframes because of mac schedule 4 subframes ahead when processing */
LOG_A(ENB_APP,"VT_TIMER MSG to be queued TRUE for SFN %d , SF %d\n",timer_tinfo->sfn,timer_tinfo->sf);
return true;
}
......@@ -89,12 +89,14 @@ uint8_t msg_can_be_queued(ss_set_timinfo_t req_tinfo, ss_set_timinfo_t *timer_ti
*/
uint8_t vt_timer_setup(ss_set_timinfo_t tinfo, task_id_t task_id,instance_t instance, void *msg)
{
LOG_A(ENB_APP,"VT_TIMER setup1 for SFN %d , SF %d\n",tinfo.sfn,tinfo.sf);
uint32_t sfnSfKey = (tinfo.sfn << 4) | tinfo.sf;
vt_timer_elm_t *timer_ele_p;
timer_ele_p = calloc(1, sizeof(vt_timer_elm_t));
timer_ele_p->instance = instance;
timer_ele_p->task_id = task_id;
timer_ele_p->msg = msg;
LOG_A(ENB_APP,"VT_TIMER setup2 for SFN %d , SF %d\n",tinfo.sfn,tinfo.sf);
if (hashtable_insert(SS_context.vt_timer_table,
(hash_key_t)sfnSfKey, (void *)timer_ele_p) == HASH_TABLE_OK)
......@@ -102,6 +104,7 @@ uint8_t vt_timer_setup(ss_set_timinfo_t tinfo, task_id_t task_id,instance_t inst
LOG_A(ENB_APP,"VT_TIMER setup for SFN %d , SF %d\n",tinfo.sfn,tinfo.sf);
return 1;
}
LOG_A(ENB_APP,"VT_TIMER not setup for SFN %d , SF %d\n",tinfo.sfn,tinfo.sf);
return 0;
}
/*
......@@ -142,7 +145,6 @@ static inline void ss_vt_timer_check(ss_set_timinfo_t tinfo)
LOG_D(ENB_APP,"VT_TIMER Timeout sending done curr SFN %d SF %d\n",
SS_context.sfn,SS_context.sf);
}
}
/*
......
......@@ -201,26 +201,6 @@ static inline void ss_send_vtp_resp(struct VirtualTimeInfo_Type *virtualTime)
vtp_send_proxy((void *)req, sizeof(VtpCmdReq_t));
}
static inline void ss_enable_vtp()
{
VtpCmdReq_t *req = (VtpCmdReq_t *)malloc(sizeof(VtpCmdReq_t));
req->header.preamble = 0xFEEDC0DE;
req->header.msg_id = SS_VTP_ENABLE;
req->header.length = sizeof(proxy_ss_header_t);
req->header.cell_id = SS_context.SSCell_list[cellIndex].PhysicalCellId;
req->tinfo.sfn = 0;
req->tinfo.sf = 0;
LOG_A(ENB_APP, "VTP_ENABLE Command to proxy sent for cell_id: %d SFN %d SF %d\n",
req->header.cell_id,req->tinfo.sfn ,req->tinfo.sf);
LOG_A(ENB_APP,"VTP_ENABLE Command to proxy sent for cell_id: %d\n",
req->header.cell_id );
vtp_send_proxy((void *)req, sizeof(VtpCmdReq_t));
}
//------------------------------------------------------------------------------
static bool isConnected = false;
static inline void ss_eNB_read_from_vtp_socket(acpCtx_t ctx, bool vtInit)
......@@ -277,7 +257,7 @@ static inline void ss_eNB_read_from_vtp_socket(acpCtx_t ctx, bool vtInit)
if (userId == MSG_SysVTEnquireTimingAck_userId)
{
LOG_A(ENB_APP, "[SS-VTP] Received VTEnquireTimingAck Request\n");
LOG_D(ENB_SS, "fxn1:%s received VTEnquireTimingAck Request from TTCN \n", __FUNCTION__);
if (acpSysVTEnquireTimingAckDecSrv(ctx, buffer, msgSize, &virtualTime) != 0)
{
......@@ -330,7 +310,7 @@ void *ss_eNB_vtp_process_itti_msg(void *notUsed)
ss_set_timinfo_t tinfo;
tinfo.sf = SS_UPD_TIM_INFO(received_msg).sf;
tinfo.sfn = SS_UPD_TIM_INFO(received_msg).sfn;
LOG_D(ENB_SS, "fxn1:%s Received SS_UPD_TIM_INFO\n", __FUNCTION__);
if(SS_UPD_TIM_INFO(received_msg).physCellId) {
cellIndex = get_cell_index_pci(SS_UPD_TIM_INFO(received_msg).physCellId, SS_context.SSCell_list);
LOG_A(ENB_SS,"[VTP] cellIndex in SS_UPD_TIM_INFO: %d PhysicalCellId: %d \n",cellIndex,SS_context.SSCell_list[cellIndex].PhysicalCellId);
......@@ -348,12 +328,14 @@ void *ss_eNB_vtp_process_itti_msg(void *notUsed)
case TERMINATE_MESSAGE:
{
LOG_D(ENB_SS, "fxn1:%s Received TERMINATE_MESSAGE\n", __FUNCTION__);
LOG_E(ENB_APP, "[SS-VTP] Terminate message %d:%s\n", ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
itti_exit_task();
}
break;
default:
LOG_D(ENB_SS, "fxn1:%s Received unhandled message\n", __FUNCTION__);
LOG_E(ENB_APP, "[SS-VTP] Received unhandled message %d:%s\n",
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
}
......@@ -363,6 +345,7 @@ void *ss_eNB_vtp_process_itti_msg(void *notUsed)
}
ss_eNB_read_from_vtp_socket(ctx_vtp_g, false);
LOG_D(ENB_SS, "Exit from fxn1:%s \n", __FUNCTION__);
return NULL;
}
......@@ -440,7 +423,7 @@ void* ss_eNB_vtp_task(void *arg) {
ss_eNB_wait_first_msg();
ss_enable_vtp();
RC.ss.vtp_ready = 1;
sleep(1);
while (1) {
(void) ss_eNB_vtp_process_itti_msg(NULL);
......
......@@ -87,6 +87,7 @@ typedef struct ss_config_s {
int mac_rlc_data_ind_frame;
int mac_rlc_data_ind_subframe;
ss_l1macind_ctrl_t l1macind[MAX_NUM_CCs];
ss_ulgrant_info_t ulgrant_info[MAX_NUM_CCs];
uint8_t CC_conf_flag[MAX_NUM_CCs];
ss_rrc_pdcp_api_t *ss_pdcp_api;
ss_crnti_config_t ss_crnti[MAX_NUM_CCs];
......
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