Commit 62d14b23 authored by Siddharth Rana's avatar Siddharth Rana Committed by Vijay Chadachan

Rebasing from 3GPP_TTCN_System_Simulator Commit...

Rebasing from 3GPP_TTCN_System_Simulator Commit ce23d0393586c43b536f4fab70a1aaec17319676 to 44166c915975b81d1aa4b2de52920d9829faad56
parent 8a6027df
......@@ -126,6 +126,15 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
mib_sdu_length);
}
// Trace MACPDU
mac_pkt_info_t mac_pkt;
mac_pkt.direction = DIRECTION_DOWNLINK;
mac_pkt.rnti_type = WS_NO_RNTI;
mac_pkt.rnti = 0xFFFF;
mac_pkt.harq_pid = 0;
mac_pkt.preamble = -1; /* TODO */
LOG_MAC_P(OAILOG_INFO, "MAC_DL_PDU", frameP, slotP, mac_pkt, (uint8_t *)&cc->MIB_pdu.payload[0], (int)mib_sdu_length);
int8_t ssb_period = *scc->ssb_periodicityServingCell;
uint8_t ssb_frame_periodicity = 1; // every how many frames SSB are generated
......
......@@ -295,17 +295,25 @@ void *ss_eNB_drb_process_itti_msg(void *notUsed)
switch (ITTI_MSG_ID(received_msg))
{
case SS_DRB_PDU_IND:
{
int cell_index = 0;
if(received_msg->ittiMsg.ss_drb_pdu_ind.physCellId){
cell_index = get_cell_index_pci(received_msg->ittiMsg.ss_drb_pdu_ind.physCellId, SS_context.SSCell_list);
LOG_A(ENB_SS,"[SS_DRB] cell_index in SS_DRB_PDU_IND: %d PhysicalCellId: %d \n",cell_index,SS_context.SSCell_list[cell_index].PhysicalCellId);
}
task_id_t origin_task = ITTI_MSG_ORIGIN_ID(received_msg);
if (origin_task == TASK_SS_PORTMAN)
{
LOG_D(ENB_APP, "[SS_DRB] DUMMY WAKEUP recevied from PORTMAN state %d \n", SS_context.SSCell_list[cell_index].State);
{
int cell_index=0;
if(received_msg->ittiMsg.ss_drb_pdu_ind.physCellId){
cell_index = get_cell_index_pci(received_msg->ittiMsg.ss_drb_pdu_ind.physCellId, SS_context.SSCell_list);
LOG_A(ENB_SS,"[SS_DRB] cell_index in SS_DRB_PDU_IND: %d PhysicalCellId: %d \n",cell_index,SS_context.SSCell_list[cell_index].PhysicalCellId);
}
task_id_t origin_task = ITTI_MSG_ORIGIN_ID(received_msg);
if (origin_task == TASK_SS_PORTMAN)
{
LOG_D(ENB_APP, "[SS_DRB] DUMMY WAKEUP recevied from PORTMAN state %d \n", SS_context.SSCell_list[cell_index].State);
}
else
{
LOG_A(ENB_APP, "[SS_DRB] Received SS_DRB_PDU_IND from RRC PDCP\n");
if (SS_context.SSCell_list[cell_index].State >= SS_STATE_CELL_ACTIVE)
{
instance_g = ITTI_MSG_DESTINATION_INSTANCE(received_msg);
ss_send_drb_data(&received_msg->ittiMsg.ss_drb_pdu_ind,cell_index);
}
else
{
......
......@@ -147,8 +147,11 @@ void ss_port_man_send_cnf(struct SYSTEM_CTRL_CNF recvCnf)
cnf.Confirm.v.PdcchOrder = true;
break;
case SystemConfirm_Type_Sps:
case SystemConfirm_Type_L1MacIndCtrl:
LOG_A(ENB_SS, "[SS-PORTMAN] SystemConfirm_Type_L1MacIndCtrl\n");
cnf.Confirm.v.L1MacIndCtrl = true;
break;
case SystemConfirm_Type_Sps:
case SystemConfirm_Type_RlcIndCtrl:
case SystemConfirm_Type_PdcpHandoverControl:
case SystemConfirm_Type_L1_TestMode:
......
......@@ -197,7 +197,7 @@ static int sys_send_udp_msg(
uint32_t buffer_len,
uint32_t buffer_offset,
uint32_t peerIpAddr,
uint16_t peerPort, int msg_queued, ss_set_timinfo_t timer_tinfo)
uint16_t peerPort,int msg_queued, ss_set_timinfo_t timer_tinfo)
{
// Create and alloc new message
MessageDef *message_p = NULL;
......@@ -452,8 +452,8 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
{
if (SIB1_CELL_NON_CE.v.cellSelectionInfo_v920.d)
{
LOG_A(ENB_SS, "[SYS] [SIB1] q-QualMin: %d \n", SIB1_CELL_Q_QUALMIN);
RRC_CONFIGURATION_REQ(msg_p).q_QualMin[cell_index] = SIB1_CELL_Q_QUALMIN;
LOG_A(ENB_SS, "[SYS] [SIB1] q-QualMin: %d \n", SIB1_CELL_Q_QUALMIN);
RRC_CONFIGURATION_REQ(msg_p).q_QualMin[cell_index] = SIB1_CELL_Q_QUALMIN;
}
}
}
......@@ -670,7 +670,6 @@ int sys_add_reconfig_cell(struct SYSTEM_CTRL_REQ *req)
#if 0
if (req->Common.TimingInfo.d == TimingInfo_Type_SubFrame)
{
ss_set_timinfo_t tinfo, 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;
......@@ -793,10 +792,10 @@ static void send_sys_cnf(enum ConfirmationResult_Type_Sel resType,
msgCnf->Confirm.v.PdcchOrder = true;
break;
}
case SystemConfirm_Type_Sps:
case SystemConfirm_Type_L1MacIndCtrl:
msgCnf->Confirm.v.L1MacIndCtrl = true;
break;
case SystemConfirm_Type_Sps:
case SystemConfirm_Type_RlcIndCtrl:
case SystemConfirm_Type_PdcpHandoverControl:
case SystemConfirm_Type_L1_TestMode:
......@@ -1951,7 +1950,7 @@ static void sys_handle_as_security_req(struct SYSTEM_CTRL_REQ *req)
}
}
}
else if (ASSecurity->d == AS_Security_Type_Release)
else if (ASSecurity->d == AS_Security_Type_Release)
{
LOG_A(ENB_SS, "[SYS] AS_Security_Type_Release received\n");
}
......@@ -2138,7 +2137,7 @@ bool valid_sys_msg(struct SYSTEM_CTRL_REQ *req)
bool sendDummyCnf = true;
enum SystemConfirm_Type_Sel cnfType = 0;
// if (req->Common.ControlInfo.CnfFlag == false)
// if (req->Common.ControlInfo.CnfFlag == FALSE)
// {
// return FALSE;
// }
......@@ -2214,7 +2213,7 @@ bool valid_sys_msg(struct SYSTEM_CTRL_REQ *req)
break;
case SystemRequest_Type_PdcchOrder:
valid = true;
sendDummyCnf = true;
sendDummyCnf = false;
cnfType = SystemConfirm_Type_PdcchOrder;
reqCnfFlag_g = req->Common.ControlInfo.CnfFlag;
break;
......
......@@ -119,6 +119,32 @@ static void ss_send_sysind_data(ss_system_ind_t *p_ind,int cell_index)
ind.Indication.v.RachPreamble.RepetitionsPerPreambleAttempt.d = true;
ind.Indication.v.RachPreamble.RepetitionsPerPreambleAttempt.v = p_ind->repetitionsPerPreambleAttempt;
}
if(SysInd_Type_UL_HARQ == p_ind->sysind_type)
{
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.Indication.v.UL_HARQ = HARQ_Type_ack;
else
ind.Indication.v.UL_HARQ = HARQ_Type_nack;
}
else if (SysInd_Type_HarqError == p_ind->sysind_type)
{
LOG_A(ENB_SS, "SYSTEM_IND with HarqError \n");
ind.Indication.d = SystemIndication_Type_HarqError;
if (p_ind->HarqError.bIsUL)
{
ind.Indication.v.HarqError.d = HarqError_Type_UL;
ind.Indication.v.HarqError.v.UL.Id = p_ind->HarqError.Id;
ind.Indication.v.HarqError.v.UL.CURRENT_TX_NB = p_ind->HarqError.CURRENT_TX_NB;
}
else
{
ind.Indication.v.HarqError.d = HarqError_Type_DL;
ind.Indication.v.HarqError.v.DL.Id = p_ind->HarqError.Id;
ind.Indication.v.HarqError.v.DL.CURRENT_TX_NB = p_ind->HarqError.CURRENT_TX_NB;
}
}
/* Encode message */
if (acpSysIndProcessToSSEncSrv(ctx_sysind_g, buffer, &msgSize, &ind) != 0)
......@@ -160,7 +186,7 @@ ss_eNB_read_from_sysind_socket(acpCtx_t ctx)
while (1)
{
int userId = acpRecvMsg(ctx, &msgSize, buffer);
LOG_A(ENB_SS, "[SS_SYSIND] Received msgSize=%d, userId=%d\n", (int)msgSize, userId);
LOG_D(ENB_SS, "[SS_SYSIND] Received msgSize=%d, userId=%d\n", (int)msgSize, userId);
// Error handling
if (userId < 0)
......@@ -274,7 +300,7 @@ void *ss_eNB_sysind_process_itti_msg(void *notUsed)
{
case SS_SYSTEM_IND:
{
int cell_index;
int cell_index = 0;
if(received_msg->ittiMsg.ss_system_ind.physCellId){
cell_index = get_cell_index_pci(received_msg->ittiMsg.ss_system_ind.physCellId, SS_context.SSCell_list);
LOG_A(ENB_SS,"[SS_SYSIND] cell_index in SS_SYSTEM_IND: %d PhysicalCellId: %d \n",cell_index,SS_context.SSCell_list[cell_index].PhysicalCellId);
......
......@@ -36,7 +36,6 @@
extern SSConfigContext_t SS_context;
extern RAN_CONTEXT_t RC;
/*
* Function : vt_add_sf
* Description: Helper function to add offset to SFN_SF
......@@ -60,6 +59,7 @@ static void vt_subtract_sf(uint16_t *frameP, uint8_t *subframeP, int offset)
}
*subframeP = (*subframeP+10-offset)%10;
}
/*
* Function : msg_can_be_queued
* Description: Helper function to check if the received MSG shall be queued
......@@ -72,12 +72,11 @@ uint8_t msg_can_be_queued(ss_set_timinfo_t req_tinfo, ss_set_timinfo_t *timer_ti
LOG_A(ENB_APP,"VT_TIMER Enter msg_can_be_queued for SFN %d , SF %d\n",req_tinfo.sfn,req_tinfo.sf);
vt_subtract_sf(&req_tinfo.sfn,&req_tinfo.sf, curr_tinfo.sf);
if((req_tinfo.sfn - curr_tinfo.sfn) > 0)
/*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, 7);
vt_subtract_sf(&timer_tinfo->sfn,&timer_tinfo->sf, 4); /* queued ahead of 4 subframes because of mac schedule 4 subframes ahead when processing */
return true;
}
......@@ -117,9 +116,8 @@ static inline void ss_vt_timer_check(ss_set_timinfo_t tinfo)
uint32_t sfnSfKey = (tinfo.sfn << 4) | tinfo.sf;
hash_rc = hashtable_is_key_exists(SS_context.vt_timer_table, (hash_key_t)sfnSfKey);
//printf("VT_TIMER foudn queued SFN %d , SF %d\n",tinfo.sfn,tinfo.sf);
if (hash_rc == HASH_TABLE_OK)
while (hashtable_is_key_exists(SS_context.vt_timer_table, (hash_key_t)sfnSfKey) == HASH_TABLE_OK)
{
LOG_D(ENB_APP,"VT_TIMER Timeout sending curr SFN %d SF %d\n",
SS_context.sfn,SS_context.sf);
......
......@@ -152,6 +152,37 @@ static void ss_send_srb_data(ss_nrrrc_pdu_ind_t *pdu_ind)
LOG_P(OAILOG_DEBUG, "UL_DCCH_Message", lttng_sdu, pdu_ind->sdu_size);
xer_fprint(stdout, &asn_DEF_NR_UL_DCCH_Message, (void *)ul_dcch_msg);
#define UL_DCCH ul_dcch_msg->message.choice
#define SETCMPLT_NASINFO c1->choice.rrcSetupComplete->criticalExtensions.choice.rrcSetupComplete->dedicatedNAS_Message
#define RESCMPLT_NASINFO c1->choice.rrcResumeComplete->criticalExtensions.choice.rrcResumeComplete->dedicatedNAS_Message
#define UL_NASINFO c1->choice.ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer->dedicatedNAS_Message
if(UL_DCCH.c1->present == NR_UL_DCCH_MessageType__c1_PR_rrcSetupComplete)
{
if (UL_DCCH.c1->choice.rrcSetupComplete->criticalExtensions.present ==
NR_RRCSetupComplete__criticalExtensions_PR_rrcSetupComplete)
{
LOG_NAS_P(OAILOG_INFO, "NR_NAS_PDU", UL_DCCH.SETCMPLT_NASINFO.buf, UL_DCCH.SETCMPLT_NASINFO.size);
}
}
if(UL_DCCH.c1->present == NR_UL_DCCH_MessageType__c1_PR_rrcResumeComplete)
{
if (UL_DCCH.c1->choice.rrcResumeComplete->criticalExtensions.present ==
NR_RRCResumeComplete__criticalExtensions_PR_rrcResumeComplete)
{
LOG_NAS_P(OAILOG_INFO, "NR_NAS_PDU", UL_DCCH.RESCMPLT_NASINFO->buf, UL_DCCH.RESCMPLT_NASINFO->size);
}
}
if(UL_DCCH.c1->present == NR_UL_DCCH_MessageType__c1_PR_ulInformationTransfer)
{
if (UL_DCCH.c1->choice.ulInformationTransfer->criticalExtensions.present ==
NR_ULInformationTransfer__criticalExtensions_PR_ulInformationTransfer)
{
LOG_NAS_P(OAILOG_INFO, "NR_NAS_PDU", UL_DCCH.UL_NASINFO->buf, UL_DCCH.UL_NASINFO->size);
}
}
ind.RrcPdu.d = NR_RRC_MSG_Indication_Type_Dcch;
ind.RrcPdu.v.Dcch.d = pdu_ind->sdu_size;
ind.RrcPdu.v.Dcch.v = pdu_ind->sdu;
......@@ -211,6 +242,10 @@ static void ss_task_handle_rrc_pdu_req(struct NR_RRC_PDU_REQ *req)
}
else
{
#define DL_DCCH dl_dcch_msg->message.choice
#define DL_NASINFO c1->choice.dlInformationTransfer->criticalExtensions.choice.dlInformationTransfer->dedicatedNAS_Message
#define RECNFG_NASINFO c1->choice.rrcReconfiguration->criticalExtensions.choice.rrcReconfiguration->nonCriticalExtension->dedicatedNAS_MessageList
SS_NRRRC_PDU_REQ(message_p).sdu_size = req->RrcPdu.v.Dcch.d;
memcpy(SS_NRRRC_PDU_REQ(message_p).sdu, req->RrcPdu.v.Dcch.v, req->RrcPdu.v.Dcch.d);
uper_decode(NULL,
......@@ -220,6 +255,29 @@ static void ss_task_handle_rrc_pdu_req(struct NR_RRC_PDU_REQ *req)
SS_NRRRC_PDU_REQ(message_p).sdu_size,0,0);
xer_fprint(stdout,&asn_DEF_NR_DL_DCCH_Message,(void *)dl_dcch_msg);
if(DL_DCCH.c1->present == NR_DL_DCCH_MessageType__c1_PR_dlInformationTransfer)
{
if (DL_DCCH.c1->choice.dlInformationTransfer->criticalExtensions.present
== NR_DLInformationTransfer__criticalExtensions_PR_dlInformationTransfer)
{
LOG_NAS_P(OAILOG_INFO, "NR_NAS_PDU", DL_DCCH.DL_NASINFO->buf, DL_DCCH.DL_NASINFO->size);
}
}
if(DL_DCCH.c1->present == NR_DL_DCCH_MessageType__c1_PR_rrcReconfiguration)
{
if (DL_DCCH.c1->choice.rrcReconfiguration->criticalExtensions.present
== NR_RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration)
{
int nas_list_cnt;
for (nas_list_cnt = 0; nas_list_cnt < DL_DCCH.RECNFG_NASINFO->list.count; nas_list_cnt++)
{
LOG_NAS_P(OAILOG_INFO, "NR_NAS_PDU", DL_DCCH.RECNFG_NASINFO->list.array[nas_list_cnt]->buf, DL_DCCH.RECNFG_NASINFO->list.array[nas_list_cnt]->size);
}
}
}
memcpy(lttng_sdu, SS_NRRRC_PDU_REQ(message_p).sdu, SS_NRRRC_PDU_REQ(message_p).sdu_size);
LOG_P(OAILOG_DEBUG, "DL_DCCH_Message", lttng_sdu, SS_NRRRC_PDU_REQ(message_p).sdu_size);
......
......@@ -261,7 +261,7 @@ static void sys_handle_nr_cell_attn_req(struct NR_CellAttenuationConfig_Type_NR_
static void ss_task_sys_nr_handle_req(struct NR_SYSTEM_CTRL_REQ *req, ss_nrset_timinfo_t *tinfo)
{
int enterState = RC.ss.State;
if (req->Common.CellId > 0) {
SS_context.eutra_cellId = req->Common.CellId;
}
......@@ -1375,7 +1375,7 @@ bool ss_task_sys_nr_handle_pdcpCount(struct NR_SYSTEM_CTRL_REQ *req)
if (req->Request.v.PdcpCount.v.Get.d == NR_PdcpCountGetReq_Type_AllRBs)
{
PdcpCount.v.Get.d = 5;
const size_t size = sizeof(struct NR_PdcpCountInfo_Type) * PdcpCount.v.Get.d;
PdcpCount.v.Get.v =(struct NR_PdcpCountInfo_Type *)acpMalloc(size);
......@@ -1417,7 +1417,7 @@ bool ss_task_sys_nr_handle_pdcpCount(struct NR_SYSTEM_CTRL_REQ *req)
LOG_E(GNB_APP, "it's not an PdcpCount.v.Get for single-rb not all-rbs cmd\r\n", __PRETTY_FUNCTION__, __LINE__);
return false;
}
send_sys_cnf(ConfirmationResult_Type_Success, true, NR_SystemConfirm_Type_PdcpCount, (void *)&PdcpCount);
LOG_A(GNB_APP, "Exit from fxn:%s\n", __FUNCTION__);
return true;
......
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