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);
}
}
This diff is collapsed.
......@@ -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");
......
This diff is collapsed.
......@@ -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