Commit 559e81bb authored by Michele Paffetti's avatar Michele Paffetti

solved some warnings but still lots remain (due also to asn1 problems)

parent 4e522af6
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
* contact@openairinterface.org * contact@openairinterface.org
*/ */
#ifndef __INIT_DEFS__H__ #ifndef __INIT_DEFS__NB_H__
#define __INIT_DEFS__H__ #define __INIT_DEFS__NB_H__
#include "PHY/defs.h" #include "PHY/defs.h"
...@@ -34,6 +34,11 @@ ...@@ -34,6 +34,11 @@
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
#include "SCellToAddMod-r10.h" #include "SCellToAddMod-r10.h"
#endif #endif
#include "RadioResourceConfigCommonSIB-NB-r13.h"
#include "PhysicalConfigDedicated-NB-r13.h"
/** @addtogroup _PHY_STRUCTURES_ /** @addtogroup _PHY_STRUCTURES_
* @{ * @{
*/ */
...@@ -338,22 +343,22 @@ void NB_phy_config_mib_eNB(int Mod_id, ...@@ -338,22 +343,22 @@ void NB_phy_config_mib_eNB(int Mod_id,
int Ncp, int Ncp,
int p_eNB, int p_eNB,
uint32_t dl_CarrierFreq, uint32_t dl_CarrierFreq,
uint32_t ul_CarrierFreq, uint32_t ul_CarrierFreq);
struct MasterInformationBlock_NB__operationModeInfo_r13_u operationModeInfo); //struct MasterInformationBlock_NB__operationModeInfo_r13 operationModeInfo);
/*NB_phy_config_sib1_eNB is not needed since NB-IoT use only FDD mode*/ /*NB_phy_config_sib1_eNB is not needed since NB-IoT use only FDD mode*/
/*brief Configure LTE_DL_FRAME_PARMS with components of SIB2-NB (at eNB).*/ /*brief Configure LTE_DL_FRAME_PARMS with components of SIB2-NB (at eNB).*/
void NB_phy_config_sib2_eNB(module_id_t Mod_id, void NB_phy_config_sib2_eNB(module_id_t Mod_id,
int CC_id, int CC_id,
RadioResourceConfigCommonSIB_NB_r13 *radioResourceConfigCommon, RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_r9_t *ul_CArrierFreq,, ARFCN_ValueEUTRA_r9_t *ul_CArrierFreq
); );
void NB_phy_config_dedicated_eNB(module_id_t Mod_id, void NB_phy_config_dedicated_eNB(module_id_t Mod_id,
int CC_id, int CC_id,
rnti_t rnti, rnti_t rnti,
struct PhysicalConfigDedicated_NB_r13 *physicalConfigDedicated); PhysicalConfigDedicated_NB_r13_t *physicalConfigDedicated);
......
...@@ -37,71 +37,7 @@ extern uint16_t prach_root_sequence_map0_3[838]; ...@@ -37,71 +37,7 @@ extern uint16_t prach_root_sequence_map0_3[838];
extern uint16_t prach_root_sequence_map4[138]; extern uint16_t prach_root_sequence_map4[138];
uint8_t dmrs1_tab[8] = {0,2,3,4,6,8,9,10}; uint8_t dmrs1_tab[8] = {0,2,3,4,6,8,9,10};
#if defined(NB_IoT)
void NB_phy_config_mib_eNB(int Mod_id,
int CC_id,
int eutra_band,
int Nid_cell,
int Ncp,
int p_eNB,
uint32_t dl_CarrierFreq,
uint32_t ul_CarrierFreq) {
LTE_DL_FRAME_PARMS *fp;
LOG_I(PHY,"Configuring MIB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,DL freq %u)\n",
Mod_id, CC_id, eutra_band, N_RB_DL_array[dl_Bandwidth], Nid_cell, p_eNB,dl_CarrierFreq);
/*if (RC.eNB == NULL) {
RC.eNB = (PHY_VARS_eNB ***)malloc((1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
LOG_I(PHY,"RC.eNB = %p\n",RC.eNB);
memset(RC.eNB,0,(1+NUMBER_OF_eNB_MAX)*sizeof(PHY_VARS_eNB***));
}
if (RC.eNB[Mod_id] == NULL) {
RC.eNB[Mod_id] = (PHY_VARS_eNB **)malloc((1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB**));
LOG_I(PHY,"RC.eNB[%d] = %p\n",Mod_id,RC.eNB[Mod_id]);
memset(RC.eNB[Mod_id],0,(1+MAX_NUM_CCs)*sizeof(PHY_VARS_eNB***));
}
if (RC.eNB[Mod_id][CC_id] == NULL) {
RC.eNB[Mod_id][CC_id] = (PHY_VARS_eNB *)malloc(sizeof(PHY_VARS_eNB));
LOG_I(PHY,"RC.eNB[%d][%d] = %p\n",Mod_id,CC_id,RC.eNB[Mod_id][CC_id]);
RC.eNB[Mod_id][CC_id]->Mod_id = Mod_id;
RC.eNB[Mod_id][CC_id]->CC_id = CC_id;
}
RC.eNB[Mod_id][CC_id]->mac_enabled = 1;
fp = &RC.eNB[Mod_id][CC_id]->frame_parms; */
fp->Nid_cell = Nid_cell;
fp->nushift = Nid_cell%6;
fp->eutra_band = eutra_band;
fp->Ncp = Ncp;
fp->nb_antenna_ports_eNB = p_eNB;
fp->dl_CarrierFreq = dl_CarrierFreq;
fp->ul_CarrierFreq = ul_CarrierFreq;
init_frame_parms(fp,1);
init_lte_top(fp);
}
void NB_phy_config_sib2_eNB(uint8_t Mod_id,
int CC_id,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
)
{
}
#endif
// FIXME not used anywhere
void phy_config_mib(LTE_DL_FRAME_PARMS *fp, void phy_config_mib(LTE_DL_FRAME_PARMS *fp,
uint8_t N_RB_DL, uint8_t N_RB_DL,
uint8_t Nid_cell, uint8_t Nid_cell,
......
...@@ -36,12 +36,11 @@ ...@@ -36,12 +36,11 @@
//NB-IoT //NB-IoT
#include "defs_nb_iot.h" #include "defs_nb_iot.h"
#include "RadioResourceConfigCommonSIB-NB-r13.h" #include "RadioResourceConfigCommonSIB-NB-r13.h"
#include "PHY/impl_defs_lte_nb_iot.h"
#include "RadioResourceConfigDedicated-NB-r13.h" #include "RadioResourceConfigDedicated-NB-r13.h"
extern uint16_t prach_root_sequence_map0_3[838]; extern uint16_t prach_root_sequence_map0_3[838];
extern uint16_t prach_root_sequence_map4[138]; extern uint16_t prach_root_sequence_map4[138];
uint8_t dmrs1_tab[8] = {0,2,3,4,6,8,9,10}; //uint8_t dmrs1_tab[8] = {0,2,3,4,6,8,9,10};
void NB_phy_config_mib_eNB(int Mod_id, void NB_phy_config_mib_eNB(int Mod_id,
...@@ -76,7 +75,7 @@ void NB_phy_config_mib_eNB(int Mod_id, ...@@ -76,7 +75,7 @@ void NB_phy_config_mib_eNB(int Mod_id,
fp = &RC.eNB[Mod_id][CC_id]->frame_parms; */ fp = &RC.eNB[Mod_id][CC_id]->frame_parms; */
NB_DL_FRAME_PARMS *fp = &PHY_vars_eNB_g[Mod_id][CC_id]->frame_parms; NB_DL_FRAME_PARMS *fp = &PHY_vars_eNB_g[Mod_id][CC_id]->frame_parms; //MP: PHY_VARS_eNB still to be modified
//LOG_I(PHY,"Configuring MIB-NB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,DL freq %u)\n", //LOG_I(PHY,"Configuring MIB-NB for instance %d, CCid %d : (band %d,N_RB_DL %d,Nid_cell %d,p %d,DL freq %u)\n",
//Mod_id, CC_id, eutra_band, N_RB_DL_array[dl_Bandwidth], Nid_cell, p_eNB,dl_CarrierFreq); //Mod_id, CC_id, eutra_band, N_RB_DL_array[dl_Bandwidth], Nid_cell, p_eNB,dl_CarrierFreq);
......
...@@ -119,6 +119,7 @@ static inline void* malloc16_clear( size_t size ) ...@@ -119,6 +119,7 @@ static inline void* malloc16_clear( size_t size )
#include "impl_defs_top.h" #include "impl_defs_top.h"
#include "impl_defs_lte.h" #include "impl_defs_lte.h"
#include "impl_defs_lte_nb_iot.h"
#include "PHY/TOOLS/time_meas.h" #include "PHY/TOOLS/time_meas.h"
#include "PHY/CODING/defs.h" #include "PHY/CODING/defs.h"
......
...@@ -261,6 +261,9 @@ void dump_ue_list(UE_list_t *listP, int ul_flag) ...@@ -261,6 +261,9 @@ void dump_ue_list(UE_list_t *listP, int ul_flag)
} }
} }
//---------------------
int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP,int harq_pidP) int add_new_ue(module_id_t mod_idP, int cc_idP, rnti_t rntiP,int harq_pidP)
{ {
int UE_id; int UE_id;
......
...@@ -1669,7 +1669,7 @@ pdcp_config_set_security( ...@@ -1669,7 +1669,7 @@ pdcp_config_set_security(
pdcp_pP->integrityProtAlgorithm, pdcp_pP->integrityProtAlgorithm,
ctxt_pP->rnti); ctxt_pP->rnti);
} }
/*particular case activated by SecurityModeFailure*/ /*]SecurityModeFailure*/
else if(security_modeP == -1){ else if(security_modeP == -1){
// in this way in NB_pdcp_data_req function you never call "pdcp_apply_security" // in this way in NB_pdcp_data_req function you never call "pdcp_apply_security"
// and we never call pdcp_validate_security in NB_pdcp_data_indi // and we never call pdcp_validate_security in NB_pdcp_data_indi
......
...@@ -134,7 +134,7 @@ typedef struct rlc_am_entity_s { ...@@ -134,7 +134,7 @@ typedef struct rlc_am_entity_s {
uint16_t max_retx_threshold; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to limit the number of retransmissions of an AMD PDU. */ uint16_t max_retx_threshold; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to limit the number of retransmissions of an AMD PDU. */
uint16_t poll_pdu; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to trigger a poll for every pollPDU PDUs. */ uint16_t poll_pdu; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to trigger a poll for every pollPDU PDUs. */
uint32_t poll_byte; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to trigger a poll for every pollByte bytes. */ uint32_t poll_byte; /*!< \brief This parameter is used by the transmitting side of each AM RLC entity to trigger a poll for every pollByte bytes. */
uint16_t enableStatusReportSN_Gap; uint32_t enableStatusReportSN_Gap;
//--------------------------------------------------------------------- //---------------------------------------------------------------------
// STATISTICS // STATISTICS
......
This diff is collapsed.
...@@ -52,17 +52,9 @@ ...@@ -52,17 +52,9 @@
* RETURN VALUES: * RETURN VALUES:
* 0: The structure is printed. * 0: The structure is printed.
* -1: Problem printing the structure. * -1: Problem printing the structure.
* WARNING: No sensible errno value is returned. * WARNING: No sensible error value is returned.
*/ */
//not touched
int xer_sprint(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr);
//not touched
uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index);
//Not touched
uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId);
/** /**
\brief Generate configuration for SIB1 (eNB). \brief Generate configuration for SIB1 (eNB).
......
...@@ -47,6 +47,13 @@ extern uint8_t DRB2LCHAN_NB[2]; ...@@ -47,6 +47,13 @@ extern uint8_t DRB2LCHAN_NB[2];
extern LogicalChannelConfig_NB_r13_t SRB1bis_NB_logicalChannelConfig_defaultValue; extern LogicalChannelConfig_NB_r13_t SRB1bis_NB_logicalChannelConfig_defaultValue;
extern LogicalChannelConfig_NB_r13_t SRB1_NB_logicalChannelConfig_defaultValue; extern LogicalChannelConfig_NB_r13_t SRB1_NB_logicalChannelConfig_defaultValue;
extern uint16_t T300_NB[8];
extern uint16_t T301_NB[8];
extern uint16_t T310_NB[8];
extern uint16_t T311_NB[8];
extern uint16_t N310_NB[8];
extern uint16_t N311_NB[8];
#endif #endif
...@@ -127,6 +127,7 @@ int8_t NB_mac_rrc_data_req_eNB( ...@@ -127,6 +127,7 @@ int8_t NB_mac_rrc_data_req_eNB(
const int CC_id, const int CC_id,
const frame_t frameP, const frame_t frameP,
const frame_t h_frameP, const frame_t h_frameP,
const sub_frame_t subframeP,
const rb_id_t Srb_id, const rb_id_t Srb_id,
uint8_t* const buffer_pP, uint8_t* const buffer_pP,
long schedulingInfoSIB1,//from the mib long schedulingInfoSIB1,//from the mib
...@@ -150,6 +151,11 @@ int8_t NB_mac_rrc_data_ind_eNB( ...@@ -150,6 +151,11 @@ int8_t NB_mac_rrc_data_ind_eNB(
); );
//------------------------------------------- //-------------------------------------------
//defined in L2_interface
void dump_ue_list_NB(UE_list_NB_t *listP, int ul_flag);
//-------------------------------------------
//defined in L2_interface //defined in L2_interface
void NB_mac_eNB_rrc_ul_failure( void NB_mac_eNB_rrc_ul_failure(
const module_id_t mod_idP, const module_id_t mod_idP,
...@@ -179,7 +185,22 @@ int NB_mac_eNB_get_rrc_status( ...@@ -179,7 +185,22 @@ int NB_mac_eNB_get_rrc_status(
); );
//--------------------------- //---------------------------
//FIXME for the moment we not configure PDCP for SRB1bis (but used as it is SRB1) //----------------------------------------
int
NB_pdcp_apply_security(
const protocol_ctxt_t* const ctxt_pP,
pdcp_t *const pdcp_pP,
const srb_flag_t srb_flagP,
const rb_id_t rb_id, //rb_idP % maxDRB_NB_r13
const uint8_t pdcp_header_len,
const uint16_t current_sn,
uint8_t * const pdcp_pdu_buffer,
const uint16_t sdu_buffer_size
);
//-------------------------------------------
//XXX for the moment we not configure PDCP for SRB1bis (but used as it is SRB1)
//defined in pdcp.c //defined in pdcp.c
boolean_t NB_rrc_pdcp_config_asn1_req ( boolean_t NB_rrc_pdcp_config_asn1_req (
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
...@@ -279,7 +300,7 @@ NB_rlc_am_configure( ...@@ -279,7 +300,7 @@ NB_rlc_am_configure(
rlc_am_entity_t *const rlc_pP, rlc_am_entity_t *const rlc_pP,
const uint16_t max_retx_thresholdP, const uint16_t max_retx_thresholdP,
const uint16_t t_poll_retransmitP, const uint16_t t_poll_retransmitP,
const uint16_t* const enableStatusReportSN_Gap const uint32_t* const enableStatusReportSN_Gap
); );
//-------------------------------------------------------------- //--------------------------------------------------------------
...@@ -413,9 +434,7 @@ tbs_size_t NB_mac_rlc_data_req_eNB( ...@@ -413,9 +434,7 @@ tbs_size_t NB_mac_rlc_data_req_eNB(
/*UE procedures*/ /*-----------eNB procedures (rrc_eNB_nb_iot.c)---------------*/
/*eNB procedures*/
//---Initialization-------------- //---Initialization--------------
void void
...@@ -535,6 +554,12 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c ...@@ -535,6 +554,12 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
/// Utilities------------------------------------------------ /// Utilities------------------------------------------------
void
rrc_eNB_free_UE_NB(
const module_id_t enb_mod_idP,
const struct rrc_eNB_ue_context_NB_s* const ue_context_pP
);
void void
rrc_eNB_free_mem_UE_context_NB( rrc_eNB_free_mem_UE_context_NB(
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
......
...@@ -54,11 +54,59 @@ extern mui_t rrc_eNB_mui; ...@@ -54,11 +54,59 @@ extern mui_t rrc_eNB_mui;
/*missed functions*/ /*missed functions*/
//rrc_top_cleanup //rrc_top_cleanup
//rrc_t310_expiration
//binary_search_init //binary_search_init
//binary_search_float //binary_search_float
//--------------
//MP: Most probably is not needed (old code)
//-----------------------------------------------------------------------------
void
rrc_t310_expiration_NB(
const protocol_ctxt_t* const ctxt_pP,
const uint8_t eNB_index
)
//-----------------------------------------------------------------------------
{
if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State != RRC_CONNECTED) {
LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n");
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_IDLE;
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].UE_index = 0xffff;
UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Rx_buffer.payload_size = 0;
UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size = 0;
UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Rx_buffer.payload_size = 0;
UE_rrc_inst[ctxt_pP->module_id].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size = 0;
if (UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active == 1) {
msg ("[RRC Inst %d] eNB_index %d, Remove RB %d\n ", ctxt_pP->module_id, eNB_index,
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id);
rrc_pdcp_config_req (ctxt_pP, // MP
SRB_FLAG_YES,
CONFIG_ACTION_REMOVE,
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
0);
NB_rrc_rlc_config_req(
ctxt_pP,
SRB_FLAG_YES,
CONFIG_ACTION_REMOVE,
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id,
Rlc_info_am);
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active = 0;
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Status = IDLE;
UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Next_check_frame = 0;
}
} else { // Restablishment procedure
LOG_D(RRC, "Timer 310 expired, trying RRCRestablishment ...\n");
}
}
//configure BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs //configure BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
//called by openair_rrc_eNB_configuration_NB //called by openair_rrc_eNB_configuration_NB
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
...@@ -304,7 +352,7 @@ rrc_rx_tx_NB( ...@@ -304,7 +352,7 @@ rrc_rx_tx_NB(
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) { if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) {
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0; UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
rrc_t310_expiration (ctxt_pP, enb_indexP); //FIXME: maybe is required a NB_iot version of this function rrc_t310_expiration_NB (ctxt_pP, enb_indexP); //FIXME: maybe is required a NB_iot version of this function
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n"); LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n");
return RRC_PHY_RESYNCH; return RRC_PHY_RESYNCH;
...@@ -389,8 +437,7 @@ rrc_rx_tx_NB( ...@@ -389,8 +437,7 @@ rrc_rx_tx_NB(
} }
} }
if (ue_to_be_removed) if (ue_to_be_removed)
rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed); //FIXME: quite comple procedure, should use the same for NB-IoT? rrc_eNB_free_UE_NB(ctxt_pP->module_id,ue_to_be_removed);
//no localization in NB-IoT //no localization in NB-IoT
(void)ts; /* remove gcc warning "unused variable" */ (void)ts; /* remove gcc warning "unused variable" */
......
...@@ -48,17 +48,6 @@ uid_linear_allocator_init( ...@@ -48,17 +48,6 @@ uid_linear_allocator_init(
memset(uid_pP, 0, sizeof(uid_allocator_t)); memset(uid_pP, 0, sizeof(uid_allocator_t));
} }
//------------------------------------------------------------------------------
void
uid_linear_allocator_init_NB(
uid_allocator_NB_t* const uid_pP
)
//------------------------------------------------------------------------------
{
memset(uid_pP, 0, sizeof(uid_allocator_NB_t));
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uid_t uid_t
uid_linear_allocator_new( uid_linear_allocator_new(
...@@ -166,7 +155,145 @@ rrc_eNB_get_ue_context( ...@@ -166,7 +155,145 @@ rrc_eNB_get_ue_context(
} }
//--(NB-IoT implementation)----------------------------------------------------- //------------------------------------------------------------------------------
void rrc_eNB_remove_ue_context(
const protocol_ctxt_t* const ctxt_pP,
eNB_RRC_INST* rrc_instance_pP,
struct rrc_eNB_ue_context_s* ue_context_pP)
//------------------------------------------------------------------------------
{
if (rrc_instance_pP == NULL) {
LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Bad RRC instance\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
return;
}
if (ue_context_pP == NULL) {
LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Trying to free a NULL UE context\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
return;
}
RB_REMOVE(rrc_ue_tree_s, &rrc_instance_pP->rrc_ue_head, ue_context_pP);
MSC_LOG_EVENT(
MSC_RRC_ENB,
"0 Removed UE %"PRIx16" ",
ue_context_pP->ue_context.rnti);
rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_pP);
uid_linear_allocator_free(rrc_instance_pP, ue_context_pP->local_uid);
free(ue_context_pP);
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" Removed UE context\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
}
//--------------------NB-IoT version----------------------------
//------------------------------------------------------------------------------
void
uid_linear_allocator_init_NB(
uid_allocator_NB_t* const uid_pP
)
//------------------------------------------------------------------------------
{
memset(uid_pP, 0, sizeof(uid_allocator_NB_t));
}
//------------------------------------------------------------------------------
uid_t
uid_linear_allocator_new_NB(
eNB_RRC_INST_NB* const rrc_instance_pP
)
//------------------------------------------------------------------------------
{
unsigned int i;
unsigned int bit_index = 1;
uid_t uid = 0;
uid_allocator_NB_t* uia_p = &rrc_instance_pP->uid_allocator;
for (i=0; i < UID_LINEAR_ALLOCATOR_BITMAP_SIZE; i++) {
if (uia_p->bitmap[i] != UINT_MAX) {
bit_index = 1;
uid = 0;
while ((uia_p->bitmap[i] & bit_index) == bit_index) {
bit_index = bit_index << 1;
uid += 1;
}
uia_p->bitmap[i] |= bit_index;
return uid + (i*sizeof(unsigned int)*8);
}
}
return UINT_MAX;
}
//------------------------------------------------------------------------------
void
uid_linear_allocator_free_NB(
eNB_RRC_INST_NB* rrc_instance_pP,
uid_t uidP
)
//------------------------------------------------------------------------------
{
unsigned int i = uidP/sizeof(unsigned int)/8;
unsigned int bit = uidP % (sizeof(unsigned int) * 8);
unsigned int value = ~(0x00000001 << bit);
if (i < UID_LINEAR_ALLOCATOR_BITMAP_SIZE) {
rrc_instance_pP->uid_allocator.bitmap[i] &= value;
}
}
int rrc_eNB_compare_ue_rnti_id_NB(
struct rrc_eNB_ue_context_NB_s* c1_pP, struct rrc_eNB_ue_context_NB_s* c2_pP)
//------------------------------------------------------------------------------
{
if (c1_pP->ue_id_rnti > c2_pP->ue_id_rnti) {
return 1;
}
if (c1_pP->ue_id_rnti < c2_pP->ue_id_rnti) {
return -1;
}
return 0;
}
/* Generate the tree management functions for NB-IoT structures */
RB_GENERATE(rrc_ue_tree_NB_s, rrc_eNB_ue_context_NB_s, entries,
rrc_eNB_compare_ue_rnti_id_NB);
//------------------------------------------------------------------------------
struct rrc_eNB_ue_context_NB_s*
rrc_eNB_allocate_new_UE_context_NB(
eNB_RRC_INST_NB* rrc_instance_pP
)
//------------------------------------------------------------------------------
{
struct rrc_eNB_ue_context_NB_s* new_p;
new_p = malloc(sizeof(struct rrc_eNB_ue_context_NB_s));
if (new_p == NULL) {
LOG_E(RRC, "Cannot allocate new ue context\n");
return NULL;
}
memset(new_p, 0, sizeof(struct rrc_eNB_ue_context_NB_s));
new_p->local_uid = uid_linear_allocator_new_NB(rrc_instance_pP);
return new_p;
}
struct rrc_eNB_ue_context_NB_s* struct rrc_eNB_ue_context_NB_s*
rrc_eNB_get_ue_context_NB( rrc_eNB_get_ue_context_NB(
eNB_RRC_INST_NB* rrc_instance_pP, eNB_RRC_INST_NB* rrc_instance_pP,
...@@ -177,15 +304,14 @@ rrc_eNB_get_ue_context_NB( ...@@ -177,15 +304,14 @@ rrc_eNB_get_ue_context_NB(
memset(&temp, 0, sizeof(struct rrc_eNB_ue_context_NB_s)); memset(&temp, 0, sizeof(struct rrc_eNB_ue_context_NB_s));
/* eNB ue rrc id = 24 bits wide */ /* eNB ue rrc id = 24 bits wide */
temp.ue_id_rnti = rntiP; temp.ue_id_rnti = rntiP;
return RB_FIND(rrc_ue_tree_s, &rrc_instance_pP->rrc_ue_head, &temp); return RB_FIND(rrc_ue_tree_NB_s, &rrc_instance_pP->rrc_ue_head, &temp);
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void rrc_eNB_remove_ue_context( void rrc_eNB_remove_ue_context_NB(
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
eNB_RRC_INST* rrc_instance_pP, eNB_RRC_INST_NB* rrc_instance_pP,
struct rrc_eNB_ue_context_s* ue_context_pP) struct rrc_eNB_ue_context_NB_s* ue_context_pP)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
if (rrc_instance_pP == NULL) { if (rrc_instance_pP == NULL) {
...@@ -200,15 +326,15 @@ void rrc_eNB_remove_ue_context( ...@@ -200,15 +326,15 @@ void rrc_eNB_remove_ue_context(
return; return;
} }
RB_REMOVE(rrc_ue_tree_s, &rrc_instance_pP->rrc_ue_head, ue_context_pP); RB_REMOVE(rrc_ue_tree_NB_s, &rrc_instance_pP->rrc_ue_head, ue_context_pP);
MSC_LOG_EVENT( MSC_LOG_EVENT(
MSC_RRC_ENB, MSC_RRC_ENB,
"0 Removed UE %"PRIx16" ", "0 Removed UE %"PRIx16" ",
ue_context_pP->ue_context.rnti); ue_context_pP->ue_context.rnti);
rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_pP); rrc_eNB_free_mem_UE_context_NB(ctxt_pP, ue_context_pP);
uid_linear_allocator_free(rrc_instance_pP, ue_context_pP->local_uid); uid_linear_allocator_free_NB(rrc_instance_pP, ue_context_pP->local_uid);
free(ue_context_pP); free(ue_context_pP);
LOG_I(RRC, LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" Removed UE context\n", PROTOCOL_RRC_CTXT_UE_FMT" Removed UE context\n",
...@@ -216,3 +342,9 @@ void rrc_eNB_remove_ue_context( ...@@ -216,3 +342,9 @@ void rrc_eNB_remove_ue_context(
} }
...@@ -39,6 +39,7 @@ uid_linear_allocator_init( ...@@ -39,6 +39,7 @@ uid_linear_allocator_init(
uid_allocator_t* const uid_pP uid_allocator_t* const uid_pP
); );
uid_t uid_t
uid_linear_allocator_new( uid_linear_allocator_new(
eNB_RRC_INST* rrc_instance_pP eNB_RRC_INST* rrc_instance_pP
...@@ -72,11 +73,6 @@ rrc_eNB_get_ue_context( ...@@ -72,11 +73,6 @@ rrc_eNB_get_ue_context(
rnti_t rntiP rnti_t rntiP
); );
//NB-IoT
struct rrc_eNB_ue_context_NB_s*
rrc_eNB_get_ue_context_NB(
eNB_RRC_INST_NB* rrc_instance_pP,
rnti_t rntiP);
void rrc_eNB_remove_ue_context( void rrc_eNB_remove_ue_context(
const protocol_ctxt_t* const ctxt_pP, const protocol_ctxt_t* const ctxt_pP,
...@@ -84,4 +80,46 @@ void rrc_eNB_remove_ue_context( ...@@ -84,4 +80,46 @@ void rrc_eNB_remove_ue_context(
struct rrc_eNB_ue_context_s* ue_context_pP struct rrc_eNB_ue_context_s* ue_context_pP
); );
//-----NB-IoT-----------------------
void
uid_linear_allocator_init_NB(
uid_allocator_NB_t* const uid_pP
);
uid_t
uid_linear_allocator_new_NB(
eNB_RRC_INST_NB* const rrc_instance_pP
);
void
uid_linear_allocator_free_NB(
eNB_RRC_INST_NB* rrc_instance_pP,
uid_t uidP
);
int rrc_eNB_compare_ue_rnti_id_NB(
struct rrc_eNB_ue_context_NB_s* c1_pP, struct rrc_eNB_ue_context_NB_s* c2_pP);
RB_PROTOTYPE(rrc_ue_tree_NB_s, rrc_eNB_ue_context_NB_s, entries, rrc_eNB_compare_ue_rnti_id_NB);
struct rrc_eNB_ue_context_NB_s*
rrc_eNB_allocate_new_UE_context_NB(
eNB_RRC_INST_NB* rrc_instance_pP
);
struct rrc_eNB_ue_context_NB_s*
rrc_eNB_get_ue_context_NB(
eNB_RRC_INST_NB* rrc_instance_pP,
rnti_t rntiP);
void rrc_eNB_remove_ue_context_NB(
const protocol_ctxt_t* const ctxt_pP,
eNB_RRC_INST_NB* rrc_instance_pP,
struct rrc_eNB_ue_context_NB_s* ue_context_pP);
#endif #endif
This diff is collapsed.
...@@ -99,12 +99,12 @@ LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DT ...@@ -99,12 +99,12 @@ LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DT
//MAC_AVG_T BCCH_MEAS_AVG, CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG; //MAC_AVG_T BCCH_MEAS_AVG, CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG;
// timers (TS 36.331 "UE-TimersAndConstants-NB" pag 622) (milliseconds) XXX MP:--> not sure they will be used // timers (TS 36.331 "UE-TimersAndConstants-NB" pag 622) (milliseconds) XXX MP:--> not sure they will be used
uint16_t T300[8] = {2500,4000,6000,10000, 15000,25000,40000,60000}; uint16_t T300_NB[8] = {2500,4000,6000,10000, 15000,25000,40000,60000};
uint16_t T301[8] = {2500,4000,6000,10000, 15000,25000,40000,60000}; //MP: this start at RRCconnectionReestablishmentReq (not implemented in OAI) uint16_t T301_NB[8] = {2500,4000,6000,10000, 15000,25000,40000,60000}; //MP: this start at RRCconnectionReestablishmentReq (not implemented in OAI)
uint16_t T310[8] = {0,200,500,1000,2000,4000,8000}; uint16_t T310_NB[8] = {0,200,500,1000,2000,4000,8000};
uint16_t T311[8] = {1000, 3000, 5000, 10000, 15000, 20000, 30000}; //MP: may not used uint16_t T311_NB[8] = {1000, 3000, 5000, 10000, 15000, 20000, 30000}; //MP: may not used
uint16_t N310[8] = {1,2,3,4,6,8,10,20}; uint16_t N310_NB[8] = {1,2,3,4,6,8,10,20};
uint16_t N311[8] = {1,2,3,4,5,6,8,10}; uint16_t N311_NB[8] = {1,2,3,4,5,6,8,10};
// MP: TimeToTrigger not used in NB-IoT // MP: TimeToTrigger not used in NB-IoT
......
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