Commit b8a38a2d authored by Nick Ho's avatar Nick Ho

Pre-commit for the clear NB-IoT MAC code for integration, still on going (110 warning)

parent 9d8ea63c
...@@ -425,7 +425,7 @@ uint8_t subframe2harq_pid_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t fra ...@@ -425,7 +425,7 @@ uint8_t subframe2harq_pid_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t fra
case 2: case 2:
if ((subframe!=2) && (subframe!=7)) { if ((subframe!=2) && (subframe!=7)) {
LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config); LOG_E(PHY,"subframe2_harq_pid, Illegal subframe %d for TDD mode %d\n",subframe,frame_parms->tdd_config);
mac_xface_NB_IoT->macphy_exit("subframe2_harq_pid_NB_IoT, Illegal subframe"); //mac_xface_NB_IoT->macphy_exit("subframe2_harq_pid_NB_IoT, Illegal subframe");
ret = (255); ret = (255);
} }
...@@ -468,7 +468,7 @@ uint8_t subframe2harq_pid_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t fra ...@@ -468,7 +468,7 @@ uint8_t subframe2harq_pid_NB_IoT(NB_IoT_DL_FRAME_PARMS *frame_parms,uint32_t fra
if (ret == 255) { if (ret == 255) {
LOG_E(PHY, "invalid harq_pid(%d) at SFN/SF = %d/%d\n", ret, frame, subframe); LOG_E(PHY, "invalid harq_pid(%d) at SFN/SF = %d/%d\n", ret, frame, subframe);
mac_xface_NB_IoT->macphy_exit("invalid harq_pid"); //mac_xface_NB_IoT->macphy_exit("invalid harq_pid");
} }
return ret; return ret;
} }
......
...@@ -1045,7 +1045,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB, ...@@ -1045,7 +1045,7 @@ unsigned int ulsch_decoding_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,
ulsch_harq->O_ACK, ulsch_harq->O_ACK,
G, G,
subframe); subframe);
mac_xface_NB_IoT->macphy_exit("ulsch_decoding.c: FATAL sumKr is 0!"); //mac_xface_NB_IoT->macphy_exit("ulsch_decoding.c: FATAL sumKr is 0!");
return(-1); return(-1);
} }
// Compute Q_ri // Compute Q_ri
......
...@@ -29,35 +29,7 @@ ...@@ -29,35 +29,7 @@
* *
*/ */
#include "assertions.h"
//#include "PHY/defs.h"
/* (commented to remove warnings since this file is not used for the moment)
#include "PHY/defs_NB_IoT.h"
#include "PHY/extern.h"
#include "SCHED/defs.h"
#include "SCHED/extern.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/MAC/proto.h"
#include "LAYER2/MAC/defs_nb_iot.h"
#include "LAYER2/MAC/proto_NB_IoT.h"
#include "PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "RRC/LITE/extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
//#include "LAYER2/MAC/pre_processor.c"
#include "pdcp.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
*/
......
...@@ -19,88 +19,12 @@ ...@@ -19,88 +19,12 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
/*! \file eNB_scheduler_dlsch.c /*! \file eNB_scheduler_dlsch_NB_IoT.c
* \brief procedures related to eNB for the DLSCH transport channel * \brief procedures related to eNB for the DLSCH transport channel
* \author Navid Nikaein and Raymond Knopp * \author TaiwanTech
* \date 2010 - 2014 * \date 2017
* \email: navid.nikaein@eurecom.fr * \email: navid.nikaein@eurecom.fr
* \version 1.0 * \version 1.0
* @ingroup _mac * @ingroup _mac
*/ */
//#include "assertions.h"
//#include "PHY/defs.h"
//#include "PHY/extern_NB_IoT.h"
//#include "SCHED/defs.h"
//#include "SCHED/extern.h"
//#include "SCHED/defs_NB_IoT.h"
//#include "SCHED/extern_NB_IoT.h"
//#include "LAYER2/MAC/defs.h"
//#include "LAYER2/MAC/proto.h"
//#include "LAYER2/MAC/extern.h"
#include "UTIL/LOG/log.h"
//#include "UTIL/LOG/vcd_signal_dumper.h"
//#include "UTIL/OPT/opt.h"
//#include "OCG.h"
//#include "OCG_extern.h"
//NB-IoT
//#include "PHY/defs_NB_IoT.h"
//#include "LAYER2/MAC/defs_NB_IoT.h"
#include "LAYER2/MAC/proto_NB_IoT.h"
#include "LAYER2/MAC/extern_NB_IoT.h"
//#include "RRC/LITE/extern_NB_IoT.h"
//#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
//#include "LAYER2/MAC/pre_processor.c"
//#include "pdcp.h"
//#include "COMMON/platform_types.h"
//#include "SIMULATION/TOOLS/defs.h" // for taus
/*
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
#include "T.h"
*/
#define ENABLE_MAC_PAYLOAD_DEBUG
//#define DEBUG_eNB_SCHEDULER 1
uint8_t *get_dlsch_sdu_NB_IoT(
module_id_t module_idP,
int CC_id,
frame_t frameP,
rnti_t rntiP,
uint8_t TBindex
)
//------------------------------------------------------------------------------
{
int UE_id;
eNB_MAC_INST_NB_IoT *eNB=&eNB_mac_inst_NB_IoT[module_idP];
/*for SIBs*/
if (rntiP==SI_RNTI) {
LOG_D(MAC,"[eNB %d] CC_id %d Frame %d Get DLSCH sdu for BCCH \n", module_idP, CC_id, frameP);
return((unsigned char *)&eNB->common_channels[CC_id].BCCH_pdu.payload[0]);
}
UE_id = find_UE_id_NB_IoT(module_idP,rntiP);
if (UE_id != -1) {
LOG_D(MAC,"[eNB %d] Frame %d: CC_id %d Get DLSCH sdu for rnti %x => UE_id %d\n",module_idP,frameP,CC_id,rntiP,UE_id);
return((unsigned char *)&eNB->UE_list.DLSCH_pdu[CC_id][TBindex][UE_id].payload[0]);
} else {
LOG_E(MAC,"[eNB %d] Frame %d: CC_id %d UE with RNTI %x does not exist\n", module_idP,frameP,CC_id,rntiP);
return NULL;
}
}
...@@ -28,200 +28,3 @@ ...@@ -28,200 +28,3 @@
* @ingroup _mac * @ingroup _mac
*/ */
//#include "assertions.h"
//#include "PHY/defs.h"
//#include "PHY/extern.h"
//#include "SCHED/defs.h"
//#include "SCHED/extern.h"
//#include "LAYER2/MAC/defs.h"
//#include "LAYER2/MAC/extern.h"
//#include "LAYER2/MAC/proto.h"
#include "UTIL/LOG/log.h"
//#include "UTIL/LOG/vcd_signal_dumper.h"
//#include "UTIL/OPT/opt.h"
//#include "OCG.h"
//#include "OCG_extern.h"
#include "RRC/LITE/proto_NB_IoT.h"
//#include "RRC/LITE/extern.h"
//#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
//NB-IoT
//#include "PHY/defs_NB_IoT.h"
#include "LAYER2/MAC/defs_NB_IoT.h"
#include "LAYER2/MAC/proto_NB_IoT.h"
#include "LAYER2/MAC/extern_NB_IoT.h"
#include "LAYER2/MAC/vars_NB_IoT.h" //////////////////// to comment during test
//#include "openair2/COMMON/platform_types.h"
//#include "LAYER2/MAC/pre_processor.c"
//#include "pdcp.h"
/*
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
#endif
*/
//#define ENABLE_MAC_PAYLOAD_DEBUG
//#define DEBUG_eNB_SCHEDULER 1
/*TODO NB_mac_phy_remove_ue*/
//------------------------------------------------------------------------------
int find_UE_id_NB_IoT(module_id_t mod_idP, rnti_t rntiP)
//------------------------------------------------------------------------------
{
int UE_id;
UE_list_NB_IoT_t *UE_list = &eNB_mac_inst_NB_IoT[mod_idP].UE_list;
for (UE_id = 0; UE_id < NUMBER_OF_UE_MAX_NB_IoT; UE_id++) {
if (UE_list->active[UE_id] != TRUE) continue;
if (UE_list->UE_template[UE_PCCID_NB_IoT(mod_idP,UE_id)][UE_id].rnti==rntiP) {
return(UE_id);
}
}
return(-1);
}
//------------------------------------------------------------------------------
int UE_PCCID_NB_IoT(module_id_t mod_idP,int ue_idP)
//------------------------------------------------------------------------------
{
return(eNB_mac_inst_NB_IoT[mod_idP].UE_list.pCC_id[ue_idP]);
}
//------------------------------------------------------------------------------
rnti_t UE_RNTI_NB_IoT(module_id_t mod_idP, int ue_idP)
//------------------------------------------------------------------------------
{
rnti_t rnti = eNB_mac_inst_NB_IoT[mod_idP].UE_list.UE_template[UE_PCCID_NB_IoT(mod_idP,ue_idP)][ue_idP].rnti;
if (rnti>0) {
return (rnti);
}
LOG_D(MAC,"[eNB %d] Couldn't find RNTI for UE %d\n",mod_idP,ue_idP);
//display_backtrace();
return(NOT_A_RNTI);
}
int add_new_ue_NB_IoT(module_id_t mod_idP, int cc_idP, rnti_t rntiP,int harq_pidP)
{
int UE_id;
int i, j;
UE_list_NB_IoT_t *UE_list = &eNB_mac_inst_NB_IoT[mod_idP].UE_list;
LOG_D(MAC,"[eNB %d, CC_id %d] Adding UE with rnti %x (next avail %d, num_UEs %d)\n",mod_idP,cc_idP,rntiP,UE_list->avail,UE_list->num_UEs);
dump_ue_list_NB_IoT(UE_list,0);
for (i = 0; i < NUMBER_OF_UE_MAX_NB_IoT; i++) {
if (UE_list->active[i] == TRUE) continue;
printf("MAC: new UE id %d rnti %x\n", i, rntiP);
UE_id = i;
UE_list->UE_template[cc_idP][UE_id].rnti = rntiP;
UE_list->UE_template[cc_idP][UE_id].configured = FALSE;
UE_list->numactiveCCs[UE_id] = 1;
UE_list->numactiveULCCs[UE_id] = 1;
UE_list->pCC_id[UE_id] = cc_idP;
UE_list->ordered_CCids[0][UE_id] = cc_idP;
UE_list->ordered_ULCCids[0][UE_id] = cc_idP;
UE_list->num_UEs++;
UE_list->active[UE_id] = TRUE;
memset((void*)&UE_list->UE_sched_ctrl[UE_id],0,sizeof(UE_sched_ctrl_NB_IoT));
for (j=0; j<8; j++) {
UE_list->UE_template[cc_idP][UE_id].oldNDI[j] = (j==0)?1:0; // 1 because first transmission is with format1A (Msg4) for harq_pid 0
UE_list->UE_template[cc_idP][UE_id].oldNDI_UL[j] = (j==harq_pidP)?0:1; // 1st transmission is with Msg3;
}
eNB_ulsch_info_NB_IoT[mod_idP][cc_idP][UE_id].status = S_UL_WAITING_NB_IoT;
eNB_dlsch_info_NB_IoT[mod_idP][cc_idP][UE_id].status = S_DL_WAITING_NB_IoT;
LOG_D(MAC,"[eNB %d] Add UE_id %d on Primary CC_id %d: rnti %x\n",mod_idP,UE_id,cc_idP,rntiP);
dump_ue_list_NB_IoT(UE_list,0);
return(UE_id);
}
printf("MAC: cannot add new UE for rnti %x\n", rntiP);
LOG_E(MAC,"error in add_new_ue(), could not find space in UE_list, Dumping UE list\n");
dump_ue_list_NB_IoT(UE_list,0);
return(-1);
}
//--------------------------------------------------------------------------------------------------------
int rrc_mac_remove_ue_NB_IoT(
module_id_t mod_idP,
rnti_t rntiP)
{
int i;
UE_list_NB_IoT_t *UE_list = &eNB_mac_inst_NB_IoT[mod_idP].UE_list;
int UE_id = find_UE_id_NB_IoT(mod_idP,rntiP); //may should be changed
int pCC_id;
if (UE_id == -1) {
printf("MAC: cannot remove UE rnti %x\n", rntiP);
LOG_W(MAC,"rrc_mac_remove_ue_NB_IoT: UE %x not found\n", rntiP);
//NB_mac_phy_remove_ue(mod_idP, rntiP);
return 0;
}
pCC_id = UE_PCCID_NB_IoT(mod_idP,UE_id);
printf("MAC: remove UE %d rnti %x\n", UE_id, rntiP);
LOG_I(MAC,"Removing UE %d from Primary CC_id %d (rnti %x)\n",UE_id,pCC_id, rntiP);
//dump_ue_list(UE_list,0); //may should be changed
UE_list->active[UE_id] = FALSE;
UE_list->num_UEs--;
// clear all remaining pending transmissions no lcgid in NB-IoT
/*UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID0] = 0;
UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID1] = 0;
UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID2] = 0;
UE_list->UE_template[pCC_id][UE_id].bsr_info[LCGID3] = 0;*/
//UE_list->UE_template[pCC_id][UE_id].ul_SR = 0;
UE_list->UE_template[pCC_id][UE_id].rnti = NOT_A_RNTI;
UE_list->UE_template[pCC_id][UE_id].ul_active = FALSE;
eNB_ulsch_info_NB_IoT[mod_idP][pCC_id][UE_id].rnti = NOT_A_RNTI;
eNB_ulsch_info_NB_IoT[mod_idP][pCC_id][UE_id].status = S_UL_NONE_NB_IoT;
eNB_dlsch_info_NB_IoT[mod_idP][pCC_id][UE_id].rnti = NOT_A_RNTI;
eNB_dlsch_info_NB_IoT[mod_idP][pCC_id][UE_id].status = S_DL_NONE_NB_IoT;
//NB_mac_phy_remove_ue(mod_idP,rntiP);
// check if this has an RA process active
RA_TEMPLATE_NB_IoT *RA_template;
for (i=0;i<RA_PROC_MAX_NB_IoT;i++) {
RA_template = (RA_TEMPLATE_NB_IoT *)&eNB_mac_inst_NB_IoT[mod_idP].common_channels[pCC_id].RA_template[i];
if (RA_template->rnti == rntiP){
RA_template->RA_active=FALSE;
RA_template->generate_rar=0;
RA_template->generate_Msg4=0;
RA_template->wait_ack_Msg4=0;
RA_template->timing_offset=0;
RA_template->RRC_timer=20;
RA_template->rnti = 0;
//break;
}
}
return 0;
}
//------------------------------------------------------------------------------
DCI_PDU_NB_IoT *get_dci_sdu_NB_IoT(module_id_t module_idP, int CC_id,frame_t frameP, sub_frame_t subframeP)
//------------------------------------------------------------------------------
{
return(&eNB_mac_inst_NB_IoT[module_idP].common_channels[CC_id].DCI_pdu);
}
//NB_UL_failure_indication... some of the used primitive haven't defined
...@@ -39,32 +39,9 @@ ...@@ -39,32 +39,9 @@
int mac_init_global_param_NB_IoT(void) int mac_init_global_param_NB_IoT(void)
{ {
//XXX commented parts are called in the parallel path of OAI
// Mac_rlc_xface = NULL;
// LOG_I(MAC,"[MAIN] CALLING RLC_MODULE_INIT...\n");
//
if (rlc_module_init()!=0) { if (rlc_module_init()!=0) {
return(-1); return(-1);
} }
//
// LOG_I(MAC,"[MAIN] RLC_MODULE_INIT OK, malloc16 for mac_rlc_xface...\n");
//
// Mac_rlc_xface = (MAC_RLC_XFACE*)malloc16(sizeof(MAC_RLC_XFACE));
// bzero(Mac_rlc_xface,sizeof(MAC_RLC_XFACE));
//
// if(Mac_rlc_xface == NULL) {
// LOG_E(MAC,"[MAIN] FATAL EROOR: Could not allocate memory for Mac_rlc_xface !!!\n");
// return (-1);
//
// }
//
// LOG_I(MAC,"[MAIN] malloc16 OK, mac_rlc_xface @ %p\n",(void *)Mac_rlc_xface);
//
// mac_xface->mrbch_phy_sync_failure=mrbch_phy_sync_failure;
// mac_xface->dl_phy_sync_success=dl_phy_sync_success;
// mac_xface->out_of_sync_ind=rrc_out_of_sync_ind;
//
// LOG_I(MAC,"[MAIN] RLC interface (mac_rlc_xface) setup and init (maybe no mre used??)\n");
LOG_I(MAC,"[MAIN] RRC NB-IoT initialization of global params\n"); LOG_I(MAC,"[MAIN] RRC NB-IoT initialization of global params\n");
rrc_init_global_param_NB_IoT(); rrc_init_global_param_NB_IoT();
...@@ -76,116 +53,15 @@ int mac_init_global_param_NB_IoT(void) ...@@ -76,116 +53,15 @@ int mac_init_global_param_NB_IoT(void)
#else #else
pdcp_module_init (); pdcp_module_init ();
#endif #endif
//
// LOG_I(MAC,"[MAIN] Init Global Param Done\n");
return 0; return 0;
} }
// Initial function of the intialization for NB-IoT MAC
int mac_top_init_NB_IoT() int mac_top_init_NB_IoT()
{ {
module_id_t Mod_id,i,j;
RA_TEMPLATE_NB_IoT *RA_template;
UE_TEMPLATE_NB_IoT *UE_template;
int size_bytes1,size_bytes2,size_bits1,size_bits2;
int CC_id;
int list_el;
UE_list_NB_IoT_t *UE_list; //XXX to review if elements are correct
// delete the part to init the UE_INST
//XXX NB_eNB_INST is global and set in lte-softmodem = 1 always (should be modified???)
LOG_I(MAC,"[MAIN] Init function start:Nb_eNB_INST=%d\n",NB_eNB_INST);
if (NB_eNB_INST>0) {
eNB_mac_inst_NB_IoT = (eNB_MAC_INST_NB_IoT*)malloc16(NB_eNB_INST*sizeof(eNB_MAC_INST_NB_IoT));
if (eNB_mac_inst_NB_IoT == NULL) {
LOG_D(MAC,"[MAIN] can't ALLOCATE %zu Bytes for %d eNB_MAC_INST with size %zu \n",NB_eNB_INST*sizeof(eNB_MAC_INST_NB_IoT*),NB_eNB_INST,sizeof(eNB_MAC_INST_NB_IoT));
LOG_I(MAC,"[MAC][MAIN] not enough memory for eNB \n");
exit(1);
} else {
LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d eNB_MAC_INST @ %p\n",sizeof(eNB_MAC_INST_NB_IoT),NB_eNB_INST,eNB_mac_inst_NB_IoT);
bzero(eNB_mac_inst_NB_IoT,NB_eNB_INST*sizeof(eNB_MAC_INST_NB_IoT));
}
} else {
LOG_I (MAC, "No instance allocated for the MAC layer (NB-IoT)\n");
eNB_mac_inst_NB_IoT = NULL;
}
// Initialize Linked-List for Active UEs
for(Mod_id=0; Mod_id<NB_eNB_INST; Mod_id++) {
UE_list = &eNB_mac_inst_NB_IoT[Mod_id].UE_list;
UE_list->num_UEs=0;
UE_list->head=-1;
UE_list->head_ul=-1;
UE_list->avail=0;
for (list_el=0; list_el<NUMBER_OF_UE_MAX_NB_IoT-1; list_el++) {
UE_list->next[list_el]=list_el+1;
UE_list->next_ul[list_el]=list_el+1;
}
UE_list->next[list_el]=-1;
UE_list->next_ul[list_el]=-1;
}
if (Is_rrc_registered_NB_IoT == 1) {
LOG_I(MAC,"[MAIN] calling RRC NB-IoT\n");
#ifndef CELLULAR //nothing to be done yet for cellular
openair_rrc_top_init_eNB_NB_IoT();
#endif
} else {
LOG_I(MAC,"[MAIN] Running without an RRC\n");
}
// initialization for the RA template
for (i=0; i<NB_eNB_INST; i++)
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
LOG_D(MAC,"[MAIN][eNB %d] CC_id %d initializing RA_template (NB-IoT)\n",i, CC_id);
LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_eNB][MOD %02d][]\n", i);
RA_template = (RA_TEMPLATE_NB_IoT *)&eNB_mac_inst_NB_IoT[i].common_channels[CC_id].RA_template[0];
for (j=0; j<RA_PROC_MAX_NB_IoT; j++) {
size_bytes1 = sizeof(DCIN1_RAR_t);
size_bytes2 = sizeof(DCIN1_t);
size_bits1 = sizeof_DCIN1_RAR_t;
size_bits2 = sizeof_DCIN1_t;
memcpy((void *)&RA_template[j].RA_alloc_pdu1[0],(void *)&RA_alloc_pdu,size_bytes1);
memcpy((void *)&RA_template[j].RA_alloc_pdu2[0],(void *)&DLSCH_alloc_pdu1A,size_bytes2);//DLSCH_alloc_pdu1A global!!!!!!
RA_template[j].RA_dci_size_bytes1 = size_bytes1;
RA_template[j].RA_dci_size_bytes2 = size_bytes2;
RA_template[j].RA_dci_size_bits1 = size_bits1;
RA_template[j].RA_dci_size_bits2 = size_bits2;
RA_template[j].RA_dci_fmt1 = DCIFormatN1_RAR;
RA_template[j].RA_dci_fmt2 = DCIFormatN1; //for MSG4
}
memset (&eNB_mac_inst_NB_IoT[i].eNB_stats,0,sizeof(eNB_STATS_NB_IoT));
UE_template = (UE_TEMPLATE_NB_IoT *)&eNB_mac_inst_NB_IoT[i].UE_list.UE_template[CC_id][0];
for (j=0; j<NUMBER_OF_UE_MAX_NB_IoT; j++) {
UE_template[j].rnti=0;
// initiallize the eNB to UE statistics
memset (&eNB_mac_inst_NB_IoT[i].UE_list.eNB_UE_stats[CC_id][j],0,sizeof(eNB_UE_STATS_NB_IoT));
}
}
//ICIC not used
LOG_I(MAC,"[MAIN][INIT][NB-IoT] Init function finished\n");
return(0);
} }
......
...@@ -39,103 +39,4 @@ ...@@ -39,103 +39,4 @@
/*for NB-IoT*/ /*for NB-IoT*/
/* \brief Function to indicate a received SDU on ULSCH for NB-IoT.
*/
void rx_sdu_NB_IoT(const module_id_t module_idP, const int CC_id,const frame_t frameP, const sub_frame_t subframeP, const rnti_t rnti, uint8_t *sdu, const uint16_t sdu_len, const int harq_pid);
/* \brief Function to retrieve result of scheduling (DCI) in current subframe. Can be called an arbitrary numeber of times after eNB_dlsch_ulsch_scheduler
in a given subframe.
*/
DCI_PDU_NB_IoT *get_dci_sdu_NB_IoT(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_t subframe);
/* \brief Function to trigger the eNB scheduling procedure. It is called by PHY at the beginning of each subframe, \f$n$\f
and generates all DLSCH allocations for subframe \f$n\f$ and ULSCH allocations for subframe \f$n+k$\f. The resultant DCI_PDU is
ready after returning from this call.
*/
void eNB_dlsch_ulsch_scheduler_NB_IoT(module_id_t module_idP, uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP);
/* \brief Function to indicate a received preamble on PRACH. It initiates the RA procedure.
In NB-IoT, it indicate preamble using the frequency to indicate the preamble.
*/
void schedule_RA_NB_IoT(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP);
void initiate_ra_proc_NB_IoT(module_id_t module_idP, int CC_id,frame_t frameP, uint16_t preamble_index,int16_t timing_offset,sub_frame_t subframeP);
uint8_t *get_dlsch_sdu_NB_IoT(module_id_t module_idP,int CC_id,frame_t frameP,rnti_t rnti,uint8_t TBindex);
int rrc_mac_remove_ue_NB_IoT(module_id_t Mod_id, rnti_t rntiP);
int l2_init_eNB_NB_IoT(void);
int mac_init_global_param_NB_IoT(void);
int mac_top_init_NB_IoT(void);
int find_UE_id_NB_IoT (module_id_t module_idP, rnti_t rnti) ;
int UE_PCCID_NB_IoT (module_id_t module_idP, int UE_id);
rnti_t UE_RNTI_NB_IoT (module_id_t module_idP, int UE_id);
/*! \fn UE_L2_state_t ue_scheduler(const module_id_t module_idP,const frame_t frameP, const sub_frame_t subframe, const lte_subframe_t direction,const uint8_t eNB_index)
\brief UE scheduler where all the ue background tasks are done. This function performs the following: 1) Trigger PDCP every 5ms 2) Call RRC for link status return to PHY3) Perform SR/BSR procedures for scheduling feedback 4) Perform PHR procedures.
\param[in] module_idP instance of the UE
\param[in] rxFrame the RX frame number
\param[in] rxSubframe the RX subframe number
\param[in] txFrame the TX frame number
\param[in] txSubframe the TX subframe number
\param[in] direction subframe direction
\param[in] eNB_index instance of eNB
@returns L2 state (CONNETION_OK or CONNECTION_LOST or PHY_RESYNCH)
*/
UE_L2_STATE_NB_IoT_t ue_scheduler_NB_IoT(
const module_id_t module_idP,
const frame_t rxFrameP,
const sub_frame_t rxSubframe,
const frame_t txFrameP,
const sub_frame_t txSubframe,
const NB_IoT_subframe_t direction,
const uint8_t eNB_index,
const int CC_id);
/* \brief Function used by PHY to inform MAC that an uplink is scheduled
for Msg3 in given subframe. This is used so that the MAC
scheduler marks as busy the RBs used by the Msg3.
@param Mod_id Instance ID of eNB
@param CC_id CC ID of eNB
@param frame current frame
@param subframe current subframe
@param rnti UE rnti concerned
@param Msg3_frame frame where scheduling takes place
@param Msg3_subframe subframe where scheduling takes place
*/
void set_msg3_subframe_NB_IoT(module_id_t Mod_id,
int CC_id,
int frame,
int subframe,
int rnti,
int Msg3_frame,
int Msg3_subframe);
/* \brief Parse header for UL-SCH. This function parses the received UL-SCH header as described
in 36-321 MAC layer specifications. It returns the number of bytes used for the header to be used as an offset for the payload
in the ULSCH buffer.
@param mac_header Pointer to the first byte of the MAC header (UL-SCH buffer)
@param num_ces Number of SDUs in the payload
@param num_sdu Number of SDUs in the payload
@param rx_ces Pointer to received CEs in the header
@param rx_lcids Pointer to array of LCIDs (the order must be the same as the SDU length array)
@param rx_lengths Pointer to array of SDU lengths
@returns Pointer to payload following header
*/
uint8_t *parse_ulsch_header_NB_IoT(uint8_t *mac_header,
uint8_t *num_ce,
uint8_t *num_sdu,
uint8_t *rx_ces,
uint8_t *rx_lcids,
uint16_t *rx_lengths,
uint16_t tx_lenght);
int add_new_ue_NB_IoT(module_id_t Mod_id, int CC_id, rnti_t rnti,int harq_pid);
//void dump_ue_list_NB_IoT(UE_list_t *listP, int ul_flag);
#endif #endif
...@@ -54,14 +54,6 @@ ...@@ -54,14 +54,6 @@
#include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h" #include "openair2/PHY_INTERFACE/IF_Module_NB_IoT.h"
#include "openair1/SCHED/IF_Module_L1_primitives_NB_IoT.h" #include "openair1/SCHED/IF_Module_L1_primitives_NB_IoT.h"
/*
#ifdef PHY_EMUL
#include "SIMULATION/simulation_defs.h"
extern EMULATION_VARS *Emul_vars;
extern eNB_MAC_INST *eNB_mac_inst;
extern UE_MAC_INST *UE_mac_inst;
#endif
*/
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# include "intertask_interface.h" # include "intertask_interface.h"
#endif #endif
...@@ -88,7 +80,7 @@ extern unsigned int pdcp_eNB_UE_instance_to_rnti_index; ...@@ -88,7 +80,7 @@ extern unsigned int pdcp_eNB_UE_instance_to_rnti_index;
extern rnti_t pdcp_eNB_UE_instance_to_rnti[NUMBER_OF_UE_MAX_NB_IoT]; extern rnti_t pdcp_eNB_UE_instance_to_rnti[NUMBER_OF_UE_MAX_NB_IoT];
extern list_t pdcp_sdu_list; extern list_t pdcp_sdu_list;
//extern struct mac_data_req rlc_am_mac_data_request (const protocol_ctxt_t* const ctxtP,void * const rlc_pP); //extern struct mac_data_req rlc_am_mac_data_request (const protocol_ctxt_t* const ctxtP,void * const rlc_pP);
//extern eNB_MAC_INST_NB_IoT *eNB;
extern void rlc_tm_init ( const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP); extern void rlc_tm_init ( const protocol_ctxt_t* const ctxt_pP, rlc_tm_entity_t * const rlcP);
extern void rlc_tm_set_debug_infos( extern void rlc_tm_set_debug_infos(
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
...@@ -583,8 +575,8 @@ int rrc_mac_config_req_eNB_NB_IoT( ...@@ -583,8 +575,8 @@ int rrc_mac_config_req_eNB_NB_IoT(
int UE_id = -1; int UE_id = -1;
//UE_list_NB_IoT_t *UE_list= &eNB_mac_inst_NB_IoT->UE_list;
UE_id = find_UE_id_NB_IoT(Mod_idP, rntiP); //find ue_id here
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN);
...@@ -604,8 +596,8 @@ int rrc_mac_config_req_eNB_NB_IoT( ...@@ -604,8 +596,8 @@ int rrc_mac_config_req_eNB_NB_IoT(
//if(eNB_mac_inst == NULL) l2_init_eNB(); //TODO MP: to be included in the MAC/main.c //if(eNB_mac_inst == NULL) l2_init_eNB(); //TODO MP: to be included in the MAC/main.c
//mac_top_init_eNB(); //TODO MP: to be included in the MAC/main.c //mac_top_init_eNB(); //TODO MP: to be included in the MAC/main.c
// add common channels parameters
eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].mib_NB_IoT = mib_NB_IoT; /*eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].mib_NB_IoT = mib_NB_IoT;
eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].physCellId = physCellId; eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].physCellId = physCellId;
eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].p_eNB = p_eNB; eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].p_eNB = p_eNB;
eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].p_rx_eNB = p_rx_eNB; eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].p_rx_eNB = p_rx_eNB;
...@@ -613,7 +605,7 @@ int rrc_mac_config_req_eNB_NB_IoT( ...@@ -613,7 +605,7 @@ int rrc_mac_config_req_eNB_NB_IoT(
eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].Ncp_UL = Ncp_UL; eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].Ncp_UL = Ncp_UL;
eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].eutra_band = eutra_band; eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].eutra_band = eutra_band;
eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].dl_CarrierFreq = dl_CarrierFreq; eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].dl_CarrierFreq = dl_CarrierFreq;
*/
LOG_I(MAC, LOG_I(MAC,
"Configuring MIB for instance %d, CCid %d : (band %ld,Nid_cell %d,TX antenna port (p) %d,DL freq %u\n", "Configuring MIB for instance %d, CCid %d : (band %ld,Nid_cell %d,TX antenna port (p) %d,DL freq %u\n",
Mod_idP, Mod_idP,
...@@ -665,9 +657,9 @@ int rrc_mac_config_req_eNB_NB_IoT( ...@@ -665,9 +657,9 @@ int rrc_mac_config_req_eNB_NB_IoT(
LOG_I(MAC,"[CONFIG]npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13= %ld\n", radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13); LOG_I(MAC,"[CONFIG]npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13= %ld\n", radioResourceConfigCommon->npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13);
eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].radioResourceConfigCommon = radioResourceConfigCommon; //eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].radioResourceConfigCommon = radioResourceConfigCommon;
if (ul_CarrierFreq>0) if (ul_CarrierFreq>0)
eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].ul_CarrierFreq = ul_CarrierFreq; //eNB_mac_inst_NB_IoT[Mod_idP].common_channels[CC_idP].ul_CarrierFreq = ul_CarrierFreq;
config_sib2_fapi_NB_IoT(physCellId,radioResourceConfigCommon); config_sib2_fapi_NB_IoT(physCellId,radioResourceConfigCommon);
...@@ -712,9 +704,9 @@ int rrc_mac_config_req_eNB_NB_IoT( ...@@ -712,9 +704,9 @@ int rrc_mac_config_req_eNB_NB_IoT(
} }
//Now trigger the phy_config_xxx for configuring PHY through the PHY_config_req //Now trigger the phy_config_xxx for configuring PHY through the PHY_config_req
AssertFatal(if_inst->PHY_config_req != NULL, "rrc_mac_config_req_eNB_NB_IoT: PHY_config_req pointer function is NULL\n"); /*AssertFatal(if_inst->PHY_config_req != NULL, "rrc_mac_config_req_eNB_NB_IoT: PHY_config_req pointer function is NULL\n");
if(if_inst->PHY_config_req) if(if_inst->PHY_config_req)
if_inst->PHY_config_req(config_INFO); if_inst->PHY_config_req(config_INFO);*/
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT);
...@@ -1100,7 +1092,6 @@ int8_t mac_rrc_data_req_eNB_NB_IoT( ...@@ -1100,7 +1092,6 @@ int8_t mac_rrc_data_req_eNB_NB_IoT(
mib_flag_t mib_flag mib_flag_t mib_flag
) )
{ {
//MAC_xface_NB_IoT *mac_xface_NB_IoT;
SRB_INFO_NB_IoT *Srb_info; SRB_INFO_NB_IoT *Srb_info;
uint8_t Sdu_size=0; uint8_t Sdu_size=0;
...@@ -1112,7 +1103,7 @@ int8_t mac_rrc_data_req_eNB_NB_IoT( ...@@ -1112,7 +1103,7 @@ int8_t mac_rrc_data_req_eNB_NB_IoT(
#endif #endif
if((Srb_id & RAB_OFFSET) == BCCH_NB_IoT){ if((Srb_id & RAB_OFFSET) == BCCH0_NB_IoT){
// Requesting for the MIB-NB // Requesting for the MIB-NB
...@@ -1121,7 +1112,7 @@ int8_t mac_rrc_data_req_eNB_NB_IoT( ...@@ -1121,7 +1112,7 @@ int8_t mac_rrc_data_req_eNB_NB_IoT(
//XXX to be check when MIB-NB should be initialized //XXX to be check when MIB-NB should be initialized
if (eNB_rrc_inst_NB_IoT[Mod_idP].carrier[CC_id].sizeof_MIB_NB_IoT == 255) { if (eNB_rrc_inst_NB_IoT[Mod_idP].carrier[CC_id].sizeof_MIB_NB_IoT == 255) {
LOG_E(RRC,"[eNB %d] MAC Request for MIB-NB and MIB-NB not initialized\n",Mod_idP); LOG_E(RRC,"[eNB %d] MAC Request for MIB-NB and MIB-NB not initialized\n",Mod_idP);
mac_xface_NB_IoT->macphy_exit("mac_rrc_data_req_eNB_NB_IoT: MAC Request for MIB-NB and MIB-NB not initialized"); // exit here
} }
memcpy(&buffer_pP[0], memcpy(&buffer_pP[0],
...@@ -1160,12 +1151,12 @@ int8_t mac_rrc_data_req_eNB_NB_IoT( ...@@ -1160,12 +1151,12 @@ int8_t mac_rrc_data_req_eNB_NB_IoT(
//FIXME to be check when both are initialize and if make sense to have it //FIXME to be check when both are initialize and if make sense to have it
if (eNB_rrc_inst_NB_IoT[Mod_idP].carrier[CC_id].sizeof_SIB1_NB_IoT == 255) { if (eNB_rrc_inst_NB_IoT[Mod_idP].carrier[CC_id].sizeof_SIB1_NB_IoT == 255) {
LOG_E(RRC,"[eNB %d] MAC Request for SIB1-NB and SIB1-NB_IoT not initialized\n",Mod_idP); LOG_E(RRC,"[eNB %d] MAC Request for SIB1-NB and SIB1-NB_IoT not initialized\n",Mod_idP);
mac_xface_NB_IoT->macphy_exit("mac_rrc_data_req_eNB_NB_IoT: MAC Request for SIB1-NB_IoT and SIB1-NB_IoT not initialized"); // exit here
} }
if (eNB_rrc_inst_NB_IoT[Mod_idP].carrier[CC_id].sizeof_SIB23_NB_IoT == 255) { if (eNB_rrc_inst_NB_IoT[Mod_idP].carrier[CC_id].sizeof_SIB23_NB_IoT == 255) {
LOG_E(RRC,"[eNB %d] MAC Request for SIB23-NB and SIB23-NB_IoT not initialized\n",Mod_idP); LOG_E(RRC,"[eNB %d] MAC Request for SIB23-NB and SIB23-NB_IoT not initialized\n",Mod_idP);
mac_xface_NB_IoT->macphy_exit("mac_rrc_data_req_eNB_NB_IoT: MAC Request for SIB23-NB_IoT and SIB23-NB_IoT not initialized"); // exit here
} }
...@@ -1337,27 +1328,10 @@ void mac_eNB_rrc_ul_failure_NB_IoT( ...@@ -1337,27 +1328,10 @@ void mac_eNB_rrc_ul_failure_NB_IoT(
else { else {
LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP); LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP);
} }
rrc_mac_remove_ue_NB_IoT(mod_idP,rntiP); //rrc_mac_remove_ue_NB_IoT(mod_idP,rntiP);
} }
//defined in eNB_scheduler_primitives.c
void dump_ue_list_NB_IoT(UE_list_NB_IoT_t *listP, int ul_flag)
{
int j;
if ( ul_flag == 0 ) {
for (j=listP->head; j>=0; j=listP->next[j]) {
LOG_T(MAC,"node %d => %d\n",j,listP->next[j]);
}
} else {
for (j=listP->head_ul; j>=0; j=listP->next_ul[j]) {
LOG_T(MAC,"node %d => %d\n",j,listP->next_ul[j]);
}
}
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int8_t mac_rrc_data_req_NB_IoT( int8_t mac_rrc_data_req_NB_IoT(
const module_id_t Mod_idP, const module_id_t Mod_idP,
...@@ -1384,7 +1358,7 @@ int8_t mac_rrc_data_req_NB_IoT( ...@@ -1384,7 +1358,7 @@ int8_t mac_rrc_data_req_NB_IoT(
if( enb_flagP == ENB_FLAG_YES) { if( enb_flagP == ENB_FLAG_YES) {
if((Srb_id & RAB_OFFSET) == BCCH_NB_IoT) { if((Srb_id & RAB_OFFSET) == BCCH0_NB_IoT) {
if(eNB_rrc_inst_NB_IoT[Mod_idP].carrier[CC_id].SI.Active==0) { if(eNB_rrc_inst_NB_IoT[Mod_idP].carrier[CC_id].SI.Active==0) {
return 0; return 0;
} }
...@@ -1392,7 +1366,7 @@ int8_t mac_rrc_data_req_NB_IoT( ...@@ -1392,7 +1366,7 @@ int8_t mac_rrc_data_req_NB_IoT(
// All even frames transmit SIB in SF 5 // All even frames transmit SIB in SF 5
if (eNB_rrc_inst_NB_IoT[Mod_idP].carrier[CC_id].sizeof_SIB1_NB_IoT == 255) { if (eNB_rrc_inst_NB_IoT[Mod_idP].carrier[CC_id].sizeof_SIB1_NB_IoT == 255) {
LOG_E(RRC,"[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP); LOG_E(RRC,"[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP);
mac_xface_NB_IoT->macphy_exit("mac_rrc_data_req: MAC Request for SIB1 and SIB1 not initialized"); //exit here
} }
if ((frameP%2) == 0) { if ((frameP%2) == 0) {
...@@ -1531,11 +1505,6 @@ int8_t mac_rrc_data_req_NB_IoT( ...@@ -1531,11 +1505,6 @@ int8_t mac_rrc_data_req_NB_IoT(
return 0; // this parameter is set in function init_mcch in rrc_eNB.c return 0; // this parameter is set in function init_mcch in rrc_eNB.c
} }
// this part not needed as it is done in init_mcch
/* if (eNB_rrc_inst[Mod_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area] == 255) {
LOG_E(RRC,"[eNB %d] MAC Request for MCCH MESSAGE and MCCH MESSAGE is not initialized\n",Mod_id);
mac_xface->macphy_exit("");
}*/
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
...@@ -1630,6 +1599,7 @@ int8_t mac_rrc_data_req_NB_IoT( ...@@ -1630,6 +1599,7 @@ int8_t mac_rrc_data_req_NB_IoT(
} }
//defined in L2_interface //defined in L2_interface
void mac_eNB_rrc_ul_in_sync_NB_IoT( void mac_eNB_rrc_ul_in_sync_NB_IoT(
const module_id_t mod_idP, const module_id_t mod_idP,
...@@ -2385,8 +2355,6 @@ boolean_t pdcp_data_req_NB_IoT( ...@@ -2385,8 +2355,6 @@ boolean_t pdcp_data_req_NB_IoT(
const pdcp_transmission_mode_t modeP const pdcp_transmission_mode_t modeP
) )
{ {
//MAC_xface_NB_IoT *mac_xface_NB_IoT; //test_xface
pdcp_t *pdcp_p = NULL; pdcp_t *pdcp_p = NULL;
uint8_t i = 0; uint8_t i = 0;
uint8_t pdcp_header_len = 0; uint8_t pdcp_header_len = 0;
...@@ -2425,8 +2393,7 @@ boolean_t pdcp_data_req_NB_IoT( ...@@ -2425,8 +2393,7 @@ boolean_t pdcp_data_req_NB_IoT(
if (sdu_buffer_sizeP > MAX_IP_PACKET_SIZE) { if (sdu_buffer_sizeP > MAX_IP_PACKET_SIZE) {
LOG_E(PDCP, "Requested SDU size (%d) is bigger than that can be handled by PDCP (%u)!\n", LOG_E(PDCP, "Requested SDU size (%d) is bigger than that can be handled by PDCP (%u)!\n",
sdu_buffer_sizeP, MAX_IP_PACKET_SIZE); sdu_buffer_sizeP, MAX_IP_PACKET_SIZE);
// XXX What does following call do? // exit here
mac_xface_NB_IoT->macphy_exit("PDCP sdu buffer size > MAX_IP_PACKET_SIZE");
} }
//check for MBMS not needed for NB-IoT*/ //check for MBMS not needed for NB-IoT*/
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include "LAYER2/RLC/rlc.h" #include "LAYER2/RLC/rlc.h"
#include "LogicalChannelConfig-NB-r13.h" #include "LogicalChannelConfig-NB-r13.h"
extern IF_Module_t *if_inst;
//MP: NOTE:XXX some of the parameters defined in vars_nb_iot are called by the extern.h file so not replicated here //MP: NOTE:XXX some of the parameters defined in vars_nb_iot are called by the extern.h file so not replicated here
extern UE_RRC_INST_NB_IoT *UE_rrc_inst_NB_IoT; extern UE_RRC_INST_NB_IoT *UE_rrc_inst_NB_IoT;
......
...@@ -251,18 +251,14 @@ void openair_rrc_top_init_eNB_NB_IoT(void)//MP: XXX Raymond put this directly th ...@@ -251,18 +251,14 @@ void openair_rrc_top_init_eNB_NB_IoT(void)//MP: XXX Raymond put this directly th
//not consider UE part //not consider UE part
if (NB_eNB_INST > 0) { eNB_rrc_inst_NB_IoT = (eNB_RRC_INST_NB_IoT*) malloc16(sizeof(eNB_RRC_INST_NB_IoT));
eNB_rrc_inst_NB_IoT = (eNB_RRC_INST_NB_IoT*) malloc16(NB_eNB_INST*sizeof(eNB_RRC_INST_NB_IoT)); memset (eNB_rrc_inst_NB_IoT, 0, sizeof(eNB_RRC_INST_NB_IoT));
memset (eNB_rrc_inst_NB_IoT, 0, NB_eNB_INST * sizeof(eNB_RRC_INST_NB_IoT)); LOG_D(RRC, "ALLOCATE %d Bytes for eNB_RRC_INST NB-IoT @ %p\n", (unsigned int)(sizeof(eNB_RRC_INST_NB_IoT)), eNB_rrc_inst_NB_IoT);
LOG_D(RRC, "ALLOCATE %d Bytes for eNB_RRC_INST NB-IoT @ %p\n", (unsigned int)(NB_eNB_INST*sizeof(eNB_RRC_INST_NB_IoT)), eNB_rrc_inst_NB_IoT);
//no CBA, no LOcalization, no MBMS flag //no CBA, no LOcalization, no MBMS flag
LOG_D(RRC, LOG_D(RRC,
"ALLOCATE %d Bytes for eNB_RRC_INST_NB @ %p\n", (unsigned int)(NB_eNB_INST*sizeof(eNB_RRC_INST_NB_IoT)), eNB_rrc_inst_NB_IoT); "ALLOCATE %d Bytes for eNB_RRC_INST_NB @ %p\n", (unsigned int)(sizeof(eNB_RRC_INST_NB_IoT)), eNB_rrc_inst_NB_IoT);
} else {
eNB_rrc_inst_NB_IoT = NULL;
}
} }
......
...@@ -102,15 +102,12 @@ ...@@ -102,15 +102,12 @@
#ifdef PHY_EMUL #ifdef PHY_EMUL
extern EMULATION_VARS *Emul_vars; extern EMULATION_VARS *Emul_vars;
#endif #endif
extern eNB_MAC_INST_NB_IoT *eNB_mac_inst;
extern UE_MAC_INST_NB_IoT *UE_mac_inst;
#ifdef BIGPHYSAREA #ifdef BIGPHYSAREA
extern void* bigphys_malloc(int); extern void* bigphys_malloc(int);
#endif #endif
//#include "PHY_INTERFACE/defs_NB_IoT.h"
/*the Message Unit Identifieer (MUI) is an Identity of the RLC SDU, whic is used to indicate which RLC SDU that is confirmed /*the Message Unit Identifieer (MUI) is an Identity of the RLC SDU, whic is used to indicate which RLC SDU that is confirmed
* with the RLC-AM-Data-conf. e.g. ((struct rlc_am_data_req *) (new_sdu_p->data))->mui (rlc_data_req_NB_IoT) * with the RLC-AM-Data-conf. e.g. ((struct rlc_am_data_req *) (new_sdu_p->data))->mui (rlc_data_req_NB_IoT)
*/ */
...@@ -132,8 +129,6 @@ void rrc_eNB_free_UE_NB_IoT(const module_id_t enb_mod_idP,const struct rrc_eNB_u ...@@ -132,8 +129,6 @@ void rrc_eNB_free_UE_NB_IoT(const module_id_t enb_mod_idP,const struct rrc_eNB_u
#endif #endif
rnti_t rnti = ue_context_pP->ue_context.rnti; rnti_t rnti = ue_context_pP->ue_context.rnti;
AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %x!", enb_mod_idP, NB_eNB_INST, rnti);
/* ue_context_p = rrc_eNB_get_ue_context( /* ue_context_p = rrc_eNB_get_ue_context(
&eNB_rrc_inst[enb_mod_idP], &eNB_rrc_inst[enb_mod_idP],
rntiP rntiP
...@@ -161,7 +156,7 @@ void rrc_eNB_free_UE_NB_IoT(const module_id_t enb_mod_idP,const struct rrc_eNB_u ...@@ -161,7 +156,7 @@ void rrc_eNB_free_UE_NB_IoT(const module_id_t enb_mod_idP,const struct rrc_eNB_u
#endif #endif
#endif #endif
rrc_mac_remove_ue_NB_IoT(enb_mod_idP,rnti); //rrc_mac_remove_ue_NB_IoT(enb_mod_idP,rnti);
rrc_rlc_remove_ue(&ctxt); rrc_rlc_remove_ue(&ctxt);
pdcp_remove_UE(&ctxt); pdcp_remove_UE(&ctxt);
...@@ -490,7 +485,6 @@ void rrc_eNB_generate_RRCConnectionSetup_NB_IoT( ...@@ -490,7 +485,6 @@ void rrc_eNB_generate_RRCConnectionSetup_NB_IoT(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
//MAC_xface_NB_IoT *mac_xface_NB_IoT;
//connection setup involve the establishment of SRB1 and SRB1bis (but srb1bis is established implicitly) //connection setup involve the establishment of SRB1 and SRB1bis (but srb1bis is established implicitly)
//XXX: this message should go through SRB0 to see this--> uper_encode //XXX: this message should go through SRB0 to see this--> uper_encode
//XXX: they are assuming that 2 RLC-AM entities are used for SRB1 and SRB1bis //XXX: they are assuming that 2 RLC-AM entities are used for SRB1 and SRB1bis
...@@ -509,7 +503,7 @@ void rrc_eNB_generate_RRCConnectionSetup_NB_IoT( ...@@ -509,7 +503,7 @@ void rrc_eNB_generate_RRCConnectionSetup_NB_IoT(
//XXX MP:warning due to function still not completed at PHY (get_lte_frame_parms) //XXX MP:warning due to function still not completed at PHY (get_lte_frame_parms)
//XXX this approach is gone most probably //XXX this approach is gone most probably
NB_IoT_DL_FRAME_PARMS *fp = mac_xface_NB_IoT->get_NB_IoT_frame_parms(ctxt_pP->module_id,CC_id); NB_IoT_DL_FRAME_PARMS *fp = get_NB_IoT_frame_parms(ctxt_pP->module_id,CC_id);
T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
...@@ -758,7 +752,6 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete_NB_IoT( ...@@ -758,7 +752,6 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete_NB_IoT(
if (oip_ifup == 0) { // interface is up --> send a config the DRB if (oip_ifup == 0) { // interface is up --> send a config the DRB
# ifdef OAI_EMU # ifdef OAI_EMU
oai_emulation.info.oai_ifup[ctxt_pP->module_id] = 1; oai_emulation.info.oai_ifup[ctxt_pP->module_id] = 1;
dest_ip_offset = NB_eNB_INST;
# else # else
dest_ip_offset = 8; dest_ip_offset = 8;
# endif # endif
...@@ -1613,8 +1606,6 @@ static void init_SI_NB_IoT( ...@@ -1613,8 +1606,6 @@ static void init_SI_NB_IoT(
) )
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
{ {
//MAC_xface_NB_IoT *mac_xface_NB_IoT; //test_xface
/*WE should allocate memory for PHY_Config structure /*WE should allocate memory for PHY_Config structure
* is declared in vars_nb_iot.c and put also in the extern_nb_iot * is declared in vars_nb_iot.c and put also in the extern_nb_iot
* */ * */
...@@ -1652,12 +1643,12 @@ static void init_SI_NB_IoT( ...@@ -1652,12 +1643,12 @@ static void init_SI_NB_IoT(
else { else {
LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for MIB_NB_IoT allocated\n", LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for MIB_NB_IoT allocated\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
mac_xface_NB_IoT->macphy_exit("[RRC][init_SI] FATAL, no memory for MIB_NB_IoT allocated"); //exit here
} }
if (eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id].sizeof_MIB_NB_IoT == 255) { if (eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id].sizeof_MIB_NB_IoT == 255) {
mac_xface_NB_IoT->macphy_exit("[RRC][init_SI] FATAL, eNB_rrc_inst_NB[enb_mod_idP].carrier[CC_id].sizeof_MIB_NB_IoT == 255"); // exit here
} }
//SIB1_NB_IoT //SIB1_NB_IoT
...@@ -1675,11 +1666,11 @@ static void init_SI_NB_IoT( ...@@ -1675,11 +1666,11 @@ static void init_SI_NB_IoT(
else { else {
LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1_NB_IoT allocated\n", LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1_NB_IoT allocated\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
mac_xface_NB_IoT->macphy_exit("[RRC][init_SI] FATAL, no memory for SIB1_NB_IoT allocated"); //exit here
} }
if (eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1_NB_IoT == 255) { if (eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1_NB_IoT == 255) {
mac_xface_NB_IoT->macphy_exit("[RRC][init_SI] FATAL, eNB_rrc_inst_NB[enb_mod_idP].carrier[CC_id].sizeof_SIB1_NB_IoT == 255"); //exit here
} }
//SIB23_NB_IoT //SIB23_NB_IoT
...@@ -1694,7 +1685,7 @@ static void init_SI_NB_IoT( ...@@ -1694,7 +1685,7 @@ static void init_SI_NB_IoT(
); );
if (eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB23_NB_IoT == 255) { if (eNB_rrc_inst_NB_IoT[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB23_NB_IoT == 255) {
mac_xface_NB_IoT->macphy_exit("[RRC][init_SI] FATAL, eNB_rrc_inst_NB[mod].carrier[CC_id].sizeof_SIB23_NB_IoT == 255"); //exit here
} }
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n", LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n",
...@@ -1748,7 +1739,7 @@ static void init_SI_NB_IoT( ...@@ -1748,7 +1739,7 @@ static void init_SI_NB_IoT(
} else { } else {
LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB2/3_NB allocated\n", LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB2/3_NB allocated\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
mac_xface_NB_IoT->macphy_exit("[RRC][init_SI] FATAL, no memory for SIB2/3_NB allocated"); //exit here
} }
} }
...@@ -1997,7 +1988,7 @@ int rrc_eNB_decode_ccch_NB_IoT( ...@@ -1997,7 +1988,7 @@ int rrc_eNB_decode_ccch_NB_IoT(
LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n",
ctxt_pP->rnti, ue_context_p->ue_context.rnti, ctxt_pP->rnti); ctxt_pP->rnti, ue_context_p->ue_context.rnti, ctxt_pP->rnti);
rrc_mac_remove_ue_NB_IoT(ctxt_pP->module_id, ctxt_pP->rnti); //rrc_mac_remove_ue_NB_IoT(ctxt_pP->module_id, ctxt_pP->rnti);
ue_context_p = NULL; ue_context_p = NULL;
return 0; return 0;
} else { } else {
...@@ -2012,7 +2003,7 @@ int rrc_eNB_decode_ccch_NB_IoT( ...@@ -2012,7 +2003,7 @@ int rrc_eNB_decode_ccch_NB_IoT(
if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist_NB(ctxt_pP, mme_code, m_tmsi))) { if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist_NB(ctxt_pP, mme_code, m_tmsi))) {
LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti);
rrc_mac_remove_ue_NB_IoT(ctxt_pP->module_id, ue_context_p->ue_context.rnti); //rrc_mac_remove_ue_NB_IoT(ctxt_pP->module_id, ue_context_p->ue_context.rnti);
stmsi_received=1; stmsi_received=1;
/* replace rnti in the context */ /* replace rnti in the context */
...@@ -2104,7 +2095,7 @@ int rrc_eNB_decode_ccch_NB_IoT( ...@@ -2104,7 +2095,7 @@ int rrc_eNB_decode_ccch_NB_IoT(
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
random_value); random_value);
rrc_mac_remove_ue_NB_IoT(ctxt_pP->module_id,ctxt_pP->rnti); //rrc_mac_remove_ue_NB_IoT(ctxt_pP->module_id,ctxt_pP->rnti);
return -1; return -1;
} }
} }
...@@ -2341,14 +2332,6 @@ int rrc_eNB_decode_dcch_NB_IoT( ...@@ -2341,14 +2332,6 @@ int rrc_eNB_decode_dcch_NB_IoT(
ue_context_p, ue_context_p,
ul_dcch_msg_NB_IoT->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.rrc_TransactionIdentifier); ul_dcch_msg_NB_IoT->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.rrc_TransactionIdentifier);
#if defined(FLEXRAN_AGENT_SB_IF)
//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
if (mac_agent_registered[ctxt_pP->module_id]) {
agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ue_context_p->ue_id_rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED);
}
#endif
} }
//#if defined(ENABLE_ITTI)... //#if defined(ENABLE_ITTI)...
...@@ -2402,7 +2385,7 @@ int rrc_eNB_decode_dcch_NB_IoT( ...@@ -2402,7 +2385,7 @@ int rrc_eNB_decode_dcch_NB_IoT(
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(rrcConnectionReestablishmentComplete-NB) ---> RRC_eNB\n", "(rrcConnectionReestablishmentComplete-NB) ---> RRC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH_NB_IoT, DCCH0_NB_IoT,
sdu_sizeP); sdu_sizeP);
break; break;
...@@ -2450,14 +2433,6 @@ int rrc_eNB_decode_dcch_NB_IoT( ...@@ -2450,14 +2433,6 @@ int rrc_eNB_decode_dcch_NB_IoT(
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED_NB_IoT \n", LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED_NB_IoT \n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
#if defined(FLEXRAN_AGENT_SB_IF)
//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
if (mac_agent_registered[ctxt_pP->module_id]) {
agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ue_context_p->ue_id_rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED);
}
#endif
} }
...@@ -2497,7 +2472,7 @@ int rrc_eNB_decode_dcch_NB_IoT( ...@@ -2497,7 +2472,7 @@ int rrc_eNB_decode_dcch_NB_IoT(
LOG_I(RRC, LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete-NB on UL-DCCH %d from UE\n", PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete-NB on UL-DCCH %d from UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH_NB_IoT); DCCH0_NB_IoT);
LOG_D(RRC, LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(securityModeComplete-NB) ---> RRC_eNB\n", "(securityModeComplete-NB) ---> RRC_eNB\n",
...@@ -2743,7 +2718,7 @@ int rrc_eNB_decode_dcch_NB_IoT( ...@@ -2743,7 +2718,7 @@ int rrc_eNB_decode_dcch_NB_IoT(
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(rrcConnectionResumeComplete-NB) ---> RRC_eNB\n", "(rrcConnectionResumeComplete-NB) ---> RRC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH_NB_IoT, //check DCCH0_NB_IoT, //check
sdu_sizeP); sdu_sizeP);
break; break;
......
...@@ -614,7 +614,7 @@ static inline int rxtx_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *p ...@@ -614,7 +614,7 @@ static inline int rxtx_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_rxtx_proc_NB_IoT_t *p
* (on its turn the scheduler will trigger the phy_procedure_eNB_TX through schedule_responce function * (on its turn the scheduler will trigger the phy_procedure_eNB_TX through schedule_responce function
*/ */
if(if_inst->UL_indication) if_inst->UL_indication(UL_INFO); //if(if_inst->UL_indication) if_inst->UL_indication(UL_INFO);
if (oai_exit) return(-1); if (oai_exit) return(-1);
......
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