Commit a228777c authored by Michele Paffetti's avatar Michele Paffetti

Adding new files 'L2_interface_nb_iot.c'(temporary collection of the major...

Adding new files 'L2_interface_nb_iot.c'(temporary collection of the major interfaces among layers),'proto_nb_iot.h',.. and modification of others. The code compile but not running test since still lower layers to be completed. Still to be reviewed the SRBs logic and activation
parent e6c25ec9
......@@ -308,6 +308,7 @@ if (NOT ${ret} STREQUAL 0)
endif (NOT ${ret} STREQUAL 0)
file(GLOB rrc_source ${RRC_FULL_DIR}/*.c)
set(rrc_source ${rrc_source} ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg.c)
set(rrc_source ${rrc_source} ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg_nb_iot.c)
file(GLOB rrc_h ${RRC_FULL_DIR}/*.h)
set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn1_constants.h)
set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code
......@@ -1112,12 +1113,16 @@ set(L2_SRC
${RLC_DIR}/rlc.c
${RLC_DIR}/rlc_rrc.c
${RLC_DIR}/rlc_mpls.c
${RRC_DIR}/vars_nb_iot.c
${RRC_DIR}/rrc_UE.c
${RRC_DIR}/rrc_eNB.c
${RRC_DIR}/rrc_eNB_nb_iot.c
${RRC_DIR}/rrc_eNB_S1AP.c
${RRC_DIR}/rrc_eNB_UE_context.c
${RRC_DIR}/rrc_common.c
${RRC_DIR}/rrc_common_nb_iot.c
${RRC_DIR}/L2_interface.c
${RRC_DIR}/L2_interface_nb_iot.c
)
set (MAC_SRC
${MAC_DIR}/lte_transport_init.c
......
......@@ -83,8 +83,11 @@
#define MAX_MANAGED_ENB_PER_MOBILE 2
#define DEFAULT_RAB_ID 1
///NB-IOT
#define NB_RB_MAX_NB_IOT (maxDRB_NB_r13 + 3) //MP: NB_IoT --> 2+3 = 5
#define DEFAULT_RAB_ID 1
#define NB_RB_MAX (maxDRB + 3) /* was 11, now 14, maxDRB comes from asn1_constants.h, + 3 because of 3 SRB, one invisible id 0, then id 1 and 2 */
#if defined(Rel10) || defined(Rel14)
#define NB_RB_MBMS_MAX (maxSessionPerPMCH*maxServiceCount)
......
......@@ -87,6 +87,12 @@ typedef boolean_t srb_flag_t;
#define SRB_FLAG_NO FALSE
#define SRB_FLAG_YES TRUE
///NB-IoT
typedef boolean_t srb1bis_flag_t;
#define SRB1BIS_FLAG_NO FALSE
#define SRB1BIS_FLAG_YES TRUE
typedef enum link_direction_e {
UNKNOWN_DIR = 0,
DIR_UPLINK = 1,
......
......@@ -83,8 +83,9 @@ typedef struct RrcStateInd_s {
Rrc_Sub_State_t sub_state;
} RrcStateInd;
// eNB: ENB_APP -> RRC messages
// eNB: ENB_APP -> RRC messages---------------------------------------------------
//these parameters are set by the configuration files?
typedef struct RrcConfigurationReq_s {
uint32_t cell_identity;
......@@ -104,8 +105,8 @@ typedef struct RrcConfigurationReq_s {
*/
int16_t nb_cc;
lte_frame_type_t frame_type[MAX_NUM_CCs];
uint8_t tdd_config[MAX_NUM_CCs]; //not present in NB-IoT
uint8_t tdd_config_s[MAX_NUM_CCs]; //not present in NB-IoT
uint8_t tdd_config[MAX_NUM_CCs];
uint8_t tdd_config_s[MAX_NUM_CCs];
lte_prefix_type_t prefix_type[MAX_NUM_CCs];
int16_t eutra_band[MAX_NUM_CCs];
uint32_t downlink_frequency[MAX_NUM_CCs];
......@@ -113,17 +114,18 @@ typedef struct RrcConfigurationReq_s {
int16_t Nid_cell[MAX_NUM_CCs];// for testing, change later
int16_t N_RB_DL[MAX_NUM_CCs];// for testing, change later
int nb_antennas_tx[MAX_NUM_CCs];
int nb_antennas_rx[MAX_NUM_CCs];
int nb_antennas_tx[MAX_NUM_CCs]; //MP: may no more used
int nb_antennas_rx[MAX_NUM_CCs]; //MP: may no more used
int nb_antenna_ports[MAX_NUM_CCs];
//PRACH
long prach_root[MAX_NUM_CCs];
long prach_config_index[MAX_NUM_CCs];
BOOLEAN_t prach_high_speed[MAX_NUM_CCs];
long prach_zero_correlation[MAX_NUM_CCs];
long prach_freq_offset[MAX_NUM_CCs];
//NPRACH for NB-IoT---
//...completely different parameter and structure for NPRACH
//-----------
//PUCCH
long pucch_delta_shift[MAX_NUM_CCs];
long pucch_nRB_CQI[MAX_NUM_CCs];
......@@ -165,17 +167,17 @@ typedef struct RrcConfigurationReq_s {
e_DeltaFList_PUCCH__deltaF_PUCCH_Format2a pucch_deltaF_Format2a[MAX_NUM_CCs];
e_DeltaFList_PUCCH__deltaF_PUCCH_Format2b pucch_deltaF_Format2b[MAX_NUM_CCs];
long rach_numberOfRA_Preambles[MAX_NUM_CCs];// not present in NB-IoT SIB2
BOOLEAN_t rach_preamblesGroupAConfig[MAX_NUM_CCs]; // not present in NB-IoT SIB2
long rach_sizeOfRA_PreamblesGroupA[MAX_NUM_CCs];// not presen in NB-IoT SIB2
long rach_messageSizeGroupA[MAX_NUM_CCs]; // not presen in NB-IoT SIB2
long rach_numberOfRA_Preambles[MAX_NUM_CCs];
BOOLEAN_t rach_preamblesGroupAConfig[MAX_NUM_CCs];
long rach_sizeOfRA_PreamblesGroupA[MAX_NUM_CCs];
long rach_messageSizeGroupA[MAX_NUM_CCs];
e_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB rach_messagePowerOffsetGroupB[MAX_NUM_CCs];// not presen in NB-IoT SIB2
long rach_powerRampingStep[MAX_NUM_CCs];
long rach_preambleInitialReceivedTargetPower[MAX_NUM_CCs];
long rach_preambleTransMax[MAX_NUM_CCs]; // not present in NB-IoT SIB2
long rach_raResponseWindowSize[MAX_NUM_CCs]; // not present in NB-IoT SIB2
long rach_macContentionResolutionTimer[MAX_NUM_CCs]; // not present in NB-IoT SIB2
long rach_maxHARQ_Msg3Tx[MAX_NUM_CCs];// not present in NB-IoT SIB2
long rach_preambleTransMax[MAX_NUM_CCs];
long rach_raResponseWindowSize[MAX_NUM_CCs];
long rach_macContentionResolutionTimer[MAX_NUM_CCs];
long rach_maxHARQ_Msg3Tx[MAX_NUM_CCs];
//BCCH
long bcch_modificationPeriodCoeff[MAX_NUM_CCs];
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file LAYER2/MAC/defs.h
* \brief MAC data structures, constant, and function prototype
* \author Navid Nikaein and Raymond Knopp
* \date 2011
* \version 0.5
* \email navid.nikaein@eurecom.fr
*/
/** @defgroup _oai2 openair2 Reference Implementation
* @ingroup _ref_implementation_
* @{
*/
/*@}*/
#ifndef __LAYER2_MAC_DEFS_NB_IOT_H__
#define __LAYER2_MAC_DEFS_NB_IOT_H__
#ifdef USER_MODE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#endif
//#include "COMMON/openair_defs.h"
#include "COMMON/platform_constants.h"
#include "COMMON/mac_rrc_primitives.h"
#include "PHY/defs.h"
#include "RadioResourceConfigCommonSIB-NB-r13.h"
#include "RadioResourceConfigDedicated-NB-r13.h"
#include "RACH-ConfigCommon-NB-r13.h"
#include "MasterInformationBlock-NB.h"
#include "BCCH-BCH-Message-NB.h"
//#ifdef PHY_EMUL
//#include "SIMULATION/PHY_EMULATION/impl_defs.h"
//#endif
/** @defgroup _mac MAC
* @ingroup _oai2
* @{
*/
/*! \brief Downlink SCH PDU Structure */
typedef struct {
int8_t payload[8][SCH_PAYLOAD_SIZE_MAX];
uint16_t Pdu_size[8];
} __attribute__ ((__packed__)) DLSCH_PDU_NB;
/*! \brief eNB template for UE context information */
typedef struct {
/// C-RNTI of UE
rnti_t rnti;
/// NDI from last scheduling
uint8_t oldNDI[8];
/// NDI from last UL scheduling
uint8_t oldNDI_UL[8];
/// Flag to indicate UL has been scheduled at least once
boolean_t ul_active;
/// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received)
boolean_t configured;
/// MCS from last scheduling
//Modify uint8_t mcs[8];
/// TPC from last scheduling
//Delete uint8_t oldTPC[8];
// PHY interface info
/// DCI format for DLSCH
uint16_t DLSCH_dci_fmt;
/// Current Aggregation Level for DCI
uint8_t DCI_aggregation_min;
/// size of DLSCH size in bit
uint8_t DLSCH_dci_size_bits;
/// DCI buffer for DLSCH
/* rounded to 32 bits unit (actual value should be 8 due to the logic
* of the function generate_dci0) */
//Modifyuint8_t DLSCH_DCI[8][(((MAX_DCI_SIZE_BITS)+31)>>5)*4];
/// Number of Allocated RBs for DL after scheduling (prior to frequency allocation)
//Delete uint16_t nb_rb[8]; // num_max_harq
/// Number of Allocated RBs for UL after scheduling (prior to frequency allocation)
//Delete uint16_t nb_rb_ul[8]; // num_max_harq
/// Number of Allocated RBs by the ulsch preprocessor
//Delete uint8_t pre_allocated_nb_rb_ul;
/// index of Allocated RBs by the ulsch preprocessor
//Delete int8_t pre_allocated_rb_table_index_ul;
/// total allocated RBs
//Delete int8_t total_allocated_rbs;
/// pre-assigned MCS by the ulsch preprocessor
uint8_t pre_assigned_mcs_ul;
/// assigned MCS by the ulsch scheduler
uint8_t assigned_mcs_ul;
/// DCI buffer for ULSCH
/* rounded to 32 bits unit (actual value should be 8 due to the logic
* of the function generate_dci0) */
//Modify uint8_t ULSCH_DCI[8][(((MAX_DCI_SIZE_BITS)+31)>>5)*4];
/// DL DAI
//Delete uint8_t DAI;
/// UL DAI
//Delete uint8_t DAI_ul[10];
/// UL Scheduling Request Received
//Delete uint8_t ul_SR;
/// Resource Block indication for each sub-band in MU-MIMO
//Delete uint8_t rballoc_subband[8][50];
// Logical channel info for link with RLC
/// Last received UE BSR info for each logical channel group id
uint8_t bsr_info[MAX_NUM_LCGID];
/// LCGID mapping
//Delete long lcgidmap[11];
/// phr information, received from DPR MAC control element
int8_t phr_info_DPR;
/// phr information, received from DPR MAC control element
int8_t phr_info_configured_DPR;
///dl buffer info
uint32_t dl_buffer_info[MAX_NUM_LCID];
/// total downlink buffer info
uint32_t dl_buffer_total;
/// total downlink pdus
uint32_t dl_pdus_total;
/// downlink pdus for each LCID
uint32_t dl_pdus_in_buffer[MAX_NUM_LCID];
/// creation time of the downlink buffer head for each LCID
uint32_t dl_buffer_head_sdu_creation_time[MAX_NUM_LCID];
/// maximum creation time of the downlink buffer head across all LCID
uint32_t dl_buffer_head_sdu_creation_time_max;
/// a flag indicating that the downlink head SDU is segmented
uint8_t dl_buffer_head_sdu_is_segmented[MAX_NUM_LCID];
/// size of remaining size to send for the downlink head SDU
uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID];
/// total uplink buffer size
uint32_t ul_total_buffer;
/// uplink buffer creation time for each LCID
uint32_t ul_buffer_creation_time[MAX_NUM_LCGID];
/// maximum uplink buffer creation time across all the LCIDs
uint32_t ul_buffer_creation_time_max;
/// uplink buffer size per LCID
uint32_t ul_buffer_info[MAX_NUM_LCGID];
/// UE tx power
int32_t ue_tx_power;
/// stores the frame where the last TPC was transmitted
//Delete uint32_t pusch_tpc_tx_frame;
//Delete uint32_t pusch_tpc_tx_subframe;
//Delete uint32_t pucch_tpc_tx_frame;
//Delete uint32_t pucch_tpc_tx_subframe;
//Delete eNB_UE_estimated_distances distance;
} UE_TEMPLATE_NB;
/*! \brief eNB statistics for the connected UEs*/
typedef struct {
/// CRNTI of UE
rnti_t crnti; ///user id (rnti) of connected UEs
// rrc status
uint8_t rrc_status;
/// harq pid
uint8_t harq_pid;
/// harq rounf
uint8_t harq_round;
/// DL Wideband CQI index (2 TBs)
uint8_t dl_cqi;
/// total available number of PRBs for a new transmission
uint16_t rbs_used;
/// total available number of PRBs for a retransmission
uint16_t rbs_used_retx;
/// total nccc used for a new transmission: num control channel element
uint16_t ncce_used;
/// total avilable nccc for a retransmission: num control channel element
uint16_t ncce_used_retx;
// mcs1 before the rate adaptaion
uint8_t dlsch_mcs1;
/// Target mcs2 after rate-adaptation
uint8_t dlsch_mcs2;
// current TBS with mcs2
uint32_t TBS;
// total TBS with mcs2
// uint32_t total_TBS;
// total rb used for a new transmission
uint32_t total_rbs_used;
// total rb used for retransmission
uint32_t total_rbs_used_retx;
/// TX
/// Num pkt
uint32_t num_pdu_tx[NB_RB_MAX];
/// num bytes
uint32_t num_bytes_tx[NB_RB_MAX];
/// num retransmission / harq
uint32_t num_retransmission;
/// instantaneous tx throughput for each TTI
// uint32_t tti_throughput[NB_RB_MAX];
/// overall
//
uint32_t dlsch_bitrate;
//total
uint32_t total_dlsch_bitrate;
/// headers+ CE + padding bytes for a MAC PDU
uint64_t overhead_bytes;
/// headers+ CE + padding bytes for a MAC PDU
uint64_t total_overhead_bytes;
/// headers+ CE + padding bytes for a MAC PDU
uint64_t avg_overhead_bytes;
// MAC multiplexed payload
uint64_t total_sdu_bytes;
// total MAC pdu bytes
uint64_t total_pdu_bytes;
// total num pdu
uint32_t total_num_pdus;
//
// uint32_t avg_pdu_size;
/// RX
/// preassigned mcs after rate adaptation
uint8_t ulsch_mcs1;
/// adjusted mcs
uint8_t ulsch_mcs2;
/// estimated average pdu inter-departure time
uint32_t avg_pdu_idt;
/// estimated average pdu size
uint32_t avg_pdu_ps;
///
uint32_t aggregated_pdu_size;
uint32_t aggregated_pdu_arrival;
/// uplink transport block size
uint32_t ulsch_TBS;
/// total rb used for a new uplink transmission
uint32_t num_retransmission_rx;
/// total rb used for a new uplink transmission
uint32_t rbs_used_rx;
/// total rb used for a new uplink retransmission
uint32_t rbs_used_retx_rx;
/// total rb used for a new uplink transmission
uint32_t total_rbs_used_rx;
/// normalized rx power
int32_t normalized_rx_power;
/// target rx power
int32_t target_rx_power;
/// num rx pdu
uint32_t num_pdu_rx[NB_RB_MAX];
/// num bytes rx
uint32_t num_bytes_rx[NB_RB_MAX];
/// instantaneous rx throughput for each TTI
// uint32_t tti_goodput[NB_RB_MAX];
/// errors
uint32_t num_errors_rx;
uint64_t overhead_bytes_rx;
/// headers+ CE + padding bytes for a MAC PDU
uint64_t total_overhead_bytes_rx;
/// headers+ CE + padding bytes for a MAC PDU
uint64_t avg_overhead_bytes_rx;
//
uint32_t ulsch_bitrate;
//total
uint32_t total_ulsch_bitrate;
/// overall
/// MAC pdu bytes
uint64_t pdu_bytes_rx;
/// total MAC pdu bytes
uint64_t total_pdu_bytes_rx;
/// total num pdu
uint32_t total_num_pdus_rx;
/// num of error pdus
uint32_t total_num_errors_rx;
} eNB_UE_STATS_NB;
/*! \brief scheduling control information set through an API (not used)*/
typedef struct {
///UL transmission bandwidth in RBs
uint8_t ul_bandwidth[MAX_NUM_LCID];
///DL transmission bandwidth in RBs
uint8_t dl_bandwidth[MAX_NUM_LCID];
//To do GBR bearer
uint8_t min_ul_bandwidth[MAX_NUM_LCID];
uint8_t min_dl_bandwidth[MAX_NUM_LCID];
///aggregated bit rate of non-gbr bearer per UE
uint64_t ue_AggregatedMaximumBitrateDL;
///aggregated bit rate of non-gbr bearer per UE
uint64_t ue_AggregatedMaximumBitrateUL;
///CQI scheduling interval in subframes.
//Delete uint16_t cqiSchedInterval;
///Contention resolution timer used during random access
uint8_t mac_ContentionResolutionTimer;
//Delete uint16_t max_allowed_rbs[MAX_NUM_LCID];
uint8_t max_mcs[MAX_NUM_LCID];
uint16_t priority[MAX_NUM_LCID];
// resource scheduling information
uint8_t harq_pid[MAX_NUM_CCs];
uint8_t round[MAX_NUM_CCs];
uint8_t dl_pow_off[MAX_NUM_CCs];
//Delete uint16_t pre_nb_available_rbs[MAX_NUM_CCs];
//Delete unsigned char rballoc_sub_UE[MAX_NUM_CCs][N_RBG_MAX];
uint16_t ta_timer;
int16_t ta_update;
int32_t context_active_timer;
//Delete int32_t cqi_req_timer;
int32_t ul_inactivity_timer;
int32_t ul_failure_timer;
int32_t ul_scheduled;
int32_t ra_pdcch_order_sent;
int32_t ul_out_of_sync;
int32_t phr_received;// received from Msg3 MAC Control Element
} UE_sched_ctrl_NB;
/*! \brief UE list used by eNB to order UEs/CC for scheduling*/
typedef struct {
/// DLSCH pdu
DLSCH_PDU_NB DLSCH_pdu[MAX_NUM_CCs][2][NUMBER_OF_UE_MAX];
/// DCI template and MAC connection parameters for UEs
UE_TEMPLATE_NB UE_template[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
/// DCI template and MAC connection for RA processes
int pCC_id[NUMBER_OF_UE_MAX];
/// Delete sorted downlink component carrier for the scheduler
/// Delete number of downlink active component carrier
/// Delete sorted uplink component carrier for the scheduler
/// Delete number of uplink active component carrier
/// Delete number of downlink active component carrier
/// eNB to UE statistics
eNB_UE_STATS_NB eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
/// scheduling control info
UE_sched_ctrl_NB UE_sched_ctrl[NUMBER_OF_UE_MAX];
int next[NUMBER_OF_UE_MAX];
int head;
int next_ul[NUMBER_OF_UE_MAX];
int head_ul;
int avail;
int num_UEs;
boolean_t active[NUMBER_OF_UE_MAX];
} UE_list_NB_t;
/*!\brief Values of BCCH0 logical channel for MIB*/
#define BCCH0 11 // MIB-NB
/*!\brief Values of BCCH1 logical channel for SIBs */
#define BCCH1 12 // SI-SIB-NBs
/*!\brief Values of PCCH logical channel */
//#define PCCH 13 // Paging XXX not used for the moment
/*!\brief Value of CCCH / SRB0 logical channel */
//#define CCCH 0 // srb0 ---> XXX exactly the same as in LTE (commented for compilation purposes)
/*!\brief DCCH0 / SRB1bis logical channel */
#define DCCH0 3 // srb1bis
/*!\brief DCCH1 / SRB1 logical channel */
//#define DCCH1 1 // srb1 //XXX we redefine it for the SRB1
/*!\brief DTCH0 DRB0 logical channel */
#define DTCH0 4 // DRB0
/*!\brief DTCH1 DRB1 logical channel */
#define DTCH1 5 // DRB1
// DLSCH LCHAN ID all the same as NB-IoT
/*!\brief DCI PDU filled by MAC for the PHY */
typedef struct {
uint8_t Num_ue_spec_dci ;
uint8_t Num_common_dci ;
// uint32_t nCCE;
uint32_t num_pdcch_symbols;
DCI_ALLOC_t dci_alloc[NUM_DCI_MAX] ;
} DCI_PDU_NB;
typedef struct {
uint8_t payload[BCCH_PAYLOAD_SIZE_MAX] ;
} __attribute__((__packed__))BCCH_PDU_NB;
/*! \brief CCCH payload */
typedef struct {
uint8_t payload[CCCH_PAYLOAD_SIZE_MAX] ;
} __attribute__((__packed__))CCCH_PDU_NB;
/*! \brief eNB template for the Random access information */
typedef struct {
/// Flag to indicate this process is active
boolean_t RA_active;
/// Size of DCI for RA-Response (bytes)
uint8_t RA_dci_size_bytes1;
/// Size of DCI for RA-Response (bits)
uint8_t RA_dci_size_bits1;
/// Actual DCI to transmit for RA-Response
uint8_t RA_alloc_pdu1[(MAX_DCI_SIZE_BITS>>3)+1];
/// DCI format for RA-Response (should be 1A)
uint8_t RA_dci_fmt1;
/// Size of DCI for Msg4/ContRes (bytes)
uint8_t RA_dci_size_bytes2;
/// Size of DCI for Msg4/ContRes (bits)
uint8_t RA_dci_size_bits2;
/// Actual DCI to transmit for Msg4/ContRes
uint8_t RA_alloc_pdu2[(MAX_DCI_SIZE_BITS>>3)+1];
/// DCI format for Msg4/ContRes (should be 1A)
uint8_t RA_dci_fmt2;
/// Flag to indicate the eNB should generate RAR. This is triggered by detection of PRACH
uint8_t generate_rar;
/// Subframe where preamble was received, Delete?
uint8_t preamble_subframe;
/// Subframe where Msg3 is to be sent
uint8_t Msg3_subframe;
/// Flag to indicate the eNB should generate Msg4 upon reception of SDU from RRC. This is triggered by first ULSCH reception at eNB for new user.
uint8_t generate_Msg4;
/// Flag to indicate that eNB is waiting for ACK that UE has received Msg3.
uint8_t wait_ack_Msg4;
/// UE RNTI allocated during RAR
rnti_t rnti;
/// RA RNTI allocated from received PRACH
uint16_t RA_rnti;
/// Delete Received preamble_index, use subcarrier index?
/// Received UE Contention Resolution Identifier
uint8_t cont_res_id[6];
/// Timing offset indicated by PHY
int16_t timing_offset;
/// Timeout for RRC connection
int16_t RRC_timer;
} RA_TEMPLATE_NB;
/*! \brief eNB common channels */
typedef struct {
int physCellId;
int p_eNB;
int Ncp;
int eutra_band;
uint32_t dl_CarrierFreq;
BCCH_BCH_Message_NB_t *mib_NB;
RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon;
ARFCN_ValueEUTRA_r9_t ul_CarrierFreq;
struct MasterInformationBlock_NB__operationModeInfo_r13 operationModeInfo;
/// Outgoing DCI for PHY generated by eNB scheduler
DCI_PDU_NB DCI_pdu;
/// Outgoing BCCH pdu for PHY
BCCH_PDU_NB BCCH_pdu;
/// Outgoing BCCH DCI allocation
uint32_t BCCH_alloc_pdu;
/// Outgoing CCCH pdu for PHY
CCCH_PDU_NB CCCH_pdu;
RA_TEMPLATE_NB RA_template[NB_RA_PROC_MAX];
/// Delete VRB map for common channels
/// Delete MBSFN SubframeConfig
/// Delete number of subframe allocation pattern available for MBSFN sync area
// #if defined(Rel10) || defined(Rel14)
/// Delete MBMS Flag
/// Delete Outgoing MCCH pdu for PHY
/// Delete MCCH active flag
/// Delete MCCH active flag
/// Delete MTCH active flag
/// Delete number of active MBSFN area
/// Delete MBSFN Area Info
/// Delete PMCH Config
/// Delete MBMS session info list
/// Delete Outgoing MCH pdu for PHY
// #endif
// #ifdef CBA
/// Delete number of CBA groups
/// Delete RNTI for each CBA group
/// Delete MCS for each CBA group
// #endif
}COMMON_channels_NB_t;
/*! \brief eNB overall statistics */
typedef struct {
/// num BCCH PDU per CC
uint32_t total_num_bcch_pdu;
/// BCCH buffer size
uint32_t bcch_buffer;
/// total BCCH buffer size
uint32_t total_bcch_buffer;
/// BCCH MCS
uint32_t bcch_mcs;
/// num CCCH PDU per CC
uint32_t total_num_ccch_pdu;
/// BCCH buffer size
uint32_t ccch_buffer;
/// total BCCH buffer size
uint32_t total_ccch_buffertotal_ccch_buffer;
/// BCCH MCS
uint32_t ccch_mcs;
/// num active users
uint16_t num_dlactive_UEs;
/// available number of PRBs for a give SF fixed in 1 in NB-IoT
uint16_t available_prbs;
/// total number of PRB available for the user plane fixed in 1 in NB-IoT
uint32_t total_available_prbs;
/// aggregation
/// total avilable nccc : num control channel element
uint16_t available_ncces;
// only for a new transmission, should be extended for retransmission
// current dlsch bit rate for all transport channels
uint32_t dlsch_bitrate;
//
uint32_t dlsch_bytes_tx;
//
uint32_t dlsch_pdus_tx;
//
uint32_t total_dlsch_bitrate;
//
uint32_t total_dlsch_bytes_tx;
//
uint32_t total_dlsch_pdus_tx;
// here for RX
//
uint32_t ulsch_bitrate;
//
uint32_t ulsch_bytes_rx;
//
uint64_t ulsch_pdus_rx;
uint32_t total_ulsch_bitrate;
//
uint32_t total_ulsch_bytes_rx;
//
uint32_t total_ulsch_pdus_rx;
/// MAC agent-related stats
/// total number of scheduling decisions
int sched_decisions;
/// missed deadlines
int missed_deadlines;
} eNB_STATS_NB;
/*! \brief top level eNB MAC structure */
typedef struct {
///
uint16_t Node_id;
/// frame counter
frame_t frame;
/// subframe counter
sub_frame_t subframe;
/// Common cell resources
COMMON_channels_NB_t common_channels[MAX_NUM_CCs];
UE_list_NB_t UE_list;
///Delete subband bitmap configuration, no related CQI report
// / Modify CCE table used to build DCI scheduling information
int CCE_table[MAX_NUM_CCs][12];//180 khz for Anchor carrier
/// active flag for Other lcid
uint8_t lcid_active[NB_RB_MAX];
/// eNB stats
eNB_STATS_NB eNB_stats[MAX_NUM_CCs];
// MAC function execution peformance profiler
/// processing time of eNB scheduler
time_stats_t eNB_scheduler;
/// processing time of eNB scheduler for SI
time_stats_t schedule_si;
/// processing time of eNB scheduler for Random access
time_stats_t schedule_ra;
/// processing time of eNB ULSCH scheduler
time_stats_t schedule_ulsch;
/// processing time of eNB DCI generation
time_stats_t fill_DLSCH_dci;
/// processing time of eNB MAC preprocessor
time_stats_t schedule_dlsch_preprocessor;
/// processing time of eNB DLSCH scheduler
time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor
/// Delete processing time of eNB MCH scheduler
/// processing time of eNB ULSCH reception
time_stats_t rx_ulsch_sdu; // include rlc_data_ind
} eNB_MAC_INST_NB;
#endif /*__LAYER2_MAC_DEFS_NB_IoT_H__ */
......@@ -38,6 +38,7 @@
#endif //USER_MODE
#include "PHY/defs.h"
#include "defs.h"
#include "defs_nb_iot.h"
#include "COMMON/mac_rrc_primitives.h"
#ifdef PHY_EMUL
//#include "SIMULATION/simulation_defs.h"
......@@ -64,6 +65,9 @@ extern UE_MAC_INST *ue_mac_inst;
extern MAC_RLC_XFACE *Mac_rlc_xface;
extern uint8_t Is_rrc_registered;
//NB-IoT
extern eNB_MAC_INST_NB *eNB_mac_inst_NB;
extern eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8
extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8
......
......@@ -37,6 +37,7 @@
#endif //USER_MODE
#include "PHY/defs.h"
#include "defs.h"
#include "defs_nb_iot.h"
#include "PHY_INTERFACE/defs.h"
#include "COMMON/mac_rrc_primitives.h"
......@@ -98,6 +99,8 @@ MAC_RLC_XFACE *Mac_rlc_xface;
/// Primary component carrier index of eNB
int pCC_id[NUMBER_OF_eNB_MAX];
//NB-IoT
eNB_MAC_INST_NB *eNB_mac_inst_NB;
eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8
......
......@@ -134,6 +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 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. */
uint16_t enableStatusReportSN_Gap;
//---------------------------------------------------------------------
// STATISTICS
......
......@@ -70,6 +70,12 @@ typedef volatile struct {
uint32_t t_status_prohibit; /*!< \brief t-StatusProhibit timer initial value. */
} rlc_am_info_t;
typedef volatile struct {
uint16_t max_retx_threshold;
uint32_t t_poll_retransmit;
uint32_t enableStatusReportSN_Gap;
}rlc_am_info_NB_t;
//-----------------------------------------------------------------------------
/*! \fn void rlc_am_init (const protocol_ctxt_t* const ctxtP, rlc_am_entity_t * const rlc_pP)
* \brief Initialize the RLC AM protocol instance, reset variables, allocate buffers, lists, then, the next step in order have a running RLC AM instance is to configure and set debug informations for this RLC instance.
......
......@@ -137,6 +137,7 @@ typedef volatile struct {
rlc_mode_t rlc_mode;
union {
rlc_am_info_t rlc_am_info; /*!< \sa rlc_am.h. */
rlc_am_info_NB_t rlc_am_info_NB;
rlc_tm_info_t rlc_tm_info; /*!< \sa rlc_tm.h. */
rlc_um_info_t rlc_um_info; /*!< \sa rlc_um.h. */
} rlc;
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -206,18 +206,17 @@ uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId)
return 0xFF; //error!
}
/*do_MIB_NB*/
/*do_MIB_NB*/ //FIXME: to decide lots of things
uint8_t do_MIB_NB(
rrc_eNB_carrier_data_NB_t *carrier,
uint32_t N_RB_DL,//may not needed
uint16_t N_RB_DL,//may not needed--> for NB_IoT only 1 PRB is used
uint32_t frame)
{
asn_enc_rval_t enc_rval;
BCCH_BCH_Message_NB_t *mib_NB = &(carrier->mib_NB); //punta all'indirizzo di mib_NB
BCCH_BCH_Message_NB_t *mib_NB = &(carrier->mib_NB);
//should be passed as a parameter? (how decide which value is included in carrier?
uint8_t sfn_MSB = (uint8_t)((frame>>2)&0xff); //????? //4 bits
uint8_t hsfn_LSB = (uint8_t)((frame>>2)&0xff); //?? //2 bits
uint8_t sfn_MSB = (uint8_t)((frame>>2)&0xff); //4 bits FIXME
uint8_t hsfn_LSB = (uint8_t)((frame>>2)&0xff); //2 bits
uint16_t spare=0; //11 bits --> use uint16
//no DL_Bandwidth, no PCHIC
......@@ -251,7 +250,7 @@ uint8_t do_MIB_NB(
//only changes in "asn_DEF_BCCH_BCH_Message_NB"
enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message_NB,
(void*)mib_NB,
carrier->MIB_NB, //non credo ci vada &(carrier->MIB_NB)
carrier->MIB_NB,
100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
......@@ -333,7 +332,7 @@ uint8_t do_SIB1_NB(uint8_t Mod_id, int CC_id,
PLMN_identity_info_NB.plmn_Identity_r13.mnc.list.size=0;
PLMN_identity_info_NB.plmn_Identity_r13.mnc.list.count=0;
//left as it is
//FIXME
#if defined(ENABLE_ITTI)
if (configuration->mnc >= 100) {
......@@ -408,7 +407,6 @@ uint8_t do_SIB1_NB(uint8_t Mod_id, int CC_id,
//Still Set to "notAllowed" like in the previous case
sib1_NB->cellAccessRelatedInfo_r13.intraFreqReselection_r13=SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__intraFreqReselection_r13_notAllowed;
//ClosedSubscriberGroup(CSG) is not supported by NB-IoT
sib1_NB->cellSelectionInfo_r13.q_RxLevMin_r13=-65; //which value?? TS 36.331 V14.2.1 pag. 589
sib1_NB->cellSelectionInfo_r13.q_QualMin_r13 = 0; // FIXME new parameter for SIB1-NB, not present in SIB1
......@@ -416,6 +414,7 @@ uint8_t do_SIB1_NB(uint8_t Mod_id, int CC_id,
sib1_NB->p_Max_r13 = CALLOC(1, sizeof(P_Max_t));
*(sib1_NB->p_Max_r13) = 23;
//FIXME
sib1_NB->freqBandIndicator_r13 =
#if defined(ENABLE_ITTI)
configuration->eutra_band[CC_id];
......@@ -432,12 +431,11 @@ uint8_t do_SIB1_NB(uint8_t Mod_id, int CC_id,
* sib1_NB->downlinkBitmap_r13.choice.subframePattern10_r13 =(is a BIT_STRING)
*/
//FIXME: correct memory allocation?
sib1_NB->downlinkBitmap_r13 = CALLOC(1, sizeof(struct DL_Bitmap_NB_r13));
(sib1_NB->downlinkBitmap_r13)->present= DL_Bitmap_NB_r13_PR_subframePattern10_r13;
(sib1_NB->downlinkBitmap_r13)->present= DL_Bitmap_NB_r13_PR_NOTHING;
*eutraControlRegionSize = 0;
sib1_NB->eutraControlRegionSize_r13 = eutraControlRegionSize; //ok
sib1_NB->eutraControlRegionSize_r13 = eutraControlRegionSize;
*nrs_CRS_PowerOffset= 0;
......@@ -454,7 +452,6 @@ uint8_t do_SIB1_NB(uint8_t Mod_id, int CC_id,
* in the first SystemInformation message
* listed in the schedulingInfoList list.
* */
//gli stiamo dicendo che ci sar solo un SIB3 oltre che al due
sib_type_NB=SIB_Type_NB_r13_sibType3_NB_r13;
ASN_SEQUENCE_ADD(&schedulingInfo_NB.sib_MappingInfo_r13.list,&sib_type_NB);
......@@ -470,7 +467,7 @@ uint8_t do_SIB1_NB(uint8_t Mod_id, int CC_id,
exit(-1);
}
//FIXME which value chose for the following parameter?
//FIXME which value chose for the following parameter
sib1_NB->si_WindowLength_r13=SystemInformationBlockType1_NB__si_WindowLength_r13_ms160;
sib1_NB->si_RadioFrameOffset_r13= 0;
......@@ -478,11 +475,12 @@ uint8_t do_SIB1_NB(uint8_t Mod_id, int CC_id,
* systemInfoValueTagSI (there is no SystemInfoValueTag in SIB1-NB but only in MIB-NB)
*contained in systemInfoValueTagList_r13
**/
asn_set_empty(&sib1_NB->systemInfoValueTagList_r13->list); //FIXME good inizialization?
//FIXME correct?
sib1_NB->systemInfoValueTagList_r13 = CALLOC(1, sizeof(struct SystemInfoValueTagList_NB_r13));
asn_set_empty(&sib1_NB->systemInfoValueTagList_r13->list);
ASN_SEQUENCE_ADD(&sib1_NB->systemInfoValueTagList_r13->list,&systemInfoValueTagSI);
//only change "asn_DEF_BCCH_DL_SCH_Message" in "asn_DEF_BCCH_DL_SCH_Message_NB"
#ifdef XER_PRINT //generate xml files
xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message);
#endif
......@@ -545,7 +543,7 @@ uint8_t do_SIB23_NB(uint8_t Mod_id,
exit(-1);
}
//signifa che prima deve essere stata allocata memoria per forza
//before schould be allocated memory somewhere?
if (!carrier->sib2_NB) {
LOG_E(RRC,"[eNB %d] sib2_NB is null, exiting\n", Mod_id);
exit(-1);
......@@ -567,7 +565,7 @@ uint8_t do_SIB23_NB(uint8_t Mod_id,
sib2_NB_part->present = SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib2_r13;
sib3_NB_part->present = SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib3_r13;
//attenzione potrebbe esserci un bug qui--> ricontrollare
//FIXME: may a bug?
carrier->sib2_NB = &sib2_NB_part->choice.sib2_r13;
carrier->sib3_NB = &sib3_NB_part->choice.sib3_r13;
sib2_NB = carrier->sib2_NB;
......@@ -685,9 +683,9 @@ uint8_t do_SIB23_NB(uint8_t Mod_id,
sib2_NB->ue_TimersAndConstants_r13.n310_r13 = configuration-> ue_TimersAndConstants_n310_NB[CC_id];
sib2_NB->ue_TimersAndConstants_r13.n311_r13 = configuration-> ue_TimersAndConstants_n311_NB[CC_id];
/* static assignment will be not used
/*FIXME:static assignment will be not used
//FIXME all values are almost set randomly
//RACH-Config-NB-IoT
//no numberOfRA_Preambles
......@@ -794,12 +792,12 @@ uint8_t do_SIB23_NB(uint8_t Mod_id,
sib2_NB->freqInfo_r13.ul_CarrierFreq_r13 = NULL;
sib2_NB->timeAlignmentTimerCommon_r13=TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120;
//new
sib2_NB->multiBandInfoList_r13 = NULL; //-->Additional Spectrum Emision
sib2_NB->multiBandInfoList_r13 = NULL; //-->Additional Spectrum Emission
/// SIB3-NB-------------------------------------------------------
sib3_NB->cellReselectionInfoCommon_r13.q_Hyst_r13=SystemInformationBlockType3_NB_r13__cellReselectionInfoCommon_r13__q_Hyst_r13_dB4;
sib3_NB->cellReselectionServingFreqInfo_r13.s_NonIntraSearch_r13=0; //or define in configuration?
sib3_NB->cellReselectionServingFreqInfo_r13.s_NonIntraSearch_r13=NULL; //or define in configuration?
sib3_NB->intraFreqCellReselectionInfo_r13.q_RxLevMin_r13 = -70;
//new
......@@ -811,11 +809,11 @@ uint8_t do_SIB23_NB(uint8_t Mod_id,
sib3_NB->intraFreqCellReselectionInfo_r13.t_Reselection_r13=1;
//how to manage?
sib3_NB->freqBandInfo_r13 = NULL;//??
sib3_NB->multiBandInfoList_r13 = NULL;//??
sib3_NB->freqBandInfo_r13 = NULL;
sib3_NB->multiBandInfoList_r13 = NULL;
///BCCH message (generate the SI message)--------------------------------
///BCCH message (generate the SI message)
bcch_message->message.present = BCCH_DL_SCH_MessageType_NB_PR_c1;
bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformation_r13;
......@@ -837,25 +835,8 @@ uint8_t do_SIB23_NB(uint8_t Mod_id,
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
//changed only "asn_DEF_BCCH_DL_SCH_Message_NB"
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
char message_string[15000];
size_t message_string_size;
if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message_NB, (void *)bcch_message)) > 0) {
MessageDef *msg_p;
//#if defined(ENABLE_ITTI).....
msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText));
msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size;
memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p);
}
}
# endif
#endif
#ifdef USER_MODE
LOG_D(RRC,"[eNB] SystemInformation-NB Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
......@@ -869,23 +850,14 @@ uint8_t do_SIB23_NB(uint8_t Mod_id,
return((enc_rval.encoded+7)/8);
}
/*do_RRCConnectionRequest_NB*/
//from UE side (for now not needed)
//Establishment cause are separated
//uint8_t do_RRCConnectionRequest_NB(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv){..}
/*do_do_RRCConnectionSetupComplete_NB*/
//from UE side (for now not needed)
//uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS)
/*do_RRCConnectionSetup_NB--> the aim is to establish SRB1 and SRB1bis*/
/*do_RRCConnectionSetup_NB--> the aim is to establish SRB1 and SRB1bis(implicitly)*/
uint8_t do_RRCConnectionSetup_NB(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_NB_t* const ue_context_pP,
int CC_id,
uint8_t* const buffer,
uint8_t* const buffer, //Srb0.Tx_buffer.Payload
const uint8_t Transaction_id,
const LTE_DL_FRAME_PARMS* const frame_parms, //to be changed ora maybe not used
const LTE_DL_FRAME_PARMS* const frame_parms, //to be changed or maybe not used
SRB_ToAddModList_NB_r13_t** SRB_configList_NB, //for both SRB1bis and SRB1
struct PhysicalConfigDedicated_NB_r13** physicalConfigDedicated_NB
)
......@@ -895,15 +867,17 @@ uint8_t do_RRCConnectionSetup_NB(
asn_enc_rval_t enc_rval;
uint8_t ecause=0;
//logical channel group not defined for Nb-IoT
//MP:logical channel group not defined for Nb-IoT
long* prioritySRB1 = NULL; //logical channel priority pag 605 (is 1 for SRB1 and for SRB1bis? is the same?)
//MP: logical channel priority pag 605 (is 1 for SRB1 and for SRB1bis should be the same)
long* prioritySRB1 = NULL;
long* prioritySRB1bis = NULL;
BOOLEAN_t* logicalChannelSR_Prohibit =NULL; //pag 605
BOOLEAN_t* npusch_AllSymbols= NULL;
struct SRB_ToAddMod_NB_r13* SRB1_config_NB = NULL;
struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1_rlc_config_NB = NULL;
struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1_lchan_config_NB = NULL;
// struct SRB_ToAddMod_NB_r13* SRB1_config_NB = NULL;
// struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1_rlc_config_NB = NULL;
// struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1_lchan_config_NB = NULL;
struct SRB_ToAddMod_NB_r13* SRB1bis_config_NB = NULL;
struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1bis_rlc_config_NB = NULL;
......@@ -969,23 +943,22 @@ uint8_t do_RRCConnectionSetup_NB(
// ASN_SEQUENCE_ADD(&(*SRB_configList_NB)->list,SRB1_config_NB);
///SRB1bis (The configuration for SRB1 and SRB1bis is the same)-------------------
// the only difference is the logical channel identity = 3 but not setted here
///SRB1bis (The configuration for SRB1 and SRB1bis is the same)
// the only difference is the logical channel identity = 3 but not set here
SRB1bis_config_NB = CALLOC(1,sizeof(*SRB1bis_config_NB));
SRB1bis_config_NB = SRB1_config_NB;
//no srb_Identity in SRB_ToAddMod_NB
SRB1bis_rlc_config_NB = CALLOC(1,sizeof(*SRB1bis_rlc_config_NB));
SRB1bis_config_NB->rlc_Config_r13 = SRB1bis_rlc_config_NB;
SRB1bis_rlc_config_NB->present = SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue;
SRB1bis_rlc_config_NB->choice.explicitValue.present=RLC_Config_NB_r13_PR_am;//the only possible in NB_IoT
SRB1bis_rlc_config_NB->choice.explicitValue.present=RLC_Config_NB_r13_PR_am;//MP: the only possible RLC config in NB_IoT
SRB1bis_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000;
SRB1bis_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8;
//(musT be disabled--> SRB1 config pag 640 specs )
SRB1_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL;
SRB1bis_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL;
SRB1bis_lchan_config_NB = CALLOC(1,sizeof(*SRB1bis_lchan_config_NB));
SRB1bis_config_NB->logicalChannelConfig_r13 = SRB1bis_lchan_config_NB;
......@@ -997,12 +970,12 @@ uint8_t do_RRCConnectionSetup_NB(
SRB1bis_lchan_config_NB->choice.explicitValue.priority_r13 = prioritySRB1bis;
logicalChannelSR_Prohibit = CALLOC(1, sizeof(BOOLEAN_t));
*logicalChannelSR_Prohibit = 1;
//schould be set to TRUE (specs pag 641)
*logicalChannelSR_Prohibit = 1; //schould be set to TRUE (specs pag 641)
SRB1bis_lchan_config_NB->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit;
//ADD SRB1bis
//FIXME: actually there is no way to distinguish SRB1 and SRB1bis
//MP: Actually there is no way to distinguish SRB1 and SRB1bis once in the list
//MP: XXX SRB_ToAddModList_NB_r13_t size = 1
ASN_SEQUENCE_ADD(&(*SRB_configList_NB)->list,SRB1bis_config_NB);
......@@ -1024,14 +997,13 @@ uint8_t do_RRCConnectionSetup_NB(
* Once selected, the same transmission scheme applies to NPBCH, NPDCCH, and NPDSCH.
* */
//CarrierConfigDedicated --> random values setted
//FIXME: CarrierConfigDedicated check the set values
physicalConfigDedicated2_NB->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13->present=
DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13_PR_useNoBitmap_r13;
physicalConfigDedicated2_NB->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13->present =
DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13_PR_useNoGap_r13;
physicalConfigDedicated2_NB->carrierConfigDedicated_r13->dl_CarrierConfig_r13.inbandCarrierInfo_r13->eutraControlRegionSize_r13= 0;
//physicalConfigDedicated2_NB->carrierConfigDedicated_r13->dl_CarrierConfig_r13->inbandCarrierInfo_r13->samePCI_Indicator_r13 (??)
//maybe first need to allocate memory?
physicalConfigDedicated2_NB->carrierConfigDedicated_r13->dl_CarrierConfig_r13.inbandCarrierInfo_r13= NULL;
physicalConfigDedicated2_NB->carrierConfigDedicated_r13->ul_CarrierConfig_r13.ul_CarrierFreq_r13->carrierFreq_r13=0;
physicalConfigDedicated2_NB->carrierConfigDedicated_r13->ul_CarrierConfig_r13.ul_CarrierFreq_r13->carrierFreqOffset_r13= NULL;
......@@ -1042,18 +1014,20 @@ uint8_t do_RRCConnectionSetup_NB(
// NPUSCH
physicalConfigDedicated2_NB->npusch_ConfigDedicated_r13->ack_NACK_NumRepetitions_r13= NULL; //(specs pag 643)
//physicalConfigDedicated2_NB->npusch_ConfigDedicated_r13->npusch_AllSymbols_r13= //(TRUE)
physicalConfigDedicated2_NB->npusch_ConfigDedicated_r13->groupHoppingDisabled_r13=NULL; //(TRUE?? is a long*)
npusch_AllSymbols= CALLOC(1, sizeof(BOOLEAN_t));
*npusch_AllSymbols= 1; //TRUE
physicalConfigDedicated2_NB->npusch_ConfigDedicated_r13->npusch_AllSymbols_r13= npusch_AllSymbols;
physicalConfigDedicated2_NB->npusch_ConfigDedicated_r13->groupHoppingDisabled_r13=NULL;
// UplinkPowerControlDedicated
physicalConfigDedicated2_NB->uplinkPowerControlDedicated_r13->p0_UE_NPUSCH_r13 = 0; // 0 dB (specs pag 643)
//check if the one set to NULL are correct
//Fill the rrcConnectionSetup-NB message
rrcConnectionSetup_NB->rrc_TransactionIdentifier = Transaction_id; //input value
rrcConnectionSetup_NB->criticalExtensions.present = RRCConnectionSetup_NB__criticalExtensions_PR_c1;
rrcConnectionSetup_NB->criticalExtensions.choice.c1.present =RRCConnectionSetup_NB__criticalExtensions__c1_PR_rrcConnectionSetup_r13 ;
//FIXME: should carry only SRB1bis?
//XXX: carry only SRB1bis at the moment and phyConfigDedicated
rrcConnectionSetup_NB->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = *SRB_configList_NB;
rrcConnectionSetup_NB->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL;
rrcConnectionSetup_NB->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToReleaseList_r13 = NULL;
......@@ -1077,12 +1051,6 @@ uint8_t do_RRCConnectionSetup_NB(
enc_rval.encoded,(enc_rval.encoded+7)/8,ecause);
#endif
// FREEMEM(SRB_list);
// free(SRB1_config);
// free(SRB1_rlc_config);
// free(SRB1_lchan_config);
// free(SRB1_ul_SpecificParameters);
return((enc_rval.encoded+7)/8);
}
......@@ -1213,7 +1181,7 @@ uint16_t do_RRCConnectionReconfiguration_NB(
const protocol_ctxt_t* const ctxt_pP,
uint8_t *buffer,
uint8_t Transaction_id,
SRB_ToAddModList_NB_r13_t *SRB_list_NB, //SRB_ConfigList2 (default)--> only SRB1?
SRB_ToAddModList_NB_r13_t *SRB1_list_NB, //SRB_ConfigList2 (default)--> only SRB1
DRB_ToAddModList_NB_r13_t *DRB_list_NB, //DRB_ConfigList (default)
DRB_ToReleaseList_NB_r13_t *DRB_list2_NB, //is NULL when passed
struct PhysicalConfigDedicated_NB_r13 *physicalConfigDedicated_NB,
......@@ -1243,11 +1211,11 @@ uint16_t do_RRCConnectionReconfiguration_NB(
//RAdioResourceconfigDedicated
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13 =
CALLOC(1,sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13));
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->srb_ToAddModList_r13 = SRB_list_NB; //only SRB1?
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->srb_ToAddModList_r13 = SRB1_list_NB; //only SRB1
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->drb_ToAddModList_r13 = DRB_list_NB;
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->drb_ToReleaseList_r13 = DRB_list2_NB;
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->drb_ToReleaseList_r13 = DRB_list2_NB; //NULL
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->physicalConfigDedicated_r13 = physicalConfigDedicated_NB;
//used? pass as argument?
//FIXME may not used now
//rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->rlf_TimersAndConstants_r13
if (mac_MainConfig_NB!=NULL) {
......@@ -1263,12 +1231,11 @@ uint16_t do_RRCConnectionReconfiguration_NB(
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13=NULL;
}
//no measConfig
//no measConfig, measIDlist
//no mobilityControlInfo
//Other
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.dedicatedInfoNASList_r13 = dedicatedInfoNASList_NB;
//(how to set?)
//mainly used for cell-reselection/handover purposes??
rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.fullConfig_r13 = NULL;
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB,
......@@ -1417,44 +1384,6 @@ uint8_t do_RRCConnectionReject_NB(
return((enc_rval.encoded+7)/8);
}
/*do_RRCConnectionRelease_NB*/
uint8_t do_RRCConnectionRelease_NB(uint8_t Mod_id, uint8_t *buffer,int Transaction_id)
{
asn_enc_rval_t enc_rval;
DL_DCCH_Message_NB_t dl_dcch_msg_NB;
RRCConnectionRelease_NB_t *rrcConnectionRelease_NB;
memset(&dl_dcch_msg_NB,0,sizeof(DL_DCCH_Message_NB_t));
dl_dcch_msg_NB.message.present = DL_DCCH_MessageType_NB_PR_c1;
dl_dcch_msg_NB.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_rrcConnectionRelease_r13;
rrcConnectionRelease_NB = &dl_dcch_msg_NB.message.choice.c1.choice.rrcConnectionRelease_r13;
// RRCConnectionRelease
rrcConnectionRelease_NB->rrc_TransactionIdentifier = Transaction_id;
rrcConnectionRelease_NB->criticalExtensions.present = RRCConnectionRelease_NB__criticalExtensions_PR_c1;
rrcConnectionRelease_NB->criticalExtensions.choice.c1.present =RRCConnectionRelease_NB__criticalExtensions__c1_PR_rrcConnectionRelease_r13 ;
rrcConnectionRelease_NB->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.releaseCause_r13 = ReleaseCause_NB_r13_other;
//which value set?
rrcConnectionRelease_NB->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.resumeIdentity_r13 = NULL;
rrcConnectionRelease_NB->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.extendedWaitTime_r13 = NULL;
rrcConnectionRelease_NB->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.redirectedCarrierInfo_r13 = NULL;
//why in this case allocate memory for noncriticalExtension?
rrcConnectionRelease_NB->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.nonCriticalExtension=CALLOC(1,
sizeof(*rrcConnectionRelease_NB->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.nonCriticalExtension));
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB,
(void*)&dl_dcch_msg_NB,
buffer,
RRC_BUF_SIZE);
return((enc_rval.encoded+7)/8);
}
//no do_MBSFNAreaConfig(..) in NB-IoT
//no do_MeasurementReport(..) in NB-IoT
......@@ -1585,7 +1514,7 @@ uint8_t do_RRCConnectionReestablishment_NB(
uint8_t do_RRCConnectionRelease_NB(
uint8_t Mod_id,
uint8_t *buffer,
uint8_t Transaction_id)
const uint8_t Transaction_id)
{
asn_enc_rval_t enc_rval;
......@@ -1594,7 +1523,7 @@ uint8_t do_RRCConnectionRelease_NB(
RRCConnectionRelease_NB_t *rrcConnectionRelease_NB;
memset(&dl_dcch_msg_NB,0,sizeof(DL_DCCH_Message_t));
memset(&dl_dcch_msg_NB,0,sizeof(DL_DCCH_Message_NB_t));
dl_dcch_msg_NB.message.present = DL_DCCH_MessageType_NB_PR_c1;
dl_dcch_msg_NB.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_rrcConnectionRelease_r13;
......
......@@ -314,8 +314,8 @@ typedef struct {
typedef struct RB_INFO_NB_s {
uint16_t Rb_id; //=Lchan_id
LCHAN_DESC Lchan_desc[2]; //LCHAN_DESC should be changed for NB-IoT
MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT
LCHAN_DESC Lchan_desc[2]; //XXX LCHAN_DESC should be changed for NB-IoT
//MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT
} RB_INFO_NB;
typedef struct SRB_INFO_NB_s {
......@@ -349,13 +349,20 @@ typedef struct SRB_INFO_TABLE_ENTRY_NB_s {
//NB-IoT eNB_RRC_UE_NB_s--(used as a context in eNB --> ue_context in rrc_eNB_ue_context)------
typedef struct eNB_RRC_UE_NB_s {
uint8_t primaryCC_id;
//Radio Bearers carried by RadioResourceConfigDedicated-NB-r13.h
//used in generate_default/dedicatedRRCConnectionReconfiguration (rrc_eNB.c)
//in NB-IoT only SRB0, SRB1 and SRB1bis (until AS security activation) exist
/*MP: Concept behind List and List2
*
* SRB_configList --> is used for the actual list of SRBs that is managed/that should be send over the RRC message
* SRB_configList2--> refers to all the SRBs configured for that specific transaction identifier
* this because in a single transaction one or more SRBs could be established
* and you want to keep memory on what happen for every transaction
* Transaction ID (xid): is used to associate the proper RRC....Complete message received by the UE to the corresponding
* message previously sent by the eNB (e.g. RRCConnectionSetup -- RRCConnectionSetupComplete)
* this because it could happen that more messages are transmitted at the same time
*/
SRB_ToAddModList_NB_r13_t* SRB_configList;//for SRB1 and SRB1bis
SRB_ToAddModList_NB_r13_t* SRB1_configList[RRC_TRANSACTION_IDENTIFIER_NUMBER]; //only for SRB1
SRB_ToAddModList_NB_r13_t* SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER];
DRB_ToAddModList_NB_r13_t* DRB_configList; //for all the DRBs
DRB_ToAddModList_NB_r13_t* DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; //for the configured DRBs of a xid
uint8_t DRB_active[2];//in LTE was 8 --> at most 2 for NB-IoT
......@@ -393,7 +400,6 @@ typedef struct eNB_RRC_UE_NB_s {
/* Information from UE RRC ConnectionReestablishmentRequest-NB--> NB-IoT */
ReestablishmentCause_NB_r13_t reestablishment_cause_NB; //different set for NB_IoT
///nothing to be changed for NB-IoT?
/* UE id for initial connection to S1AP */
uint16_t ue_initial_id;
......@@ -407,16 +413,17 @@ typedef struct eNB_RRC_UE_NB_s {
/* Number of e_rab to be setup in the list */ //NAS list?
uint8_t nb_of_e_rabs;
/* list of e_rab to be setup by RRC layers */
e_rab_param_NB_t e_rab[NB_RB_MAX];//[S1AP_MAX_E_RAB];
e_rab_param_NB_t e_rab[NB_RB_MAX_NB_IOT];//[S1AP_MAX_E_RAB];
// LG: For GTPV1 TUNNELS
uint32_t enb_gtp_teid[S1AP_MAX_E_RAB];
transport_layer_addr_t enb_gtp_addrs[S1AP_MAX_E_RAB];
rb_id_t enb_gtp_ebi[S1AP_MAX_E_RAB];
//Which timers are referring to?
uint32_t ul_failure_timer;
uint32_t ue_release_timer;
//threshold of the release timer--> set in RRCConnectionRelease
uint32_t ue_release_timer_thres;
} eNB_RRC_UE_NB_t;
//--------------------------------------------------------------------------------
......@@ -424,7 +431,7 @@ typedef struct eNB_RRC_UE_NB_s {
typedef uid_NB_t ue_uid_t;
//Not touched - generally variable called: ue_context_pP
//generally variable called: ue_context_pP
typedef struct rrc_eNB_ue_context_NB_s {
/* Tree related data */
......@@ -480,11 +487,12 @@ typedef struct {
uint8_t *SIB22_NB;
uint8_t sizeof_SIB22_NB;
int Ncp; //extended cyclic prefix (needed?)
int p_eNB; //number of Transmit antenna (may not needed)
uint32_t dl_CarrierFreq;
uint32_t ul_CarrierFreq;
uint16_t physCellId; //SIB5-NB //look also at the difference in In-Band implementation
//implicit parameters needed
int Ncp; //extended cyclic prefix
int p_eNB; //number of antenna port (getting from the CRS of the MIB-NB)
uint32_t dl_CarrierFreq; //detected by the UE
uint32_t ul_CarrierFreq; //detected by the UE
uint16_t physCellId; //not stored in the MIB-NB but is getting through NPSS/NSSS
//are the only static one (memory has been already allocated)
BCCH_BCH_Message_NB_t mib_NB;
......@@ -533,7 +541,6 @@ typedef struct eNB_RRC_INST_NB_s {
//RRC configuration
RrcConfigurationReq configuration; //should be changed but need PHY specs also
//new--> to be check
// other PLMN parameters
/// Mobile country code
int mcc;
......@@ -542,10 +549,8 @@ typedef struct eNB_RRC_INST_NB_s {
/// number of mnc digits
int mnc_digit_length;
// other RAN parameters
// other RAN parameters //FIXME: to be checked--> depends on APP layer
int srb1_timer_poll_retransmit;
int srb1_poll_pdu;
int srb1_poll_byte;
int srb1_max_retx_threshold;
int srb1_timer_reordering;
int srb1_timer_status_prohibit;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file vars.h
* \brief rrc external vars
* \author Navid Nikaein and Raymond Knopp, Michele Paffetti
* \date 2011-2017
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr, michele.paffetti@studio.unibo.it
*/
#ifndef __OPENAIR_RRC_EXTERN_NB_IOT_H__
#define __OPENAIR_RRC_EXTERN_NB_IOT_H__
#include "defs_nb_iot.h"
#include "COMMON/mac_rrc_primitives.h"
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/extern.h"
#include "LAYER2/RLC/rlc.h"
#include "LogicalChannelConfig-NB-r13.h"
//MP: NOTE:XXX some of the parameters defined in vars_nb_iot are called by the extern.h file so not replicated here
//should be modified
//extern LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
extern eNB_RRC_INST_NB *eNB_rrc_inst_NB;
extern rlc_info_t Rlc_info_um,Rlc_info_am_config,Rlc_info_am;
extern uint8_t DRB2LCHAN_NB[2];
extern LogicalChannelConfig_NB_r13_t SRB1bis_NB_logicalChannelConfig_defaultValue;
extern LogicalChannelConfig_NB_r13_t SRB1_NB_logicalChannelConfig_defaultValue;
#endif
......@@ -31,30 +31,385 @@
*/
#include "RRC/LITE/defs_nb_iot.h"
/*NOTE: no static function should be declared in this header file*/
#include "pdcp.h"
#include "rlc.h"
#include "extern_nb_iot.h"
/*rrc_common.c*/
//int rrc_init_global_param(void);
//int L3_xface_init(void);
//void openair_rrc_top_init(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,uint8_t HO_enabled);
//void rrc_config_buffer(SRB_INFO *srb_info, uint8_t Lchan_type, uint8_t Role);
//void openair_rrc_on(const protocol_ctxt_t* const ctxt_pP);
//void rrc_top_cleanup(void);
//RRC_status_t rrc_rx_tx(protocol_ctxt_t* const ctxt_pP, const uint8_t enb_index, const int CC_id);
//long binary_search_int(int elements[], long numElem, int value);
//long binary_search_float(float elements[], long numElem, float value);
/*NOTE: no static function should be declared in this header file (e.g. init_SI_NB)*/
/*------------------------common_nb_iot.c----------------------------------------*/
/** \brief configure BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
*/
void openair_rrc_on_NB(const protocol_ctxt_t* const ctxt_pP);
void rrc_config_buffer_NB(SRB_INFO_NB *srb_info, uint8_t Lchan_type, uint8_t Role);
int L3_xface_init_NB(void);
void openair_rrc_top_init_NB( char *uecap_xer);
//void rrc_top_cleanup(void); -->seems not to be used
//rrc_t310_expiration-->seems not to be used
/** \brief Function to update timers every subframe. For UE it updates T300,T304 and T310.
@param ctxt_pP running context
@param enb_index
@param CC_id
*/
RRC_status_t rrc_rx_tx_NB(protocol_ctxt_t* const ctxt_pP, const uint8_t enb_index, const int CC_id);
//long binary_search_int(int elements[], long numElem, int value);--> seems not to be used
//long binary_search_float(float elements[], long numElem, float value);--> used only at UE side
/*------------------------L2_interface_nb_iot.c (temporary location for most of the interfaces)--------*/
//defined in MAC/config.c
//FIXME: this function has no implication in terms of logical channel configuration for MAC
int NB_rrc_mac_config_req_eNB(
module_id_t Mod_idP,
int CC_idP,
int rntiP, //FIXME: Raymond bug?
int physCellId,
int p_eNB,
int Ncp,
long eutra_band,//FIXME: frequencyBandIndicator in sib1 (is a long not an int!!)
struct NS_PmaxList_NB_r13 *frequencyBandInfo, //optional SIB1
struct MultiBandInfoList_NB_r13 *multiBandInfoList, //optional SIB1
struct DL_Bitmap_NB_r13 *dl_bitmap, //optional SIB1
long* eutraControlRegionSize, //optional sib1
long* nrs_CRS_PowerOffset, //optional
uint8_t *SIwindowsize, //maybe no more needed because TDD only
uint16_t *SIperiod, //maybe no more needed because TDD only
uint32_t dl_CarrierFreq,
uint32_t ul_CarrierFreq,
BCCH_BCH_Message_NB_t *mib_NB,
RadioResourceConfigCommonSIB_NB_r13_t *radioResourceConfigCommon,
struct PhysicalConfigDedicated_NB_r13 *physicalConfigDedicated,
MAC_MainConfig_NB_r13_t *mac_MainConfig,
long logicalChannelIdentity,//FIXME: decide how to use it
LogicalChannelConfig_NB_r13_t *logicalChannelConfig //FIXME: decide how to use it
);
//----------------------------------------
//defined in L2_interface
int8_t NB_mac_rrc_data_req_eNB(
const module_id_t Mod_idP,
const int CC_id,
const frame_t frameP,
const rb_id_t Srb_id,
uint8_t* const buffer_pP,
uint32_t start_sfn_sib1_NB, //starting frame for sib1 transmission
uint32_t nb_sib1_NB_rep, //number of sib1 repetitions
const frame_t h_frameP, //HSFN
long si_periodicity, //SI-periodicity
long si_windowLength //Si-windwolength
);
//---------------------------------------
//defined in L2_interface
//called by rx_sdu only in case of CCCH message (e.g RRCConnectionRequest-NB)
int8_t NB_mac_rrc_data_ind_eNB(
const module_id_t module_idP,
const int CC_id,
const frame_t frameP,
const sub_frame_t sub_frameP,
const rnti_t rntiP,
const rb_id_t srb_idP,//could be skipped since always go through the CCCH channel
const uint8_t* sduP,
const sdu_size_t sdu_lenP
);
//-------------------------------------------
//defined in L2_interface
void NB_mac_eNB_rrc_ul_failure(
const module_id_t mod_idP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP);
//------------------------------------------
//defined in eNB_scheduler_primitives.c
int NB_rrc_mac_remove_ue(
module_id_t mod_idP,
rnti_t rntiP);
//------------------------------------------
//defined in L2_interface
void NB_mac_eNB_rrc_ul_in_sync(
const module_id_t mod_idP,
const int CC_idP,
const frame_t frameP,
const sub_frame_t subframeP,
const rnti_t rntiP);
//------------------------------------------
//defined in L2_interface
int NB_mac_eNB_get_rrc_status(
const module_id_t Mod_idP,
const rnti_t rntiP
);
//---------------------------
//FIXME for the moment we not configure PDCP for SRB1bis (but used as it is SRB1)
//defined in pdcp.c
boolean_t NB_rrc_pdcp_config_asn1_req (
const protocol_ctxt_t* const ctxt_pP,
SRB_ToAddModList_NB_r13_t *const srb2add_list_pP,
DRB_ToAddModList_NB_r13_t *const drb2add_list_pP,
DRB_ToReleaseList_NB_r13_t *const drb2release_list_pP,
const uint8_t security_modeP,
uint8_t *const kRRCenc_pP,
uint8_t *const kRRCint_pP,
uint8_t *const kUPenc_pP,
rb_id_t *const defaultDRB,
long LCID
);
//--------------------------------------------------
//defined in pdcp.c --> should be called only by a SRB1 (is internal to PDCP so is not an interface)
//-----------------------------------------------------------------------------
boolean_t
NB_pdcp_config_req_asn1 (
const protocol_ctxt_t* const ctxt_pP,
pdcp_t * const pdcp_pP,
const srb_flag_t srb_flagP,
const rlc_mode_t rlc_modeP, //rlc_type
const config_action_t actionP,
const uint16_t lc_idP, // 1 = SRB1 // 3 = SRB1bis // >= 4 for DRBs
const rb_id_t rb_idP,
const uint8_t rb_snP, //5 if srb_sn // 7 is drb_sn // 0 if drb_sn to be removed
const uint8_t rb_reportP, //not for SRBand not for NB-IOT
const uint16_t header_compression_profileP, //not for SRB only DRB
const uint8_t security_modeP,
uint8_t *const kRRCenc_pP,
uint8_t *const kRRCint_pP,
uint8_t *const kUPenc_pP);
//-----------------------------------------------------------------------------
//defined in L2_interface/pdcp.c
//FIXME SRB1bis should bypass the pdcp
//Distinction between different SRBs will be done by means of rd_id
uint8_t NB_rrc_data_req(
const protocol_ctxt_t* const ctxt_pP,
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_sizeP,
uint8_t* const buffer_pP,
const pdcp_transmission_mode_t modeP //when go through SRB1bis should be set as Transparent mode
);
//-------------------------------------------------------------
//we distinguish the SRBs based on the logical channel id and the transmission mode
boolean_t NB_pdcp_data_req(
protocol_ctxt_t* ctxt_pP,
const srb_flag_t srb_flagP, //SRB_FLAG_YES if called by RRC
const rb_id_t rb_idP,
const mui_t muiP,
const confirm_t confirmP,
const sdu_size_t sdu_buffer_sizeP, //the size of message that i should transmit
unsigned char *const sdu_buffer_pP,
const pdcp_transmission_mode_t modeP
);
//----------------------------------------------------------------
//defined in L2_interface
void NB_rrc_data_ind(
const protocol_ctxt_t* const ctxt_pP,
const rb_id_t Srb_id,
const sdu_size_t sdu_sizeP,
const uint8_t* const buffer_pP,
const srb1bis_flag_t srb1bis_flag
);
//------------------------------------------------------------------------------
//defined in rlc_rrc.c
rlc_op_status_t NB_rrc_rlc_config_asn1_req (
const protocol_ctxt_t * const ctxt_pP,
const SRB_ToAddModList_NB_r13_t * const srb2add_listP,
const DRB_ToAddModList_NB_r13_t * const drb2add_listP,
const DRB_ToReleaseList_NB_r13_t * const drb2release_listP,
srb1bis_flag_t srb1bis_flag
);
//-------------------------------------------------------------------------
// defined in rlc_am.c
void NB_config_req_rlc_am_asn1 (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const struct RLC_Config_NB_r13__am * const config_am_pP, //extracted from the srb_toAddMod
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP);
//------------------------------------------------------------
//defined in rlc_am_init.c
//------------------------------------------------------------
void
NB_rlc_am_configure(
const protocol_ctxt_t* const ctxt_pP,
rlc_am_entity_t *const rlc_pP,
const uint16_t max_retx_thresholdP,
const uint16_t t_poll_retransmitP,
const uint16_t* const enableStatusReportSN_Gap
);
//--------------------------------------------------------------
//defined in rlc_rrc.c
//-------------------------------------------------------------
rlc_union_t* NB_rrc_rlc_add_rlc (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP,
const rlc_mode_t rlc_modeP);
//--------------------------------------------------------------
//defined in rlc_rrc.c
//--------------------------------------------------------------
rlc_op_status_t NB_rrc_rlc_remove_rlc (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP);
//----------------------------------------------
//defined in rlc_rrc.c //used only for process_RRCConnectionReconfigurationComplete --> CONFIG_ACTION_REMOVE
//used also for rrc_t310_expiration --> I don't know if it is used (probably not)
rlc_op_status_t NB_rrc_rlc_config_req (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const config_action_t actionP,
const rb_id_t rb_idP,
const rlc_info_t rlc_infoP);
//-----------------------------------------------------
//defined in rlc_am.c
//------------------------------------------------------
void
NB_config_req_rlc_am (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
rlc_am_info_NB_t * const config_am_pP, //XXX: MP: rlc_am_init.c --> this structure has been modified for NB-IoT
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP
);
//--------------------------------------------------------
//defined in rlc_tm_init.c (nothing to be changed)
//-----------------------------------------------------------------------------
void NB_config_req_rlc_tm (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const rlc_tm_info_t * const config_tmP,
const rb_id_t rb_idP,
const logical_chan_id_t chan_idP
);
//------------------------------------------------------
//defined in rlc_rrc.c
rlc_op_status_t NB_rrc_rlc_remove_ue (
const protocol_ctxt_t* const ctxt_pP);
//----------------------------------------------------
//defined in rlc.c
//--------------------------------------------
void NB_rlc_data_ind (
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const srb1bis_flag_t srb1bis_flag,
const rb_id_t rb_idP,
const sdu_size_t sdu_sizeP,
mem_block_t *sdu_pP);
//---------------------------------------------
//defined in rlc.c
//-----------------------------------------------------------------------------
rlc_op_status_t NB_rlc_data_req (const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const rb_id_t rb_idP,
const mui_t muiP,
confirm_t confirmP,
sdu_size_t sdu_sizeP,
mem_block_t *sdu_pP);
//-----------------------------------------------------------------------------
//defined in pdcp.c
//FIXME: should go transparent through the PDCP
//--------------------------------------------
boolean_t
NB_pdcp_data_ind(
const protocol_ctxt_t* const ctxt_pP,
const srb_flag_t srb_flagP,
const srb1bis_flag_t srb1bis_flag,
const rb_id_t rb_idP,
const sdu_size_t sdu_buffer_sizeP,
mem_block_t* const sdu_buffer_pP
);
//---------------------------------------------
//defined in rlc_mac.c
void NB_mac_rlc_data_ind (
const module_id_t module_idP,
const rnti_t rntiP,
const module_id_t eNB_index,
const frame_t frameP,
const eNB_flag_t enb_flagP,
//const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
char *buffer_pP,
const tb_size_t tb_sizeP,
num_tb_t num_tbP,
crc_t *crcs_pP);
//-------------------------------------------
//defined in rlc_am.c
void
NB_rlc_am_mac_data_indication (
const protocol_ctxt_t* const ctxt_pP,
void * const rlc_pP,
struct mac_data_ind data_indP
);
//--------------------------------------------
//defined in rlc_mac.c
//called by the schedule_ue_spec for getting SDU to be transmitted from SRB1/SRB1bis and DRBs
tbs_size_t NB_mac_rlc_data_req_eNB(
const module_id_t module_idP,
const rnti_t rntiP,
const eNB_index_t eNB_index,
const frame_t frameP,
const MBMS_flag_t MBMS_flagP,
const logical_chan_id_t channel_idP,
char *buffer_pP);
//--------------------------------------------
/*L2_interface.c*/
/*UE procedures*/
/*eNB procedures*/
//char openair_rrc_eNB_init(const module_id_t module_idP);
//---Initialization--------------
void
openair_eNB_rrc_on_NB(
const protocol_ctxt_t* const ctxt_pP
);
void
rrc_config_buffer_NB(
SRB_INFO_NB* Srb_info,
uint8_t Lchan_type,
uint8_t Role
);
char
openair_rrc_eNB_configuration_NB(
const module_id_t enb_mod_idP,
RrcConfigurationReq* configuration
);
/**\brief RRC eNB task.
//-----------------------------
/**\brief RRC eNB task. (starting of the RRC state machine)
\param void *args_p Pointer on arguments to start the task. */
void *rrc_enb_task_NB(void *args_p);
......@@ -149,12 +504,6 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
//no HO flag
);
char
openair_rrc_eNB_configuration_NB(
const module_id_t enb_mod_idP,
RrcConfigurationReq* configuration
);
/// Utilities------------------------------------------------
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file rrc_common.c
* \brief rrc common procedures for eNB and UE
* \author Navid Nikaein and Raymond Knopp
* \date 2011 - 2014
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr
*/
#include "defs_nb_iot.h"
#include "extern.h"
#include "LAYER2/MAC/extern.h"
#include "COMMON/openair_defs.h"
#include "COMMON/platform_types.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "LAYER2/RLC/rlc.h"
#include "COMMON/mac_rrc_primitives.h"
#include "UTIL/LOG/log.h"
#include "asn1_msg.h"
#include "pdcp.h"
#include "UTIL/LOG/vcd_signal_dumper.h"
#include "rrc_eNB_UE_context.h"
#ifdef LOCALIZATION
#include <sys/time.h>
#endif
#define DEBUG_RRC 1
extern eNB_MAC_INST *eNB_mac_inst;
extern UE_MAC_INST *UE_mac_inst;
extern mui_t rrc_eNB_mui;
/*missed functions*/
//rrc_top_cleanup
//rrc_t310_expiration
//binary_search_init
//binary_search_float
//configure BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
//called by openair_rrc_eNB_configuration_NB
//-----------------------------------------------------------------------------
void
openair_eNB_rrc_on_NB(
const protocol_ctxt_t* const ctxt_pP
)
//-----------------------------------------------------------------------------
{
unsigned short i;
int CC_id;
LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" OPENAIR RRC-NB IN....\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
rrc_config_buffer_NB (&eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].SI, BCCH, 1);
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].SI.Active = 1;
rrc_config_buffer_NB (&eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].Srb0, CCCH, 1);
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].Srb0.Active = 1;
}
//no UE side
}
//-----------------------------------------------------------------------------
void
rrc_config_buffer_NB(
SRB_INFO_NB* Srb_info,
uint8_t Lchan_type,
uint8_t Role
)
//-----------------------------------------------------------------------------
{
Srb_info->Rx_buffer.payload_size = 0;
Srb_info->Tx_buffer.payload_size = 0;
}
//-----------------------------------------------------------------------------
//XXX NEW mplementation by Raymond: still used but no more called by MAC/main.c instead directly called by rrc_eNB_nb_iot.c
int
rrc_init_global_param_NB(
void
)
//-----------------------------------------------------------------------------
{
rrc_rlc_register_rrc (rrc_data_ind, NULL); //register with rlc
//FIXME: all this parameter must be properly set
DCCH_LCHAN_DESC.transport_block_size = 4;
DCCH_LCHAN_DESC.max_transport_blocks = 16;
DCCH_LCHAN_DESC.Delay_class = 1;
DTCH_DL_LCHAN_DESC.transport_block_size = 52;
DTCH_DL_LCHAN_DESC.max_transport_blocks = 20;
DTCH_DL_LCHAN_DESC.Delay_class = 1;
DTCH_UL_LCHAN_DESC.transport_block_size = 52;
DTCH_UL_LCHAN_DESC.max_transport_blocks = 20;
DTCH_UL_LCHAN_DESC.Delay_class = 1;
//UM mode not allowed in NB-IoT
//XXX MP:structure rlc_am_info_NB --> rlc.h
Rlc_info_am_config.rlc_mode = RLC_MODE_AM;
Rlc_info_am_config.rlc.rlc_am_info_NB.max_retx_threshold = 50;
Rlc_info_am_config.rlc.rlc_am_info_NB.t_poll_retransmit = 15;
Rlc_info_am_config.rlc.rlc_am_info_NB.enableStatusReportSN_Gap = 0; //FIXME MP: should be disabled
#ifndef NO_RRM
if (L3_xface_init_NB ()) {
return (-1);
}
#endif
return 0;
}
//shoudl be changed?
#ifndef NO_RRM
//-----------------------------------------------------------------------------
int
L3_xface_init_NB(
void
)
//-----------------------------------------------------------------------------
{
int ret = 0;
#ifdef USER_MODE
int sock;
LOG_D(RRC, "[L3_XFACE] init de l'interface \n");
if (open_socket (&S_rrc, RRC_RRM_SOCK_PATH, RRM_RRC_SOCK_PATH, 0) == -1) {
return (-1);
}
if (S_rrc.s == -1) {
return (-1);
}
socket_setnonblocking (S_rrc.s);
msg ("Interface Connected... RRM-RRC\n");
return 0;
#else
ret=rtf_create(RRC2RRM_FIFO,32768);
if (ret < 0) {
msg("[openair][MAC][INIT] Cannot create RRC2RRM fifo %d (ERROR %d)\n",RRC2RRM_FIFO,ret);
return(-1);
} else {
msg("[openair][MAC][INIT] Created RRC2RRM fifo %d\n",RRC2RRM_FIFO);
rtf_reset(RRC2RRM_FIFO);
}
ret=rtf_create(RRM2RRC_FIFO,32768);
if (ret < 0) {
msg("[openair][MAC][INIT] Cannot create RRM2RRC fifo %d (ERROR %d)\n",RRM2RRC_FIFO,ret);
return(-1);
} else {
msg("[openair][MAC][INIT] Created RRC2RRM fifo %d\n",RRM2RRC_FIFO);
rtf_reset(RRM2RRC_FIFO);
}
return(0);
#endif
}
#endif
//------------------------------------------------------------------------------
//specialized function for the eNB initialization (NB-IoT)
//(OLD was called in MAC/main.c--> mac_top_init)(NEW is called in directly in "openair_rrc_eNB_configuration_NB")
void
openair_rrc_top_init_eNB_NB()//MP: XXX Raymond put this directly the definition on rrc_eNB.c file
//-----------------------------------------------------------------------------
{
module_id_t module_id;
int CC_id;
/* for no gcc warnings */
(void)CC_id;
//not consider UE part
if (NB_eNB_INST > 0) {
eNB_rrc_inst_NB = (eNB_RRC_INST_NB*) malloc16(NB_eNB_INST*sizeof(eNB_RRC_INST_NB));
memset (eNB_rrc_inst_NB, 0, NB_eNB_INST * sizeof(eNB_RRC_INST_NB));
//no CBA, no LOcalization, no MBMS flag
LOG_D(RRC,
"ALLOCATE %d Bytes for eNB_RRC_INST_NB @ %p\n", (unsigned int)(NB_eNB_INST*sizeof(eNB_RRC_INST_NB)), eNB_rrc_inst_NB);
} else {
eNB_rrc_inst_NB = NULL;
}
#ifndef NO_RRM
#ifndef USER_MODE
Header_buf=(char*)malloc16(sizeof(msg_head_t));
Data=(char*)malloc16(2400);
Header_read_idx=0;
Data_read_idx=0;
Header_size=sizeof(msg_head_t);
#endif //NO_RRM
Data_to_read = 0;
#endif //USER_MODE
}
//-----------------------------------------------------------------------------
//XXX MP: most probably is not needed
RRC_status_t
rrc_rx_tx_NB(
protocol_ctxt_t* const ctxt_pP,
const uint8_t enb_indexP,
const int CC_id
)
//-----------------------------------------------------------------------------
{
//uint8_t UE_id;
int32_t current_timestamp_ms, ref_timestamp_ms;
struct timeval ts;
struct rrc_eNB_ue_context_NB_s *ue_context_p = NULL;
struct rrc_eNB_ue_context_NB_s *ue_to_be_removed = NULL;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN);
if(ctxt_pP->enb_flag == ENB_FLAG_NO) { //is an UE
// check timers
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active == 1) {
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt % 10) == 0)
LOG_D(RRC,
"[UE %d][RAPROC] Frame %d T300 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt);
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt
== T300[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t300]) {
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active = 0;
// ALLOW CCCH to be used
UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0;
rrc_ue_generate_RRCConnectionRequest (ctxt_pP, enb_indexP);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
return (RRC_ConnSetup_failed);
}
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt++;
}
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].SIStatus&2)>0) {
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt
== N310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n310]) {
LOG_I(RRC,"Activating T310\n");
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 1;
}
} else { // in case we have not received SIB2 yet
/* if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt == 100) {
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt = 0;
}*/
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
return RRC_OK;
}
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active == 1) {
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt
== N311[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n311]) {
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0;
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt = 0;
}
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt % 10) == 0) {
LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt);
}
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;
rrc_t310_expiration (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);
LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n");
return RRC_PHY_RESYNCH;
}
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt++;
}
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active==1) {
if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt % 10) == 0)
LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",ctxt_pP->module_id,ctxt_pP->frame,
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt);
if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt == 0) {
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active = 0;
UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n",
ctxt_pP->module_id);
//Implement 36.331, section 5.3.5.6 here
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
return(RRC_Handover_failed);
}
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt--;
}
// Layer 3 filtering of RRC measurements
if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0] != NULL) {
ue_meas_filtering(ctxt_pP,enb_indexP);
}
ue_measurement_report_triggering(ctxt_pP,enb_indexP);
if (UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget > 0) {
LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame);
}
if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION) &&
(UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) {
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE;
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
return(RRC_HO_STARTED);
}
} else { // eNB
//no handover in NB_IoT
// counter, and get the value and aggregate
// check for UL failure
RB_FOREACH(ue_context_p, rrc_ue_tree_NB_s, &(eNB_rrc_inst_NB[ctxt_pP->module_id].rrc_ue_head)) {
if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/20000\n",
ue_context_p->ue_context.rnti,
ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
ue_context_p->ue_context.ul_failure_timer);
}
else {
LOG_I(RRC,"UE rnti %x failure timer %d/20000\n",
ue_context_p->ue_context.rnti,
ue_context_p->ue_context.ul_failure_timer);
}
}
if (ue_context_p->ue_context.ul_failure_timer>0) {
ue_context_p->ue_context.ul_failure_timer++;
if (ue_context_p->ue_context.ul_failure_timer >= 20000) {
// remove UE after 20 seconds after MAC has indicated UL failure
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
ue_to_be_removed = ue_context_p;
break;
}
}
if (ue_context_p->ue_context.ue_release_timer>0) {
ue_context_p->ue_context.ue_release_timer++;
if (ue_context_p->ue_context.ue_release_timer >=
ue_context_p->ue_context.ue_release_timer_thres) {
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
ue_to_be_removed = ue_context_p;
break;
}
}
}
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?
//no localization in NB-IoT
(void)ts; /* remove gcc warning "unused variable" */
(void)ref_timestamp_ms; /* remove gcc warning "unused variable" */
(void)current_timestamp_ms; /* remove gcc warning "unused variable" */
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
return (RRC_OK);
}
......@@ -48,6 +48,17 @@ uid_linear_allocator_init(
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_linear_allocator_new(
......@@ -155,6 +166,21 @@ rrc_eNB_get_ue_context(
}
//--(NB-IoT implementation)-----------------------------------------------------
struct rrc_eNB_ue_context_NB_s*
rrc_eNB_get_ue_context_NB(
eNB_RRC_INST_NB* rrc_instance_pP,
rnti_t rntiP)
//------------------------------------------------------------------------------
{
rrc_eNB_ue_context_NB_t temp;
memset(&temp, 0, sizeof(struct rrc_eNB_ue_context_NB_s));
/* eNB ue rrc id = 24 bits wide */
temp.ue_id_rnti = rntiP;
return RB_FIND(rrc_ue_tree_s, &rrc_instance_pP->rrc_ue_head, &temp);
}
//------------------------------------------------------------------------------
void rrc_eNB_remove_ue_context(
const protocol_ctxt_t* const ctxt_pP,
......
......@@ -31,6 +31,7 @@
#include "collection/tree.h"
#include "COMMON/platform_types.h"
#include "defs.h"
#include "defs_nb_iot.h"
void
......@@ -71,6 +72,12 @@ rrc_eNB_get_ue_context(
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(
const protocol_ctxt_t* const ctxt_pP,
eNB_RRC_INST* rrc_instance_pP,
......
......@@ -41,6 +41,7 @@
#include "DL-DCCH-Message-NB.h"
#include "extern.h"
#include "extern_nb_iot.h"
#include "assertions.h"
#include "asn1_conversions.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
......@@ -65,7 +66,9 @@
#include "msc.h"
#include "T.h"
//FIXME: MP: once defined properly the MAC/defs_nb_iot this should be deleted
#include "LAYER2/MAC/defs.h"
#include "LAYER2/MAC/defs_nb_iot.h"
#ifdef USER_MODE
......@@ -99,7 +102,7 @@
#if defined(FLEXRAN_AGENT_SB_IF)
#include "flexran_agent_extern.h"
#endif
//#define XER_PRINT
#ifdef PHY_EMUL
extern EMULATION_VARS *Emul_vars;
......@@ -136,7 +139,9 @@ rrc_eNB_generate_RRCConnectionRelease_NB(
memset(buffer, 0, RRC_BUF_SIZE);
size = do_RRCConnectionRelease_NB(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier_NB(ctxt_pP->module_id));
size = do_RRCConnectionRelease_NB(ctxt_pP->module_id,
buffer,
rrc_eNB_get_next_transaction_identifier_NB(ctxt_pP->module_id));
// set release timer
ue_context_pP->ue_context.ue_release_timer=1;
// remove UE after 10 frames after RRCConnectionRelease is triggered
......@@ -152,7 +157,7 @@ rrc_eNB_generate_RRCConnectionRelease_NB(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
size,
rrc_eNB_mui,
DCCH1);//Through SRB1
DCCH1);//Through SRB1/or SRB1bis
MSC_LOG_TX_MESSAGE(
MSC_RRC_ENB,
......@@ -167,7 +172,7 @@ rrc_eNB_generate_RRCConnectionRelease_NB(
rrc_data_req(
ctxt_pP,
DCCH1,//Through SRB1
DCCH1,//Through SRB1/or SRB1bis
rrc_eNB_mui++,
SDU_CONFIRM_NO,
size,
......@@ -299,8 +304,8 @@ rrc_eNB_get_next_free_ue_context_NB(
//-----------------------------------------------------------------------------
{
struct rrc_eNB_ue_context_NB_s* ue_context_p = NULL;
ue_context_p = rrc_eNB_get_ue_context(
&eNB_rrc_inst_NB[ctxt_pP->module_id], //FIXME: rrc_eNB_UE_context to be modified
ue_context_p = rrc_eNB_get_ue_context_NB(
&eNB_rrc_inst_NB[ctxt_pP->module_id],
ctxt_pP->rnti);
if (ue_context_p == NULL) {
......@@ -440,21 +445,23 @@ rrc_eNB_generate_RRCConnectionSetup_NB(
//-----------------------------------------------------------------------------
{
//connection setup involve the establishment of SRB1 and SRB1bis
//FIXME: this message should go through SRB0 but where to see this--> uper_encode
//FIXME: they are assuming that 2 RLC-AM entities are used for SRB1 and SRB1bis--> implications?
//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: they are assuming that 2 RLC-AM entities are used for SRB1 and SRB1bis
SRB_ToAddModList_NB_r13_t **SRB_configList; //for both SRB1 and SRB1bis
SRB_ToAddMod_NB_r13_t *SRB1_config; //will use the same for SRB1bis
LogicalChannelConfig_NB_r13_t *SRB1_logicalChannelConfig;
// SRB_ToAddMod_NB_r13_t *SRB1_config; //may not needed now
// LogicalChannelConfig_NB_r13_t *SRB1_logicalChannelConfig;
SRB_ToAddModList_NB_r13_t **SRB_configList; //for both SRB1 and SRB1bis
SRB_ToAddMod_NB_r13_t *SRB1bis_config;
LogicalChannelConfig_NB_r13_t *SRB1bis_logicalChannelConfig;
int cnt;
LTE_DL_FRAME_PARMS *fp = mac_xface->get_lte_frame_parms(ctxt_pP->module_id,CC_id); //FIXME: to be changed
int cnt;
//FIXME: MP: structure to be chaged at phy layer
LTE_DL_FRAME_PARMS *fp = mac_xface->get_lte_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_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
......@@ -468,7 +475,7 @@ rrc_eNB_generate_RRCConnectionSetup_NB(
(uint8_t*) eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].Srb0.Tx_buffer.Payload,
rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),
fp,
SRB_configList,
SRB_configList, //MP:should contain only SRb1bis for the moment
&ue_context_pP->ue_context.physicalConfigDedicated_NB);
#ifdef RRC_MSG_PRINT
......@@ -485,8 +492,10 @@ rrc_eNB_generate_RRCConnectionSetup_NB(
// configure SRB1bis, PhysicalConfigDedicated, MAC_MainConfig for UE
if (*SRB_configList != NULL) {
//srb_identity is no more used in NB-IoT
for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) { //should stop at 1 at first attempt
//XXX MP: srb_identity is no more used in NB-IoT
//XXX MP: the list should contain just one element
for(cnt = 0; cnt < (*SRB_configList)->list.count; cnt++){
SRB1bis_config = (*SRB_configList)->list.array[cnt];
......@@ -496,50 +505,48 @@ rrc_eNB_generate_RRCConnectionSetup_NB(
SRB1bis_logicalChannelConfig = &SRB1bis_config->logicalChannelConfig_r13->choice.explicitValue;
}
else {
SRB1bis_logicalChannelConfig = &SRB1bis_logicalChannelConfig_defaultValue; //FIXME: generate a new Vars.h file
//XXX MP: warning saying "assignment from incompatible pointer type"
SRB1bis_logicalChannelConfig = &SRB1bis_NB_logicalChannelConfig_defaultValue;
}
} else {
SRB1bis_logicalChannelConfig = &SRB1bis_logicalChannelConfig_defaultValue; //FIXME: generate a new Vars.h file
SRB1bis_logicalChannelConfig = &SRB1bis_NB_logicalChannelConfig_defaultValue;
}
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1bis) ---> MAC_eNB\n",
PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1bis/SRB1) ---> MAC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
//FIXME: unuseful parameter for rrc_mac_config_req
//set logicalchannelIdentity=3 (SRB1bis)--> we always have SRB1bis??
//FIXME: Connection Setup could be called also after security activation?
rrc_mac_config_req(
//FIXME: Connection Setup could be called also after security activation
//configure the MAC for SRB1bis/SRb1???? (but in principle this configuration should be not LCID dependent)
NB_rrc_mac_config_req_eNB(
ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
ENB_FLAG_YES,
ue_context_pP->ue_context.rnti,
0, //eNB_index
0, //physCellID
0, //p_eNB
0, //Ncp
0, //eutraband
(NS_PmaxList_NB_r13_t*) NULL,
(MultiBandInfoList_NB_r13_t*) NULL,
(DL_Bitmap_NB_r13_t*) NULL,
(long*) NULL,
(long*)NULL,
(uint8_t*) NULL, //SIWindowSize
(uint16_t*)NULL, //SIperiod
0, //dl_carrierFrequency
0, //ul_carrierFrequency
(BCCH_BCH_Message_NB_t*) NULL,
(RadioResourceConfigCommonSIB_NB_r13_t *) NULL,
ue_context_pP->ue_context.physicalConfigDedicated_NB,
#if defined(Rel10) || defined(Rel14)
NULL,
#endif
(MeasObjectToAddMod_t **) NULL,
ue_context_pP->ue_context.mac_MainConfig_NB,
3, //LCID
SRB1bis_logicalChannelConfig,
(MeasGapConfig_t*)NULL,
(TDD_Config_t *) NULL,
NULL,
(uint8_t *) NULL,
(uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL
#if defined(Rel10) || defined(Rel14)
, 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL
#endif
#ifdef CBA
, 0, 0
#endif
);
(PhysicalConfigDedicated_NB_r13_t*) ue_context_pP->ue_context.physicalConfigDedicated_NB,
ue_context_pP->ue_context.mac_MainConfig_NB, //FIXME WHo have set this??
DCCH0, //LCID = 3 of SRB1bis //XXX for the moment have been defined in MAC/defs.h but should move to MAC/defs_nb_iot.h
SRB1bis_logicalChannelConfig
);
break;
}
}
}
MSC_LOG_TX_MESSAGE(
MSC_RRC_ENB,
......@@ -591,7 +598,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete_NB(
DRB_ToAddModList_NB_r13_t* DRB_configList2 = ue_context_pP->ue_context.DRB_configList2[xid];
SRB_ToAddModList_NB_r13_t* SRB_configList2 = ue_context_pP->ue_context.SRB1_configList[xid]; //only SRB1
SRB_ToAddModList_NB_r13_t* SRB_configList2 = ue_context_pP->ue_context.SRB_configList2[xid];
T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
......@@ -623,39 +630,38 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete_NB(
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_pP->ue_context.rnti);
rrc_pdcp_config_asn1_req(
NB_rrc_pdcp_config_asn1_req(
ctxt_pP,
SRB_configList2, //SRB1_configList
SRB_configList2,
DRB_configList2,
(DRB_ToReleaseList_NB_r13_t *) NULL,
0xff, //security mode already configured during the securitymodecommand
kRRCenc,
kRRCint,
kUPenc
#if defined(Rel10) || defined(Rel14)
, (PMCH_InfoList_r9_t *) NULL //not needed
#endif
,NULL);
kUPenc,
NULL,
DCCH1); //SRB1
// Refresh SRBs/DRBs for RLC
rrc_rlc_config_asn1_req(
NB_rrc_rlc_config_asn1_req(
ctxt_pP,
SRB_configList2, //SRB1_configList
SRB_configList2,
DRB_configList2,
(DRB_ToReleaseList_NB_r13_t *) NULL
#if defined(Rel10) || defined(Rel14)
, (PMCH_InfoList_r9_t *) NULL //not needed
#endif
(DRB_ToReleaseList_NB_r13_t *) NULL,
SRB1BIS_FLAG_NO
);
// set the SRB active in Ue context
if (SRB_configList2 != NULL) {
for (i = 0; (i < SRB_configList2->list.count) && (i < 3); i++) { //FIXME why i<3??
//MP: SRB_ToAddModList_NB_r13_t size = 1 TS 36.331 V14.2.1 pag 615
//MP: may for loop is not needed --> should stop at first iteration
for (i = 0; (i < SRB_configList2->list.count) && (i < 3); i++) {
//no need of checking the srb-Identity
//we should have only SRB1 in the list
ue_context_pP->ue_context.Srb1.Active=1;
ue_context_pP->ue_context.Srb1.Srb_info.Srb_id=1; //LCHAN_iD
ue_context_pP->ue_context.Srb1.Srb_info.Srb_id=DCCH1; //LCHAN_iD
LOG_I(RRC,"[eNB %d] Frame %d CC %d : SRB1 is now active\n",
ctxt_pP->module_id,
ctxt_pP->frame,
......@@ -690,10 +696,10 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete_NB(
ue_context_pP->ue_context.DRB_active[drb_id] = 1;
LOG_D(RRC, //FIXME: RLC UM not exist in NB-IoT
"[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n",
LOG_D(RRC,
"[eNB %d] Frame %d: Establish RLC UM Bidirectional??, DRB %d Active\n",
ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList2->list.array[i]->drb_Identity_r13);
//FIXME: RLC UM not exist in NB-IoT and what means the stuff belows?
#if defined(PDCP_USE_NETLINK) && !defined(LINK_ENB_PDCP_TO_GTPV1U)
// can mean also IPV6 since ether -> ipv6 autoconf
# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET)
......@@ -740,53 +746,56 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete_NB(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
if (DRB_configList2->list.array[i]->logicalChannelIdentity_r13) {
//FIXME: to change
DRB2LCHAN[i] = (uint8_t) * DRB_configList2->list.array[i]->logicalChannelIdentity_r13;
DRB2LCHAN_NB[i] = (uint8_t) * DRB_configList2->list.array[i]->logicalChannelIdentity_r13; //set in RRCConnectionReconfiguration (x+3)
}
//for each DRB I send a rrc_mac_config_req
//FIXME: lots of unuseful parameters
rrc_mac_config_req(
NB_rrc_mac_config_req_eNB(
ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
ENB_FLAG_YES,
ue_context_pP->ue_context.rnti,
0,
(RadioResourceConfigCommonSIB_t *) NULL,
0,//physCellId --> this parameters could be set to 0 since no MIB is present
0,// p_eNB
0, //Ncp
0, //eutra_band
(struct NS_PmaxList_NB_r13*) NULL,
(struct MultiBandInfoList_NB_r13*) NULL,
(struct DL_Bitmap_NB_r13*) NULL,
(long*)NULL,//eutraControlRegionSize
(long*)NULL, //nrs_CRS_PowerOffset
(uint8_t*)NULL,
(uint16_t*)NULL,
0, //dl_CarrierFreq
0, //ul_CarrierFreq
(BCCH_BCH_Message_NB_t*)NULL,
(RadioResourceConfigCommonSIB_NB_r13_t*)NULL,
ue_context_pP->ue_context.physicalConfigDedicated_NB,
#if defined(Rel10) || defined(Rel14)
(SCellToAddMod_r10_t *)NULL,
//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
(MeasObjectToAddMod_t **) NULL,
ue_context_pP->ue_context.mac_MainConfig_NB,
DRB2LCHAN[i], //over the logical channel id of the DRB (>=4)
DRB_configList2->list.array[i]->logicalChannelConfig_r13,
(MeasGapConfig_t*)NULL,
(TDD_Config_t *) NULL,
(MeasGapConfig_t*)NULL,
(uint8_t *) NULL,
(uint16_t *) NULL, NULL, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL
#if defined(Rel10) || defined(Rel14)
, 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL
#endif
#ifdef CBA
, eNB_rrc_inst_NB[ctxt_pP->module_id].num_active_cba_groups, eNB_rrc_inst_NB[ctxt_pP->module_id].cba_rnti[0]
#endif
);
DRB2LCHAN_NB[i], //over the logical channel id of the DRB (>=4)
DRB_configList2->list.array[i]->logicalChannelConfig_r13
);
} else {
/*MP:
* This part of the code is wrong since a the list that we manage are ADD/MOD lists and not RELEASE lists
* so it means that nothing should be deleted but only modified!!
*/
} else { //remove LCHAN from MAC/PHY
//DRB_active could take values different from 0 and 1 for errors
//remove LCHAN from MAC/PHY
//MP: DRB_active could take values different from 0 and 1 for errors?
if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
// DRB has just been removed so remove RLC + PDCP for DRB
//why not from PDCP?
rrc_rlc_config_req(
// DRB has just been removed (by UE) so remove RLC + PDCP for DRB
//FIXME: MP: why not from PDCP?
NB_rrc_rlc_config_req(
ctxt_pP,
SRB_FLAG_NO,
MBMS_FLAG_NO,
CONFIG_ACTION_REMOVE,
DRB2LCHAN[i],//check
Rlc_info_um);
CONFIG_ACTION_REMOVE, //XXXmodify
DRB2LCHAN_NB[i],
Rlc_info_am); //XXX: should send a RLC_info_am--> RRC/vars_nb_iot.h //rlc_infoP
}
ue_context_pP->ue_context.DRB_active[drb_id] = 0;
......@@ -794,31 +803,30 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete_NB(
PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
rrc_mac_config_req(ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
ENB_FLAG_YES,
ue_context_pP->ue_context.rnti,
0,
(RadioResourceConfigCommonSIB_t *) NULL,
ue_context_pP->ue_context.physicalConfigDedicated_NB,
#if defined(Rel10) || defined(Rel14)
(SCellToAddMod_r10_t *)NULL,
//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
(MeasObjectToAddMod_t **) NULL,
(MeasGapConfig_t*)NULL,//?? should be MAc mainConfig
DRB2LCHAN[i],//check
(LogicalChannelConfig_t *) NULL,
(MeasGapConfig_t *) NULL,
(TDD_Config_t *) NULL,
NULL, (uint8_t *) NULL, (uint16_t *) NULL, NULL, NULL, NULL, NULL
#if defined(Rel10) || defined(Rel14)
, 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL
#endif
#ifdef CBA
, 0, 0
#endif
);
NB_rrc_mac_config_req_eNB(
ctxt_pP->module_id,
ue_context_pP->ue_context.primaryCC_id,
ue_context_pP->ue_context.rnti,
0,//physCellId --> this parameters could be set to 0 since no MIB is present
0,// p_eNB
0, //Ncp
0, //eutra_band
(struct NS_PmaxList_NB_r13*) NULL,
(struct MultiBandInfoList_NB_r13*) NULL,
(struct DL_Bitmap_NB_r13*) NULL,
(long*)NULL,//eutraControlRegionSize
(long*)NULL, //nrs_CRS_PowerOffset
(uint8_t*)NULL,
(uint16_t*)NULL,
0, //dl_CarrierFreq
0, //ul_CarrierFreq
(BCCH_BCH_Message_NB_t*)NULL,
(RadioResourceConfigCommonSIB_NB_r13_t*)NULL,
ue_context_pP->ue_context.physicalConfigDedicated_NB,
ue_context_pP->ue_context.mac_MainConfig_NB,
DRB2LCHAN_NB[i], //over the logical channel id of the DRB (>=4)
(LogicalChannelConfig_NB_r13_t*)NULL //MP: change this
);
}
}
}
......@@ -834,14 +842,15 @@ rrc_eNB_reconfigure_DRBs_NB(const protocol_ctxt_t* const ctxt_pP,
int i;
int e_rab_done=0;
//FIXME:to be check the number of e-rab and the parameter set over them
for (i = 0; i < 3;//NB_RB_MAX - 3; // S1AP_MAX_E_RAB
i++) {
if ( ue_context_pP->ue_context.e_rab[i].status < E_RAB_NB_STATUS_DONE){ // all those new e-rab
//TODO: MP: to be check the number of e-rab and the parameter set over them
for (i = 0; i < 2; i++) { //NB_RB_MAX - 3; // S1AP_MAX_E_RAB //MP: why 3??--> i think at most 2 DRB = at most 2 e-rab
if ( ue_context_pP->ue_context.e_rab[i].status < E_RAB_NB_STATUS_DONE){ // all those new e-rab ( E_RAB_NB_STATUS_NEW)
ue_context_pP->ue_context.e_rab[i].status = E_RAB_NB_STATUS_NEW;
ue_context_pP->ue_context.e_rab[i].param.e_rab_id = i + 1;
ue_context_pP->ue_context.e_rab[i].param.qos.qci = i % 9;
ue_context_pP->ue_context.e_rab[i].param.qos.qci = (i % 9) + 5; //FIXME: if NB-IoT work on non-GBR range (5-9)
ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level= i % PRIORITY_LEVEL_LOWEST;
ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_capability= PRE_EMPTION_CAPABILITY_DISABLED;
ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_vulnerability= PRE_EMPTION_VULNERABILITY_DISABLED;
......@@ -859,10 +868,14 @@ rrc_eNB_reconfigure_DRBs_NB(const protocol_ctxt_t* const ctxt_pP,
}
ue_context_pP->ue_context.setup_e_rabs+=e_rab_done;
//should be at most 2 DRBs set
if(ue_context_pP->ue_context.setup_e_rabs > 2)
LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT "e_context.setup_e_rabs > 2 but maxDRBs ==2", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_NB(ctxt_pP, ue_context_pP ); //no ho state
}
uint8_t qci_to_priority[9]={2,4,3,5,1,6,7,8,9}; //FIXME understand if used in NB_IoT
//-----------------------------------------------------------------------------
uint8_t qci_to_priority[9]={2,4,3,5,1,6,7,8,9}; //FIXME understand if used in NB_IoT (no GBR so only 5-9)
//-----------------------------------------------------------------------------
void //was under ITTI
......@@ -911,9 +924,7 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_NB(
dedicatedInfoNASList_NB = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_NB_r13_IEs__dedicatedInfoNASList_r13));
for ( i = 0 ;
i < ue_context_pP->ue_context.setup_e_rabs ; //max must be 2 DRBs that are established
i++){
for ( i = 0 ; i < ue_context_pP->ue_context.setup_e_rabs ; i++){ //max must be 2 DRBs that are established
// bypass the new and already configured erabs
if (ue_context_pP->ue_context.e_rab[i].status >= E_RAB_NB_STATUS_DONE) {
......@@ -924,7 +935,7 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_NB(
DRB_config = CALLOC(1, sizeof(*DRB_config));
DRB_config->eps_BearerIdentity_r13 = CALLOC(1, sizeof(long));
// allowed value 5..15, value : x+4
// allowed value 5..15, value : x+4 // e_rab_id setted previously in rrc_eNB_reconfigure_DRB_NB function
*(DRB_config->eps_BearerIdentity_r13) = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;// x+4; // especial case generation
DRB_config->drb_Identity_r13 = 1 + drb_identity_index + e_rab_done; //FIXME: max 2 DRBs could be established, x
......@@ -943,38 +954,18 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_NB(
//must be checked in TS 36.413 and TS 23.401 if this parameter exist for NB_IoT
switch (ue_context_pP->ue_context.e_rab[i].param.qos.qci){
/*
* type: realtime data with medium packer error rate
* action: swtich to RLC UM--->not possible in NB_IoT FIXME
*/
// case 1: // 100ms, 10^-2, p2, GBR
// case 2: // 150ms, 10^-3, p4, GBR
// case 3: // 50ms, 10^-3, p3, GBR
// case 4: // 300ms, 10^-6, p5
// case 7: // 100ms, 10^-3, p7, GBR
// case 9: // 300ms, 10^-6, p9
// case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR
// case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR
// // RLC
// DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional;
// DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
// DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10;
// DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35;
// // PDCP
// PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM));
// DRB_pdcp_config->rlc_UM = PDCP_rlc_UM;
// PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits;
// break;
//GBR is not supported by NB-IoT
/*
* type: non-realtime data with low packer error rate
* action: swtich to RLC AM
* action: switch to RLC AM
*/
case 5: // 100ms, 10^-6, p1 , IMS signaling
case 6: // 300ms, 10^-6, p6
case 8: // 300ms, 10^-6, p8
case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority
case 70: // 200ms, 10^-6, p5.5, mision critical data
case 70: // 200ms, 10^-6, p5.5, mission critical data
// RLC
DRB_rlc_config->present = RLC_Config_NB_r13_PR_am;
DRB_rlc_config->choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms250; //random
......@@ -983,6 +974,7 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_NB(
*(DRB_rlc_config->choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13)= DL_AM_RLC_NB_r13__enableStatusReportSN_Gap_r13_true;
// PDCP FIXME: something to set for PDCP?
break;
default :
......@@ -998,6 +990,7 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_NB(
DRB_config->logicalChannelConfig_r13 = DRB_lchan_config;
DRB_lchan_config->priority_r13 = CALLOC(1,sizeof(long));
if (ue_context_pP->ue_context.e_rab[i].param.qos.qci < 9 )
*(DRB_lchan_config->priority_r13) = qci_to_priority[ue_context_pP->ue_context.e_rab[i].param.qos.qci-1] + 3;//FIXME ??
else
......@@ -1109,7 +1102,7 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_NB(
rrc_eNB_mui,
size);
rrc_data_req(
NB_rrc_data_req(
ctxt_pP,
DCCH1,//through SRB1
rrc_eNB_mui++,
......@@ -1118,7 +1111,6 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_NB(
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
}
//-----------------------------------------------------------------------------
......@@ -1131,10 +1123,12 @@ rrc_eNB_process_RRCConnectionSetupComplete_NB(
//-----------------------------------------------------------------------------
{
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing RRCConnectionSetupComplete_NB from UE (SRB1bis Active)\n",
PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing RRCConnectionSetupComplete_NB from UE (SRB1bis/SRB1 Active)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
ue_context_pP->ue_context.Srb1bis.Active=1; //SRB1bis active for UE, from eNB point of view
ue_context_pP->ue_context.Srb1.Active=1 //SRB1 active for UE (implicitly activated)
T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
......@@ -1145,7 +1139,7 @@ rrc_eNB_process_RRCConnectionSetupComplete_NB(
rrc_eNB_send_S1AP_NAS_FIRST_REQ(
ctxt_pP,
ue_context_pP,
rrcConnectionSetupComplete_NB);
rrcConnectionSetupComplete_NB); ///TODO: look at NAS messages
} else
#endif
{
......@@ -1164,6 +1158,12 @@ rrc_eNB_generate_SecurityModeCommand_NB(
)
//-----------------------------------------------------------------------------
{
/* R2-163262 3GPP NB-IOT Ad-hoc Meeting #2
* The SRB1-bis (no PDCP) is used for SecurityModeCommand and SecurityModeFailure messages
* The SRB1 (full PDCP) is used for SecurityModeComplete message
*/
uint8_t buffer[100];
uint8_t size;
......@@ -1189,7 +1189,7 @@ rrc_eNB_generate_SecurityModeCommand_NB(
#endif
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n",
PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate SecurityModeCommand-NB (bytes %d)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
size);
......@@ -1198,7 +1198,7 @@ rrc_eNB_generate_SecurityModeCommand_NB(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
size,
rrc_eNB_mui,
DCCH0); //i'm using SRB1bis
DCCH0); //MP: SRB1bis
MSC_LOG_TX_MESSAGE(
MSC_RRC_ENB,
......@@ -1211,14 +1211,14 @@ rrc_eNB_generate_SecurityModeCommand_NB(
rrc_eNB_mui,
size);
rrc_data_req( //to PDCP
NB_rrc_data_req( //to PDCP
ctxt_pP,
DCCH0,//through SRB1bis
DCCH0,//MP:through SRB1bis
rrc_eNB_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
PDCP_TRANSMISSION_MODE_TRANSPARENT);
}
......@@ -1230,6 +1230,7 @@ rrc_eNB_generate_UECapabilityEnquiry_NB(
)
//-----------------------------------------------------------------------------
{
//TODO: Clarify: this message is also called when we receive SecurityModeFailure--> we should continue to use SRB1bis?
uint8_t buffer[100];
uint8_t size;
......@@ -1265,14 +1266,14 @@ rrc_eNB_generate_UECapabilityEnquiry_NB(
rrc_eNB_mui,
size);
rrc_data_req( //to PDCP
NB_rrc_data_req( //to PDCP
ctxt_pP,
DCCH0,//through SRB1bis
DCCH1, //FIXME SRB1 or SRB1bis? depends if successful security activation by UE
rrc_eNB_mui++,
SDU_CONFIRM_NO,
size,
buffer,
PDCP_TRANSMISSION_MODE_CONTROL);
PDCP_TRANSMISSION_MODE_CONTROL);//XXX MP: no more transparent to PDCP // SRB1 was registered to the pdcp at the beginning
}
......@@ -1327,9 +1328,9 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
// Configure SRB1
// Configure/ Refresh SRB1
/// SRB1
SRB_configList2=&ue_context_pP->ue_context.SRB1_configList[xid]; //List that contains only SRB1
SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid];
if (*SRB_configList2) {
free(*SRB_configList2);
}
......@@ -1340,7 +1341,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config));
SRB1_config->rlc_Config_r13 = SRB1_rlc_config;
//parameters values set as in the TS 36.331 specs
//parameters values set as in the TS 36.331 specs ( pag 640)
SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue;
SRB1_rlc_config->choice.explicitValue.present = RLC_Config_NB_r13_PR_am;
SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000;
......@@ -1361,7 +1362,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
SRB1_lchan_config->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit;
// this list has the configuration for SRB1 and SRB1bis
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB1_config); //FIXME: cannot do that because SRB_ToAddModList_NB_r13_t max size = 1
//XXX: Problems ? because SRB_ToAddModList_NB_r13_t max size = 1
ASN_SEQUENCE_ADD(&SRB_configList->list, SRB1_config);
// this list has only the configuration for SRB1
ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB1_config);
......@@ -1376,7 +1378,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
*DRB_configList = CALLOC(1, sizeof(**DRB_configList));
memset(*DRB_configList, 0, sizeof(**DRB_configList));
// list for the configured DRB for a this xid
// list for the configured DRB for this xid (transaction id)
DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid];
if (*DRB_configList2) {
free(*DRB_configList2);
......@@ -1386,28 +1388,29 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
/// DRB (maxDRBs = 2)
DRB_config = CALLOC(1, sizeof(*DRB_config));
DRB_config->eps_BearerIdentity_r13 = CALLOC(1, sizeof(long));
//i'm not sure that in NB-IoT the first 0..4 eps-bearerIdentity will be reserved for NSAPI
//FIXME: MP: I'm not sure that in NB-IoT the first 0..4 eps-bearerIdentity will be reserved for NSAPI (NEtwork Service Access Point Identifier)
*(DRB_config->eps_BearerIdentity_r13) = 5L; // LW set to first value, allowed value 5..15, value : x+4
// NN: this is the 1st DRB for this ue, so set it to 1
// NN/MP: this is the 1st DRB for this ue, so set it to 1
DRB_config->drb_Identity_r13 = (DRB_Identity_t) 1; //allowed values INTEGER (1..32), value: x
DRB_config->logicalChannelIdentity_r13 = CALLOC(1, sizeof(long));
//logical channel identity =3 is reserved for SRB1bis, seee TS 36.331 pag 616
//MP: logical channel identity =3 is reserved for SRB1bis, seee TS 36.331 pag 616
*(DRB_config->logicalChannelIdentity_r13) = (long)4; //allowed value (4..10), value : x+3
DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config));
DRB_config->rlc_Config_r13 = DRB_rlc_config;
//#ifdef RRC_DEFAULT_RAB_IS_AM --> is the only allowed mode in NB-IoT
//set as TS 36.331 specs
///RLC-AM
DRB_rlc_config->present = RLC_Config_NB_r13_PR_am;
DRB_rlc_config->choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000;
DRB_rlc_config->choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t4;
DRB_rlc_config->choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 = enableStatusReportSN_Gap;
//#else
//#endif
///PDCP
DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config));
DRB_config->pdcp_Config_r13 = DRB_pdcp_config;
DRB_pdcp_config->discardTimer_r13 = CALLOC(1, sizeof(long));
......@@ -1422,11 +1425,14 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
DRB_lchan_config->priority_r13 = CALLOC(1, sizeof(long));
*(DRB_lchan_config->priority_r13) = 12; // lower priority than srb1, srb1bis and other dedicated bearer
DRB_lchan_config->logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit;//FIXME: for DRB should be used?
//Add the DRB in both list
ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config);
ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config);
///Mac_MainConfig
mac_MainConfig_NB = CALLOC(1, sizeof(*mac_MainConfig_NB));
ue_context_pP->ue_context.mac_MainConfig_NB = mac_MainConfig_NB;
......@@ -1445,18 +1451,26 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
//no phr_config
//FIXME not know if should be used and if well initialized
mac_MainConfig_NB->logicalChannelSR_Config_r13 = CALLOC(1, sizeof(struct MAC_MainConfig_NB_r13__logicalChannelSR_Config_r13));
mac_MainConfig_NB->logicalChannelSR_Config_r13->present = MAC_MainConfig_NB_r13__logicalChannelSR_Config_r13_PR_setup;
//depends if previously activated
mac_MainConfig_NB->logicalChannelSR_Config_r13->choice.setup.logicalChannelSR_ProhibitTimer_r13 =
MAC_MainConfig_NB_r13__logicalChannelSR_Config_r13__setup__logicalChannelSR_ProhibitTimer_r13_pp2; //value in PP=PDCCH periods
struct PhysicalConfigDedicated ciao;
if (*physicalConfigDedicated_NB) {
//FIXME: which value should be configured of phisical config dedicated?
//TODO: which value should be configured of phisical config dedicated?
//antennaInfo not present in PhysicalConfigDedicated for NB_IoT
//cqi reporting is not present in PhysicalConfigDedicated for NB_IoT
/*
* carrierConfigDedicated_r13
* npdcch_ConfigDedicated_r13
* npusch_ConfigDedicated_r13
* uplinkPowerControlDedicated_r13
*/
}
else {
LOG_E(RRC,"physical_config_dedicated not present in RRCConnectionReconfiguration-NB. Not reconfiguring!\n");
......@@ -1468,7 +1482,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
//no Sparams
//no handover
//#if defined(ENABLE_ITTI).....correct?
//#if defined(ENABLE_ITTI).....
/* Initialize NAS list */
dedicatedInfoNASList_NB = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_NB_r13_IEs__dedicatedInfoNASList_r13));
......@@ -1483,7 +1498,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
ASN_SEQUENCE_ADD(&dedicatedInfoNASList_NB->list, dedicatedInfoNas);
}
/* TODO parameters yet to process ... */
/*OLD TODO parameters yet to process ... */
{
// ue_context_pP->ue_context.e_rab[i].param.qos;
// ue_context_pP->ue_context.e_rab[i].param.sgw_addr;
......@@ -1555,7 +1570,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
rrc_eNB_mui,
size);
rrc_data_req( //to PDCP
NB_rrc_data_req( //to PDCP
ctxt_pP,
DCCH1,//through SRB1
rrc_eNB_mui++,
......@@ -1565,38 +1580,71 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration_NB(const protocol_ctxt_t* c
PDCP_TRANSMISSION_MODE_CONTROL);
}
/*-----------------CONFIGURATION-------------------*/
//-----------------------------------------------------------------------------
static void
init_SI_NB(
const protocol_ctxt_t* const ctxt_pP,
const int CC_id,
RrcConfigurationReq * configuration
RrcConfigurationReq* configuration
)
//-----------------------------------------------------------------------------
{
uint8_t SIwindowsize = 1;
uint16_t SIperiod = 8;
#if defined(Rel10) || defined(Rel14)
int i;
#endif
//FIXME do_MIB_NB? put here?
//FIXME: MP: may this two parameters are not needed
uint8_t SIwindowsize = 1; //frame
uint16_t SIperiod = 8; // in frames
//copy basic parameters
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].physCellId = configuration->Nid_cell[CC_id];
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].p_eNB = configuration->nb_antenna_ports[CC_id];
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].Ncp = configuration->prefix_type[CC_id];
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id];
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id];
//TODO: verify who allocate memory for sib1_NB, sib2_NB, sib3_NB and mib_nb in the carrier before being passed as parameter
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1_NB = 0;
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB23_NB = 0;
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].SIB1_NB = (uint8_t*) malloc16(32);//allocation of buffer memory for SIB
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sizeof_MIB_NB = 0;
//MIB
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].MIB_NB = (uint8_t*) malloc16(32); //MIB is 34 bits=5bytes needed
//FIXME do_MIB_NB parameters
if (eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].MIB_NB)
{
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sizeof_MIB_NB =
do_MIB_NB(&eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id],
configuration->N_RB_DL,
0
);
}
else {
LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for MIB_NB allocated\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
mac_xface->macphy_exit("[RRC][init_SI] FATAL, no memory for MIB_NB allocated");
}
if (eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sizeof_MIB_NB == 255) {
mac_xface->macphy_exit("[RRC][init_SI] FATAL, eNB_rrc_inst_NB[enb_mod_idP].carrier[CC_id].sizeof_MIB_NB == 255");
}
//SIB1_NB
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].SIB1_NB = (uint8_t*) malloc16(32);//allocation of buffer memory for SIB1_NB
if (eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].SIB1_NB)
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1_NB =
do_SIB1_NB( //follow the new implementation
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB1_NB = do_SIB1_NB( //follow the new implementation
ctxt_pP->module_id,
CC_id,
&eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id], //FIXME correct?
&eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id],
configuration
);
//FIXME: verify who allocate moemory for sib1_NB in the carrier before being passed as parameter
else {
LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1_NB allocated\n",
......@@ -1608,16 +1656,16 @@ init_SI_NB(
mac_xface->macphy_exit("[RRC][init_SI] FATAL, eNB_rrc_inst_NB[enb_mod_idP].carrier[CC_id].sizeof_SIB1_NB == 255");
}
//SIB23_NB
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].SIB23_NB = (uint8_t*) malloc16(64);
if (eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].SIB23_NB) {
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB23_NB = do_SIB23_NB(
ctxt_pP->module_id,
CC_id,
&eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id], //correct?
&eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id],
configuration
);
//FIXME: verify who allocate memory for sib2_NB and sib3_NB in the carrier before being passed as parameter
if (eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sizeof_SIB23_NB == 255) {
mac_xface->macphy_exit("[RRC][init_SI] FATAL, eNB_rrc_inst_NB[mod].carrier[CC_id].sizeof_SIB23_NB == 255");
......@@ -1626,57 +1674,49 @@ init_SI_NB(
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
/*decide which parameter to show....*/
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" npusch_config_common.groupHoppingEnabled = %d\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
(int)eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib2_NB->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.
ul_ReferenceSignalsNPUSCH_r13.groupHoppingEnabled_r13);
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" npusch_config_common.groupAssignmentNPUSCH = %ld\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib2_NB->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.
ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13);
/*FIXME: decide which parameter to show....*/
LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" TODO: some parameter of SIB23-NB to show\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
//Use the following as an example
// LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" npusch_config_common.groupAssignmentNPUSCH = %ld\n",
// PROTOCOL_RRC_CTXT_ARGS(ctxt_pP),
// eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib2_NB->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.
// ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13);
//no MBMS flag and NO sib13
//Configure MAC
LOG_D(RRC,
PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1_NB & SIB2_NB params) ---> MAC_UE\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
//check
rrc_mac_config_req(ctxt_pP->module_id, CC_id, ENB_FLAG_YES, 0, 0,
(RadioResourceConfigCommonSIB_t *) &
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib2_NB->radioResourceConfigCommon_r13,
(struct PhysicalConfigDedicated_NB_r13_t *)NULL,
#if defined(Rel10) || defined(Rel14)
(SCellToAddMod_r10_t *)NULL,
//(struct PhysicalConfigDedicatedSCell_r10 *)NULL,
#endif
(MeasObjectToAddMod_t **) NULL,
(MAC_MainConfig_t *) NULL, 0,//check logical channel identity
(struct LogicalChannelConfig_NB_r13_t *)NULL,
(MeasGapConfig_t *) NULL,
(TDD_Config_t*)NULL,
NULL,
&SIwindowsize, &SIperiod,
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib2_NB->freqInfo_r13.ul_CarrierFreq_r13,
0, //FIXME must be defined
&eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib2_NB->freqInfo_r13.additionalSpectrumEmission_r13,
(MBSFN_SubframeConfigList_t*)NULL //not defined
#if defined(Rel10) || defined(Rel14)
,
eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].MBMS_flag,
(MBSFN_AreaInfoList_r9_t*) & eNB_rrc_inst[ctxt_pP->module_id].carrier[CC_id].sib13->mbsfn_AreaInfoList_r9,
(PMCH_InfoList_r9_t *) NULL
#endif
#ifdef CBA
, 0, //eNB_rrc_inst_NB[ctxt_pP->module_id].num_active_cba_groups,
0 //eNB_rrc_inst_NB[ctxt_pP->module_id].cba_rnti[0]
#endif
);
//
NB_rrc_mac_config_req_eNB(ctxt_pP->module_id,
CC_id,
0,//rnti
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].physCellId,
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].p_eNB,
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].Ncp,
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib1_NB->freqBandIndicator_r13,
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib1_NB->freqBandInfo_r13,
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib1_NB->multiBandInfoList_r13,
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib1_NB->downlinkBitmap_r13,
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib1_NB->eutraControlRegionSize_r13,
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib1_NB->nrs_CRS_PowerOffset_r13,
&SIwindowsize,
&SIperiod,
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].dl_CarrierFreq,
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].ul_CarrierFreq,
(BCCH_BCH_Message_NB_t*) &
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].mib_NB,
(RadioResourceConfigCommonSIB_NB_r13_t *) &
eNB_rrc_inst_NB[ctxt_pP->module_id].carrier[CC_id].sib2_NB->radioResourceConfigCommon_r13,
(struct PhysicalConfigDedicated_NB_r13_t *)NULL,
(MAC_MainConfig_NB_r13_t *) NULL,
0,// MP:logicalChannelID //TODO still have to be properly managed in the interface
(struct LogicalChannelConfig_NB_r13_t *)NULL
);
} else {
LOG_E(RRC, PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB2/3_NB allocated\n",
PROTOCOL_RRC_CTXT_ARGS(ctxt_pP));
......@@ -1689,7 +1729,7 @@ init_SI_NB(
char
openair_rrc_eNB_configuration_NB(
const module_id_t enb_mod_idP,
RrcConfigurationReq* configuration
RrcConfigurationReq* configuration //FIXME MP: previously was insiede ITTI but actually I put it out
)
//-----------------------------------------------------------------------------
{
......@@ -1716,12 +1756,8 @@ while ( eNB_rrc_inst_NB == NULL ) {
eNB_rrc_inst_NB[ctxt.module_id].carrier[CC_id].Srb0.Active = 0;
}
uid_linear_allocator_init(&eNB_rrc_inst_NB[ctxt.module_id].uid_allocator);
uid_linear_allocator_init_NB(&eNB_rrc_inst_NB[ctxt.module_id].uid_allocator); //rrc_eNB_UE_context
RB_INIT(&eNB_rrc_inst_NB[ctxt.module_id].rrc_ue_head);
// for (j = 0; j < (NUMBER_OF_UE_MAX + 1); j++) {
// eNB_rrc_inst_NB[enb_mod_idP].Srb2[j].Active = 0;
// }
eNB_rrc_inst_NB[ctxt.module_id].initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL);
eNB_rrc_inst_NB[ctxt.module_id].s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL);
......@@ -1733,7 +1769,7 @@ while ( eNB_rrc_inst_NB == NULL ) {
LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Checking release \n",
PROTOCOL_RRC_CTXT_ARGS(&ctxt));
LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" NB-IoT Relxx detected\n",PROTOCOL_RRC_CTXT_ARGS(&ctxt));
LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" NB-IoT Rel13 detected\n",PROTOCOL_RRC_CTXT_ARGS(&ctxt));
//no CBA
......@@ -1742,20 +1778,27 @@ while ( eNB_rrc_inst_NB == NULL ) {
init_SI_NB(&ctxt, CC_id,configuration);
}
/*New implementation Raymond*/
//MP: NEW defined in rrc_common_nb_iot.h // no more called in MAC/main.c but directly here
//rrc_init_global_param_NB();
#ifdef NO_RRM //init ch SRB0, SRB1 & BDTCH
openair_rrc_on(&ctxt); //FIXME: rrc_common.c --> to be changed
#else
eNB_rrc_inst_NB[ctxt.module_id].Last_scan_req = 0; //rrm_2_rrc_msg.c
send_msg(&S_rrc, msg_rrc_phy_synch_to_MR_ind(ctxt.module_id, eNB_rrc_inst_NB[ctxt.module_id].Mac_id));
#endif
//XXX following the old implementation: openair_rrc_top_init is called in MAC/main.c
//FIXME: this probably would create some bug for the following reaon:
//in the onld implementation this function was called in the MAC/main.c
//actually is called here --> we are allocating memory so maybe we generate some problems
//openair_rrc_top_init_eNB_NB();
//init ch SRB0, SRB1 & BDTCH
openair_eNB_rrc_on_NB(&ctxt);
return 0;
}
/*-----STATE MACHINE---------------*/
/*-----------------STATE MACHINE---------------*/
//-----------------------------------------------------------------------------
int
......@@ -1800,12 +1843,11 @@ rrc_eNB_decode_ccch_NB(
0,
0);
//could be deleted?
//#if defined(ENABLE_ITTI)....
//# if defined(DISABLE_ITTI_XER_PRINT)...
for (i = 0; i < 8; i++) { //why 8?
for (i = 0; i < 8; i++) { //MP: FIXME why 8?
LOG_T(RRC, "%x.", ((uint8_t *) & ul_ccch_msg_NB)[i]);
}
......@@ -1873,12 +1915,12 @@ rrc_eNB_decode_ccch_NB(
//for the moment we only reject
rrc_eNB_generate_RRCConnectionReestablishmentReject_NB(ctxt_pP,
rrc_eNB_get_ue_context(&eNB_rrc_inst_NB[ctxt_pP->module_id], ctxt_pP->rnti),
rrc_eNB_get_ue_context_NB(&eNB_rrc_inst_NB[ctxt_pP->module_id], ctxt_pP->rnti),
CC_id);
break;
case UL_CCCH_MessageType_NB__c1_PR_rrcConnectionRequest_r13:
case UL_CCCH_MessageType_NB__c1_PR_rrcConnectionRequest_r13: //MSG3
T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
......@@ -1895,12 +1937,11 @@ rrc_eNB_decode_ccch_NB(
PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND (rrcConnectionRequest-NB on SRB0) --> RRC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
ue_context_p = rrc_eNB_get_ue_context( //should be changed in order to pass a eNB_RRC_INST_NB
ue_context_p = rrc_eNB_get_ue_context_NB( //XXX define new function in rrc_eNB_UE_context
&eNB_rrc_inst_NB[ctxt_pP->module_id],
ctxt_pP->rnti);
if (ue_context_p != NULL) {
//no make sense to receive a connectionRequest when I have already the UE context
if (ue_context_p != NULL) { //MP: i receive a ConnectionRequest from a UE which have already a context
// erase content
rrc_eNB_free_mem_UE_context_NB(ctxt_pP, ue_context_p);
......@@ -1919,6 +1960,7 @@ rrc_eNB_decode_ccch_NB(
{
if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest_NB->ue_Identity_r13.present) {
//InitialUE-Identity randomValue size should be 40bits = 5 byte
AssertFatal(rrcConnectionRequest_NB->ue_Identity_r13.choice.randomValue.size == 5,
"wrong InitialUE-Identity randomValue size, expected 5, provided %d",
rrcConnectionRequest_NB->ue_Identity_r13.choice.randomValue.size);
......@@ -1934,7 +1976,7 @@ rrc_eNB_decode_ccch_NB(
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);
rrc_mac_remove_ue(ctxt_pP->module_id, ctxt_pP->rnti);
NB_rrc_mac_remove_ue(ctxt_pP->module_id, ctxt_pP->rnti);
ue_context_p = NULL;
return 0;
} else {
......@@ -1949,11 +1991,12 @@ rrc_eNB_decode_ccch_NB(
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);
rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti);
NB_rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti);
stmsi_received=1;
/* replace rnti in the context */
/* for that, remove the context from the RB tree */
///FIXME MP: warning --> implicit declaration because I insert the new type "rrc_ue_tree_NB_s"
RB_REMOVE(rrc_ue_tree_NB_s, &eNB_rrc_inst_NB[ctxt_pP->module_id].rrc_ue_head, ue_context_p);
/* and insert again, after changing rnti everywhere it has to be changed */
ue_context_p->ue_id_rnti = ctxt_pP->rnti;
......@@ -1995,7 +2038,7 @@ rrc_eNB_decode_ccch_NB(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
rrc_eNB_generate_RRCConnectionReject_NB(ctxt_pP,
rrc_eNB_get_ue_context(&eNB_rrc_inst_NB[ctxt_pP->module_id], ctxt_pP->rnti),
rrc_eNB_get_ue_context_NB(&eNB_rrc_inst_NB[ctxt_pP->module_id], ctxt_pP->rnti),
CC_id);
break;
}
......@@ -2009,7 +2052,7 @@ rrc_eNB_decode_ccch_NB(
if (ue_context_p != NULL) {
//#if defined(ENABLE_ITTI) //FIXME: check if correct
//#if defined(ENABLE_ITTI)
ue_context_p->ue_context.establishment_cause_NB = rrcConnectionRequest_NB->establishmentCause_r13;
if (stmsi_received==0){
LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %ld\n",
......@@ -2039,39 +2082,28 @@ rrc_eNB_decode_ccch_NB(
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),
random_value);
rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti);
NB_rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti);
return -1;
}
}
#ifndef NO_RRM
send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id));
#else
//XXX MP: RRM not used
//#ifndef NO_RRM
// send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id));
//#else
ue_context_p->ue_context.primaryCC_id = CC_id;
//FIXME : Transaction id = channel identity??, defs.h MAc to be changed, LCHAN_DESC to be changed
Idx = DCCH0;
// SRB1bis (LCID = 3 = DCCH0)
ue_context_p->ue_context.Srb1bis.Active = 1;
ue_context_p->ue_context.Srb1bis.Srb_info.Srb_id = Idx; //module_id
ue_context_p->ue_context.Srb1bis.Srb_info.Srb_id = DCCH0;
memcpy(&ue_context_p->ue_context.Srb1bis.Srb_info.Lchan_desc[0],
&DCCH_LCHAN_DESC,
&DCCH_LCHAN_DESC,//FIXME MP: LCHAN_DESC (mac_rrc_primitives) to be changed
LCHAN_DESC_SIZE);
memcpy(&ue_context_p->ue_context.Srb1bis.Srb_info.Lchan_desc[1],
&DCCH_LCHAN_DESC,
LCHAN_DESC_SIZE);
//FIXME: SRB1: set it to go through SRB1bis with id 3 (DCCH0) ???
ue_context_p->ue_context.Srb1.Active = 1;
ue_context_p->ue_context.Srb1bis.Srb_info.Srb_id = Idx;
memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0],
&DCCH_LCHAN_DESC,
LCHAN_DESC_SIZE);
memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1],
&DCCH_LCHAN_DESC,
LCHAN_DESC_SIZE);
//generate RRCConnectionSetup-NB
rrc_eNB_generate_RRCConnectionSetup_NB(ctxt_pP, ue_context_p, CC_id);
......@@ -2088,38 +2120,40 @@ rrc_eNB_decode_ccch_NB(
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti);
//we are configuring PDCP and RC only for SRB1bis
//to be checked
rrc_pdcp_config_asn1_req(ctxt_pP,
ue_context_p->ue_context.SRB_configList, //check
//XXX we should not configure PDCP for SRB1bis but only for SRB1 (we do it now?)
NB_rrc_pdcp_config_asn1_req(ctxt_pP,
ue_context_p->ue_context.SRB_configList, //contain SRB1bis but used as SRB1
(DRB_ToAddModList_NB_r13_t *) NULL,
(DRB_ToReleaseList_NB_r13_t*) NULL,
0xff,
NULL,
NULL,
NULL
# if defined(Rel10) || defined(Rel14)
, (PMCH_InfoList_r9_t *) NULL
# endif
,NULL);
NULL,
NULL,
DCCH1);
//to be checked
rrc_rlc_config_asn1_req(ctxt_pP,
ue_context_p->ue_context.SRB_configList,//check
///MP: Configure RLC for SRB1bis
NB_rrc_rlc_config_asn1_req(ctxt_pP,
ue_context_p->ue_context.SRB_configList,
(DRB_ToAddModList_NB_r13_t*) NULL,
(DRB_ToReleaseList_NB_r13_t*) NULL
# if defined(Rel10) || defined(Rel14)
, (PMCH_InfoList_r9_t *) NULL
# endif
(DRB_ToReleaseList_NB_r13_t*) NULL,
SRB1BIS_FLAG_YES
);
#endif //NO_RRM
//MP: Configure RLC for SRB1
NB_rrc_rlc_config_asn1_req(ctxt_pP,
ue_context_p->ue_context.SRB_configList,
(DRB_ToAddModList_NB_r13_t*) NULL,
(DRB_ToReleaseList_NB_r13_t*) NULL,
SRB1BIS_FLAG_NO
);
//#endif //NO_RRM
break;
break; //RRCConnectionSetup-NB
case UL_CCCH_MessageType_NB__c1_PR_rrcConnectionResumeRequest_r13:
// or accept the resume, or switch back to a Connection setup or reject the request
// TS 36.331 accept the resume, or switch back to a Connection setup or reject the request
T(T_ENB_RRC_CONNECTION_RESUME_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), //non so se funziona
T(T_ENB_RRC_CONNECTION_RESUME_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
#ifdef RRC_MSG_PRINT
......@@ -2147,7 +2181,7 @@ rrc_eNB_decode_ccch_NB(
//only reject for now
rrc_eNB_generate_RRCConnectionReject_NB(ctxt_pP,
rrc_eNB_get_ue_context(&eNB_rrc_inst_NB[ctxt_pP->module_id], ctxt_pP->rnti),
rrc_eNB_get_ue_context_NB(&eNB_rrc_inst_NB[ctxt_pP->module_id], ctxt_pP->rnti),
CC_id);
break;
......@@ -2172,7 +2206,7 @@ rrc_eNB_decode_ccch_NB(
int
rrc_eNB_decode_dcch_NB(
const protocol_ctxt_t* const ctxt_pP,
const rb_id_t Srb_id, //may not used
const rb_id_t Srb_id, //Dcch_index
const uint8_t* const Rx_sdu,
const sdu_size_t sdu_sizeP
)
......@@ -2191,7 +2225,7 @@ rrc_eNB_decode_dcch_NB(
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
//FIXME : depends on how SRBs are managed
if ((Srb_id != 1) && (Srb_id != 2)) {
if ((Srb_id != 1) && (Srb_id != 3)) {
LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%d, should not have ...\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
Srb_id);
......@@ -2205,15 +2239,15 @@ rrc_eNB_decode_dcch_NB(
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP));
dec_rval = uper_decode(
NULL,
&asn_DEF_UL_DCCH_Message,
&asn_DEF_UL_DCCH_Message_NB,
(void**)&ul_dcch_msg_NB,
Rx_sdu,
sdu_sizeP,
0,
0);
//delete?
/*#if defined(ENABLE_ITTI)
//TODO:delete?
#if defined(ENABLE_ITTI)
# if defined(DISABLE_ITTI_XER_PRINT)
{
MessageDef *message_p;
......@@ -2229,7 +2263,7 @@ rrc_eNB_decode_dcch_NB(
size_t message_string_size;
if ((message_string_size =
xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message_NB, (void *)ul_dcch_msg)) >= 0) {
xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message_NB, (void *)ul_dcch_msg_NB)) >= 0) {
MessageDef *msg_p;
msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_DCCH, message_string_size + sizeof(IttiMsgText));
......@@ -2241,7 +2275,7 @@ rrc_eNB_decode_dcch_NB(
}
# endif
#endif
*/
{
for (i = 0; i < sdu_sizeP; i++) {
......@@ -2258,7 +2292,7 @@ rrc_eNB_decode_dcch_NB(
return -1;
}
ue_context_p = rrc_eNB_get_ue_context(
ue_context_p = rrc_eNB_get_ue_context_NB(
&eNB_rrc_inst_NB[ctxt_pP->module_id],
ctxt_pP->rnti);
......@@ -2301,14 +2335,15 @@ rrc_eNB_decode_dcch_NB(
if (ul_dcch_msg_NB->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.criticalExtensions.
present == RRCConnectionReconfigurationComplete_NB__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r13) {
/*NN: revise the condition */
if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){
//XXX MP: RRC_RECONFIGURED indicate if the default/dedicated bearer has been/has been not established
if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){ // a dedicated bearers has been established
dedicated_DRB = 1;
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg_NB->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.rrc_TransactionIdentifier);
}else {
}else { //a default bearer has been established
dedicated_DRB = 0;
ue_context_p->ue_context.Status = RRC_RECONFIGURED; //see below--> in this way i can establish the DRB
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg_NB->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.rrc_TransactionIdentifier);
......@@ -2328,7 +2363,6 @@ rrc_eNB_decode_dcch_NB(
#endif
}
//#if defined(ENABLE_ITTI)...
#if defined(ENABLE_USE_MME)
if (EPC_MODE_ENABLED == 1) {
......@@ -2341,12 +2375,10 @@ rrc_eNB_decode_dcch_NB(
ue_context_p);
}
}
#else // establish a dedicated bearer
#else // MP: ENABLE_USE_MME ??
if (dedicated_DRB == 0 ) {
// ue_context_p->ue_context.e_rab[0].status = E_RAB_NB_STATUS_ESTABLISHED;
rrc_eNB_reconfigure_DRBs_NB(ctxt_pP,ue_context_p);
rrc_eNB_reconfigure_DRBs_NB(ctxt_pP,ue_context_p); //MP: establish a dedicated DRB
}
#endif
break;
......@@ -2386,6 +2418,8 @@ rrc_eNB_decode_dcch_NB(
break;
case UL_DCCH_MessageType_NB__c1_PR_rrcConnectionSetupComplete_r13:
//XXX MP: Ts 36.331 V14.2.1 RRCConnectionSetupComplete is transmitted over SRB1bis (pag 585)
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"[MSG] RRCConnectionSetupComplete-NB\n");
......@@ -2410,7 +2444,7 @@ rrc_eNB_decode_dcch_NB(
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(RRCConnectionSetupComplete-NB) ---> RRC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH,//check
DCCH0,//SRB1bis
sdu_sizeP);
if (ul_dcch_msg_NB->message.choice.c1.choice.rrcConnectionSetupComplete_r13.criticalExtensions.present ==
......@@ -2442,6 +2476,12 @@ rrc_eNB_decode_dcch_NB(
break;
case UL_DCCH_MessageType_NB__c1_PR_securityModeComplete_r13:
/* R2-163262 3GPP NB-IOT Ad-hoc Meeting #2
* After receiving the SMC and performing the security activation, the UE shall use the SRB1.
* If the UE fails the security activation, the UE shall use the SRB1-bis for Security Mode Complete message failure
*/
T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
......@@ -2478,6 +2518,7 @@ rrc_eNB_decode_dcch_NB(
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_UL_DCCH_Message_NB, (void *)ul_dcch_msg_NB);
#endif
//XXX MP: ???
// confirm with PDCP about the security mode for DCCH
//rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77);
// continue the procedure
......@@ -2486,6 +2527,22 @@ rrc_eNB_decode_dcch_NB(
break;
case UL_DCCH_MessageType_NB__c1_PR_securityModeFailure_r13:
//MP: Security Mode failure should be received over SRB1bis since the security activation fails
/*(see R2-163262)
The SRB1-bis (no PDCP) is used for SecurityModeCommand and SecurityModeFailure messages,
The SRB1 (full PDCP) is used for SecurityModeComplete message.*/
/*
* Furthermore from TS 36.331 ch:5.3.4.3 Reception of the SecurityModeCommand by the UE
* if the SecurityModeCommand message passes the integrity protection check
* ....
* else
* 2> continue using the configuration used prior to the reception of the SecurityModeCommand message,
* i.e. neither apply integrity protection nor ciphering.
* 2> submit the SecurityModeFailure message to lower layers for transmission, upon which the procedure ends
*/
T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
......@@ -2513,20 +2570,24 @@ rrc_eNB_decode_dcch_NB(
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(securityModeFailure-NB) ---> RRC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH,//Check
DCCH0,
sdu_sizeP);
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_UL_DCCH_Message_NB, (void *)ul_dcch_msg_NB);
#endif
// cancel the security mode in PDCP??
// followup with the remaining procedure
//#warning "LG Removed rrc_eNB_generate_UECapabilityEnquiry after receiving securityModeFailure"
//XXX MP: make sense to go ahead with the procedure without security? --> means that we should continue to use SRB1bis?
rrc_eNB_generate_UECapabilityEnquiry_NB(ctxt_pP, ue_context_p);
break;
case UL_DCCH_MessageType_NB__c1_PR_ueCapabilityInformation_r13:
//XXX message received over SRB1
T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
......@@ -2553,26 +2614,27 @@ rrc_eNB_decode_dcch_NB(
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation-NB on UL-DCCH %d from UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH0);//through SRB1bis
DCCH1);
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(UECapabilityInformation) ---> RRC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH0,//through SRB1bis
DCCH1,
sdu_sizeP);
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_UL_DCCH_Message_NB, (void *)ul_dcch_msg);
#endif
LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti);
//FIXME ueCapabilityInformation different w.r.t LTE --> how to decode it?
//FIXME MP: ueCapabilityInformation different w.r.t LTE --> how to decode it?
dec_rval = uper_decode(NULL,
&asn_DEF_UE_Capability_NB_r13,
(void **)&UE_Capability_NB,
Rx_sdu, //is not correct should find the buffer size for this message
sdu_sizeP, //is not correct should find the buffer size for this message
0,
0);
Rx_sdu, //*buffer//FIXME may this is not the best way (may incorrect)
sdu_sizeP,//*size //FIXME may this is not the best way (may incorrect)
0, //skip bits
0); //unused bits
#if defined(ENABLE_USE_MME)
......@@ -2587,7 +2649,7 @@ rrc_eNB_decode_dcch_NB(
for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++){
ue_context_p->ue_context.e_rab[i].status = E_RAB_NB_STATUS_NEW;
ue_context_p->ue_context.e_rab[i].param.e_rab_id = 1+i;
ue_context_p->ue_context.e_rab[i].param.qos.qci=9;
ue_context_p->ue_context.e_rab[i].param.qos.qci=9; //Non-GBR the default value (TS
}
ue_context_p->ue_context.setup_e_rabs =ue_context_p->ue_context.nb_of_e_rabs;
#endif
......@@ -2694,8 +2756,9 @@ rrc_eNB_decode_dcch_NB(
}
//-----------------------------------------------------------------------------
//put out from the ITTI FIXME is completely based on ITTI--> must be changed (msg_p, itti_receive_msg ecc...)
void*
rrc_enb_task_NB( ///FIXME is completely based on ITTI--> must be changed (msg_p, itti_receive_msg ecc...)
rrc_enb_task_NB(
void* args_p
)
//-----------------------------------------------------------------------------
......@@ -2766,7 +2829,7 @@ rrc_enb_task_NB( ///FIXME is completely based on ITTI--> must be changed (msg_p,
RRC_DCCH_DATA_IND(msg_p).dcch_index,
msg_name_p);
rrc_eNB_decode_dcch_NB(&ctxt,
RRC_DCCH_DATA_IND(msg_p).dcch_index, //srb_id -->may not used for NB-IoT
RRC_DCCH_DATA_IND(msg_p).dcch_index, //3 if SRB1bis and 1 for SRB1
RRC_DCCH_DATA_IND(msg_p).sdu_p, //rx_sdu
RRC_DCCH_DATA_IND(msg_p).sdu_size);
......
......@@ -36,11 +36,6 @@
#include "COMMON/mac_rrc_primitives.h"
#include "LAYER2/MAC/defs.h"
//for NB_IoT-------
#include "defs_nb_iot.h"
eNB_RRC_INST_NB *eNB_rrc_inst_NB;
//--------------------
eNB_RRC_INST *eNB_rrc_inst;
UE_RRC_INST *UE_rrc_inst;
//RRC_XFACE *Rrc_xface;
......@@ -68,8 +63,7 @@ unsigned short Data_to_read;
#define MAX_U32 0xFFFFFFFF
uint8_t DRB2LCHAN[8]; //max can be 2 DRBs for NB_IoT --> it used for saving the LCID of DRBs
uint8_t DRB2LCHAN[8];
long logicalChannelGroup0 = 0;
long logicalChannelSR_Mask_r9=0;
......@@ -107,7 +101,10 @@ LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue = {ul_SpecificPara
};
//CONSTANTS
rlc_info_t Rlc_info_um,Rlc_info_am_config;
rlc_info_t Rlc_info_um,Rlc_info_am_config,
//NB-IoT
Rlc_info_am;
uint16_t RACH_FREQ_ALLOC;
//uint8_t NB_RACH;
LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file vars_nb_iot.c
* \brief rrc variables for NB_IoT
* \author Raymond Knopp, Navid Nikaein and Michele Paffetti
* \date 2013 -2017
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr, michele.paffetti@studio.unibo.it
*/
//#ifndef __OPENAIR_RRC_VARS_NB_H__
//#define __OPENAIR_RRC_VARS_NB_H__
#include "defs_nb_iot.h"
#include "LAYER2/RLC/rlc.h"
#include "COMMON/mac_rrc_primitives.h"
#include "LAYER2/MAC/defs_nb_iot.h"
#include "LogicalChannelConfig-NB-r13.h"
//UE_RRC_INST *UE_rrc_inst; //MP: may not used for the moment
#ifndef USER_MODE
#ifndef NO_RRM
int S_rrc= RRC2RRM_FIFO;
#endif //NO_RRM
#else
#include "LAYER2/MAC/extern.h"
#ifndef NO_RRM
sock_rrm_t S_rrc;
#endif
#endif
#ifndef NO_RRM
#ifndef USER_MODE
char *Header_buf;
char *Data;
unsigned short Header_read_idx,Data_read_idx,Header_size;
#endif
unsigned short Data_to_read;
#endif //NO_RRM
#include "LAYER2/MAC/extern.h"
#define MAX_U32 0xFFFFFFFF
//LogicalChannelConfig__ext1 logicalChannelSR_Mask_r9_ext1--> not defined for NB-IoT
eNB_RRC_INST_NB *eNB_rrc_inst_NB;
uint8_t DRB2LCHAN_NB[2];//max can be 2 DRBs for NB_IoT --> it used for saving the LCID of DRBs
BOOLEAN_t logicalChannelSR_Prohibit = 1;
long priority =1;
// Default SRB configurations from 36.331 (9.2.1.1 pag 641 V14.2.1)
struct LogicalChannelConfig_NB_r13 SRB1bis_NB_logicalChannelConfig_defaultValue = {
priority_r13: &priority, //priority
logicalChannelSR_Prohibit_r13: &logicalChannelSR_Prohibit //set to TRUE
};
struct LogicalChannelConfig_NB_r13 SRB1_NB_logicalChannelConfig_defaultValue = {
priority_r13: &priority, //priority
logicalChannelSR_Prohibit_r13: &logicalChannelSR_Prohibit //set to TRUE
};
//CONSTANTS
rlc_info_t Rlc_info_um,Rlc_info_am_config, Rlc_info_am;
uint16_t RACH_FREQ_ALLOC;
//TODO: MP: to e changed --> mac_rrc_primitives
LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC;
//XXX //MP:May not needed
//MAC_MEAS_T BCCH_MEAS_TRIGGER,CCCH_MEAS_TRIGGER,DCCH_MEAS_TRIGGER,DTCH_MEAS_TRIGGER;
//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
uint16_t T300[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 T310[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 N310[8] = {1,2,3,4,6,8,10,20};
uint16_t N311[8] = {1,2,3,4,5,6,8,10};
// MP: TimeToTrigger not used in NB-IoT
/* MP: 36.133 Section 9.1.4 RSRP Measurement Report Mapping and RSRQ Mapping, Table: 9.1.4-1 --> not for NB-IoT*/
//#endif
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