Commit 45df334d authored by Navid Nikaein's avatar Navid Nikaein

Sync feature-39-X2-handover changes with the latest develop and merge into a new branch

parent c124e32a
...@@ -412,7 +412,15 @@ add_library(S1AP_ENB ...@@ -412,7 +412,15 @@ add_library(S1AP_ENB
#X2AP #X2AP
# Same limitation as described in RRC/S1AP: unknown generated file list # Same limitation as described in RRC/S1AP: unknown generated file list
# so we generate it at cmake time # so we generate it at cmake time
############## ########################################
# X2AP LAYER OPTIONS
##########################
add_boolean_option(ENABLE_USE_X2 True "Enable X2 interface for X2 hanodover")
if (${ENABLE_USE_X2})
#message("-- X2AP = ${ENABLE_USE_X2}")
add_list1_option(X2AP_VERSION R11 "X2AP Asn.1 grammar version" R10 R11) add_list1_option(X2AP_VERSION R11 "X2AP Asn.1 grammar version" R10 R11)
set(X2AP_DIR ${OPENAIR2_DIR}/X2AP) set(X2AP_DIR ${OPENAIR2_DIR}/X2AP)
if (${X2AP_VERSION} STREQUAL "R11") if (${X2AP_VERSION} STREQUAL "R11")
...@@ -466,15 +474,30 @@ add_custom_command ( ...@@ -466,15 +474,30 @@ add_custom_command (
DEPENDS ${X2AP_ASN_FILES} DEPENDS ${X2AP_ASN_FILES}
) )
add_library(X2AP_LIB add_library(X2AP_MSG_LIB
${X2AP_OAI_generated} ${X2AP_OAI_generated}
${X2AP_source} ${X2AP_source}
${X2AP_DIR}/x2ap_common.c ${X2AP_DIR}/x2ap_common.c
) )
set(X2AP_LIB X2AP_MSG_LIB)
include_directories ("${X2AP_C_DIR}") include_directories ("${X2AP_C_DIR}")
include_directories ("${X2AP_DIR}") include_directories ("${X2AP_DIR}")
add_library(X2AP_ENB_LIB
${X2AP_C_DIR}/x2ap_ies_defs.h
${X2AP_DIR}/x2ap_eNB.c
${X2AP_DIR}/x2ap_eNB_decoder.c
${X2AP_DIR}/x2ap_eNB_encoder.c
${X2AP_DIR}/x2ap_eNB_handler.c
${X2AP_DIR}/x2ap_eNB_itti_messaging.c
${X2AP_DIR}/x2ap_eNB_management_procedures.c
${X2AP_DIR}/x2ap_eNB_generate_messages.c
)
set(X2AP_ENB X2AP_ENB_LIB)
endif()
# Hardware dependant options # Hardware dependant options
################################### ###################################
add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4") add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
...@@ -745,6 +768,7 @@ add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "Otherwise it is UM, confi ...@@ -745,6 +768,7 @@ add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "Otherwise it is UM, confi
########################## ##########################
# none # none
########################## ##########################
# PROJECTS (IST, FRENCH COLL., etc) # PROJECTS (IST, FRENCH COLL., etc)
# SPECIFIC OPTIONS # SPECIFIC OPTIONS
...@@ -1917,7 +1941,7 @@ add_executable(oaisim ...@@ -1917,7 +1941,7 @@ add_executable(oaisim
target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim target_link_libraries (oaisim
-Wl,-ldl,--start-group -Wl,-ldl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} LIB_NAS_UE SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} RRC_LIB S1AP_LIB S1AP_ENB ${X2AP_LIB} ${X2AP_ENB} GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} LIB_NAS_UE SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB}
-Wl,--end-group ) -Wl,--end-group )
target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
...@@ -1960,11 +1984,11 @@ add_executable(oaisim_nos1 ...@@ -1960,11 +1984,11 @@ add_executable(oaisim_nos1
target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim_nos1 target_link_libraries (oaisim_nos1
-Wl,--start-group -Wl,--start-group
RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 RRC_LIB ${X2AP_LIB} ${X2AP_ENB} SECU_CN UTIL HASHTABLE SCHED_LIB PHY LFDS ${MSC_LIB} L2 ${RAL_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 SCTP_CLIENT UDP
-Wl,--end-group ) -Wl,--end-group )
target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries (oaisim_nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${option_HW_lib} ${option_TP_lib} target_link_libraries (oaisim_nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_HW_lib} ${option_TP_lib}
${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES})
#Force link with forms, regardless XFORMS option #Force link with forms, regardless XFORMS option
target_link_libraries (oaisim_nos1 forms) target_link_libraries (oaisim_nos1 forms)
...@@ -2015,7 +2039,7 @@ add_executable(test_epc_generate_scenario ...@@ -2015,7 +2039,7 @@ add_executable(test_epc_generate_scenario
${OPENAIR_BIN_DIR}/messages_xml.h ${OPENAIR_BIN_DIR}/messages_xml.h
) )
target_link_libraries (test_epc_generate_scenario target_link_libraries (test_epc_generate_scenario
-Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB ${X2AP_LIB} ${X2AP_ENB} GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
) )
add_executable(test_epc_play_scenario add_executable(test_epc_play_scenario
...@@ -2036,7 +2060,7 @@ add_executable(test_epc_play_scenario ...@@ -2036,7 +2060,7 @@ add_executable(test_epc_play_scenario
) )
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
target_link_libraries (test_epc_play_scenario target_link_libraries (test_epc_play_scenario
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} -Wl,--start-group RRC_LIB S1AP_LIB ${X2AP_LIB} ${X2AP_ENB} GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
) )
......
...@@ -1639,5 +1639,41 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB, ...@@ -1639,5 +1639,41 @@ int phy_init_lte_eNB(PHY_VARS_eNB *eNB,
} // node_function != NGFI_RRU_IF4p5 } // node_function != NGFI_RRU_IF4p5
return (0); return (0);
}
// Configure ue state in case of handover
void phy_config_ue_state_ho(uint8_t Mod_id,uint8_t CC_id,uint16_t rnti){
uint32_t k,j;
int UE_id = find_UE_id(Mod_id,rnti);
if(UE_id==-1){
printf("Program exited: phy_config_ue_state_ho: UE does not exist\n");
exit(-1);
}
LOG_I(PHY, "ho called for eNB %d CC %d rnti %x UE_id %d\n", Mod_id, CC_id, rnti, UE_id);
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].mode = PUSCH;
PHY_vars_eNB_g[Mod_id][CC_id]->ulsch[UE_id]->Msg3_flag = 0;
// HARQ processes
for (k=0; k<8; k++){ //harq_processes
for (j=0; j<PHY_vars_eNB_g[Mod_id][CC_id]->dlsch[UE_id][0]->Mdlharq; j++) {
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].dlsch_NAK[k][j]=0;
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].dlsch_ACK[k][j]=0;
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].dlsch_trials[k][j]=0;
}
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].dlsch_l2_errors[k]=0;
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].ulsch_errors[k]=0;
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].ulsch_consecutive_errors=0;
for (j=0; j<8; j++) {
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].ulsch_decoding_attempts[k][j]=0;
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].ulsch_decoding_attempts_last[k][j]=0;
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].ulsch_round_errors[k][j]=0;
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].ulsch_round_fer[k][j]=0;
}
}
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].dlsch_sliding_cnt=0;
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].dlsch_NAK_round0=0;
PHY_vars_eNB_g[Mod_id][CC_id]->UE_stats[UE_id].dlsch_mcs_offset=0;
} }
...@@ -207,6 +207,7 @@ int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index); ...@@ -207,6 +207,7 @@ int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
uint32_t get_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index); uint32_t get_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
uint32_t get_RSRQ(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index); uint32_t get_RSRQ(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
uint8_t get_n_adj_cells(module_id_t Mod_id,uint8_t CC_id); uint8_t get_n_adj_cells(module_id_t Mod_id,uint8_t CC_id);
uint16_t get_nid_cell(uint8_t Mod_id,uint8_t CC_id);
uint32_t get_rx_total_gain_dB(module_id_t Mod_id,uint8_t CC_id); uint32_t get_rx_total_gain_dB(module_id_t Mod_id,uint8_t CC_id);
uint32_t get_RSSI(module_id_t Mod_id,uint8_t CC_id); uint32_t get_RSSI(module_id_t Mod_id,uint8_t CC_id);
int8_t set_RSRP_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp); int8_t set_RSRP_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp);
......
...@@ -165,6 +165,11 @@ int8_t set_RSRQ_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rs ...@@ -165,6 +165,11 @@ int8_t set_RSRQ_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rs
} }
uint16_t get_nid_cell(uint8_t Mod_id,uint8_t CC_id){
LTE_DL_FRAME_PARMS *fp = &PHY_vars_UE_g[Mod_id][CC_id]->frame_parms;
return fp->Nid_cell;
}
void ue_rrc_measurements(PHY_VARS_UE *ue, void ue_rrc_measurements(PHY_VARS_UE *ue,
uint8_t slot, uint8_t slot,
uint8_t abstraction_flag) uint8_t abstraction_flag)
......
...@@ -44,6 +44,7 @@ typedef struct { ...@@ -44,6 +44,7 @@ typedef struct {
long long p_time; /*!< \brief absolute process duration */ long long p_time; /*!< \brief absolute process duration */
long long diff_square; /*!< \brief process duration square */ long long diff_square; /*!< \brief process duration square */
long long max; long long max;
long long min;
int trials; int trials;
int meas_flag; int meas_flag;
} time_stats_t; } time_stats_t;
...@@ -55,6 +56,7 @@ typedef struct { ...@@ -55,6 +56,7 @@ typedef struct {
uint32_t p_time; /*!< \brief absolute process duration */ uint32_t p_time; /*!< \brief absolute process duration */
uint32_t diff_square; /*!< \brief process duration square */ uint32_t diff_square; /*!< \brief process duration square */
uint32_t max; uint32_t max;
uint32_t min;
int trials; int trials;
} time_stats_t; } time_stats_t;
...@@ -127,7 +129,11 @@ static inline void stop_meas(time_stats_t *ts) ...@@ -127,7 +129,11 @@ static inline void stop_meas(time_stats_t *ts)
if ((out-ts->in) > ts->max) if ((out-ts->in) > ts->max)
ts->max = out-ts->in; ts->max = out-ts->in;
if ((out-ts->in) < ts->min)
ts->min = out-ts->in;
ts->meas_flag=0; ts->meas_flag=0;
} }
} }
......
...@@ -928,7 +928,8 @@ typedef struct { ...@@ -928,7 +928,8 @@ typedef struct {
SLIST_HEAD(ral_thresholds_gen_poll_s, ral_threshold_phy_t) ral_thresholds_gen_polled[RAL_LINK_PARAM_GEN_MAX]; SLIST_HEAD(ral_thresholds_gen_poll_s, ral_threshold_phy_t) ral_thresholds_gen_polled[RAL_LINK_PARAM_GEN_MAX];
SLIST_HEAD(ral_thresholds_lte_poll_s, ral_threshold_phy_t) ral_thresholds_lte_polled[RAL_LINK_PARAM_LTE_MAX]; SLIST_HEAD(ral_thresholds_lte_poll_s, ral_threshold_phy_t) ral_thresholds_lte_polled[RAL_LINK_PARAM_LTE_MAX];
#endif #endif
// UE prach state for handover
uint8_t prach_ho;
} PHY_VARS_UE; } PHY_VARS_UE;
void exit_fun(const char* s); void exit_fun(const char* s);
......
...@@ -1430,13 +1430,19 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB ...@@ -1430,13 +1430,19 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
#endif #endif
stop_meas(&ue->ulsch_encoding_stats); stop_meas(&ue->ulsch_encoding_stats);
if(ue->prach_ho){
ue->UE_mode[eNB_id] = PUSCH;
ue->prach_ho = 0;
}
if (ue->mac_enabled == 1) { if (ue->mac_enabled == 1) {
// signal MAC that Msg3 was sent // signal MAC that Msg3 was sent
mac_xface->Msg3_transmitted(Mod_id, mac_xface->Msg3_transmitted(Mod_id,
CC_id, CC_id,
frame_tx, frame_tx,
eNB_id); eNB_id,
ue->UE_mode[eNB_id]);
} }
} // Msg3_flag==1 } // Msg3_flag==1
else { else {
...@@ -3243,7 +3249,8 @@ void process_rar(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, runmode_t mo ...@@ -3243,7 +3249,8 @@ void process_rar(PHY_VARS_UE *ue, UE_rxtx_proc_t *proc, int eNB_id, runmode_t mo
dlsch0->harq_processes[0]->b, dlsch0->harq_processes[0]->b,
&ue->pdcch_vars[subframe_rx & 0x1][eNB_id]->crnti, &ue->pdcch_vars[subframe_rx & 0x1][eNB_id]->crnti,
ue->prach_resources[eNB_id]->ra_PreambleIndex, ue->prach_resources[eNB_id]->ra_PreambleIndex,
dlsch0->harq_processes[0]->b); // alter the 'b' buffer so it contains only the selected RAR header and RAR payload dlsch0->harq_processes[0]->b,
ue->prach_ho); // alter the 'b' buffer so it contains only the selected RAR header and RAR payload
ue->pdcch_vars[(subframe_rx+1) & 0x1][eNB_id]->crnti = ue->pdcch_vars[subframe_rx & 0x1][eNB_id]->crnti; ue->pdcch_vars[(subframe_rx+1) & 0x1][eNB_id]->crnti = ue->pdcch_vars[subframe_rx & 0x1][eNB_id]->crnti;
...@@ -4171,17 +4178,20 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u ...@@ -4171,17 +4178,20 @@ void phy_procedures_UE_lte(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,u
LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",ue->Mod_id, LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, returning to PRACH\n",ue->Mod_id,
frame_rx,subframe_tx); frame_rx,subframe_tx);
ue->UE_mode[eNB_id] = PRACH; ue->UE_mode[eNB_id] = PRACH;
ue->prach_ho = 0;
// mac_xface->macphy_exit("Connection lost"); // mac_xface->macphy_exit("Connection lost");
} else if (ret == PHY_RESYNCH) { } else if (ret == PHY_RESYNCH) {
LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, trying to resynch\n", LOG_E(PHY,"[UE %d] Frame %d, subframe %d RRC Connection lost, trying to resynch\n",
ue->Mod_id, ue->Mod_id,
frame_rx,subframe_tx); frame_rx,subframe_tx);
ue->UE_mode[eNB_id] = RESYNCH; ue->UE_mode[eNB_id] = RESYNCH;
ue->prach_ho = 0;
// mac_xface->macphy_exit("Connection lost"); // mac_xface->macphy_exit("Connection lost");
} else if (ret == PHY_HO_PRACH) { } else if (ret == PHY_HO_PRACH) {
LOG_I(PHY,"[UE %d] Frame %d, subframe %d, return to PRACH and perform a contention-free access\n", LOG_I(PHY,"[UE %d] Frame %d, subframe %d, return to PRACH and perform a contention-free access\n",
ue->Mod_id,frame_rx,subframe_tx); ue->Mod_id,frame_rx,subframe_tx);
ue->UE_mode[eNB_id] = PRACH; ue->UE_mode[eNB_id] = PRACH;
ue->prach_ho = 1;
} }
} }
} }
......
...@@ -107,6 +107,7 @@ typedef enum cn_domain_s { ...@@ -107,6 +107,7 @@ typedef enum cn_domain_s {
typedef struct net_ip_address_s { typedef struct net_ip_address_s {
unsigned ipv4:1; unsigned ipv4:1;
unsigned ipv6:1; unsigned ipv6:1;
unsigned active:1;
char ipv4_address[16]; char ipv4_address[16];
char ipv6_address[46]; char ipv6_address[46];
} net_ip_address_t; } net_ip_address_t;
......
/* /*******************************************************************************
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more OpenAirInterface
* contributor license agreements. See the NOTICE file distributed with Copyright(c) 1999 - 2014 Eurecom
* 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
*/
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/* eNB application layer -> X2AP messages */
/* ITTI LOG messages */
/* ENCODER */
MESSAGE_DEF(X2AP_RESET_REQUST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_reset_request_log)
MESSAGE_DEF(X2AP_RESOURCE_STATUS_RESPONSE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_resource_status_response_log)
MESSAGE_DEF(X2AP_RESOURCE_STATUS_FAILURE_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_resource_status_failure_log)
/* Messages for X2AP logging */
MESSAGE_DEF(X2AP_SETUP_REQUEST_LOG , MESSAGE_PRIORITY_MED, IttiMsgText , x2ap_setup_request_log)
/* eNB application layer -> X2AP messages */
MESSAGE_DEF(X2AP_REGISTER_ENB_REQ , MESSAGE_PRIORITY_MED, x2ap_register_enb_req_t , x2ap_register_enb_req)
/* X2AP -> eNB application layer messages */
MESSAGE_DEF(X2AP_REGISTER_ENB_CNF , MESSAGE_PRIORITY_MED, x2ap_register_enb_cnf_t , x2ap_register_enb_cnf)
MESSAGE_DEF(X2AP_DEREGISTERED_ENB_IND , MESSAGE_PRIORITY_MED, x2ap_deregistered_enb_ind_t , x2ap_deregistered_enb_ind)
/* handover messages X2AP <-> RRC */
MESSAGE_DEF(X2AP_HANDOVER_REQ , MESSAGE_PRIORITY_MED, x2ap_handover_req_t , x2ap_handover_req)
MESSAGE_DEF(X2AP_HANDOVER_RESP , MESSAGE_PRIORITY_MED, x2ap_handover_resp_t , x2ap_handover_resp)
/* /*******************************************************************************
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more OpenAirInterface
* contributor license agreements. See the NOTICE file distributed with Copyright(c) 1999 - 2014 Eurecom
* 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
*/
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#ifndef X2AP_MESSAGES_TYPES_H_
#define X2AP_MESSAGES_TYPES_H_
#include "PhysCellId.h"
//-------------------------------------------------------------------------------------------//
// Defines to access message fields.
#define X2AP_REGISTER_ENB_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_register_enb_req
#define X2AP_HANDOVER_REQ(mSGpTR) (mSGpTR)->ittiMsg.x2ap_handover_req
#define X2AP_HANDOVER_RESP(mSGpTR) (mSGpTR)->ittiMsg.x2ap_handover_resp
#define X2AP_REGISTER_ENB_CNF(mSGpTR) (mSGpTR)->ittiMsg.x2ap_register_enb_cnf
#define X2AP_DEREGISTERED_ENB_IND(mSGpTR) (mSGpTR)->ittiMsg.x2ap_deregistered_enb_ind
#define X2AP_MAX_NB_ENB_IP_ADDRESS 2
// eNB application layer -> X2AP messages
typedef struct x2ap_register_enb_req_s {
/* Unique eNB_id to identify the eNB within EPC.
* For macro eNB ids this field should be 20 bits long.
* For home eNB ids this field should be 28 bits long.
*/
uint32_t eNB_id;
/* The type of the cell */
enum cell_type_e cell_type;
/* Optional name for the cell
* NOTE: the name can be NULL (i.e no name) and will be cropped to 150
* characters.
*/
char *eNB_name;
/* Tracking area code */
uint16_t tac;
/* Mobile Country Code
* Mobile Network Code
*/
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
/*
* EARFCN
*/
uint16_t fdd_uL_EARFCN;
uint16_t fdd_dL_EARFCN;
uint16_t tdd_EARFCN;
uint16_t fdd_uL_Transmission_Bandwidth;
uint16_t fdd_dL_Transmission_Bandwidth;
uint16_t tdd_Transmission_Bandwidth;
/* The local eNB IP address to bind */
net_ip_address_t enb_x2_ip_address;
/* Nb of MME to connect to */
uint8_t nb_x2;
/* List of target eNB to connect to for X2*/
net_ip_address_t target_enb_x2_ip_address[X2AP_MAX_NB_ENB_IP_ADDRESS];
/* Number of SCTP streams used for associations */
uint16_t sctp_in_streams;
uint16_t sctp_out_streams;
} x2ap_register_enb_req_t;
//-------------------------------------------------------------------------------------------//
// X2AP -> eNB application layer messages
typedef struct x2ap_register_enb_cnf_s {
/* Nb of connected eNBs*/
uint8_t nb_x2;
} x2ap_register_enb_cnf_t;
typedef struct x2ap_deregistered_enb_ind_s {
/* Nb of connected eNBs */
uint8_t nb_x2;
} x2ap_deregistered_enb_ind_t;
//-------------------------------------------------------------------------------------------//
// X2AP <-> RRC
typedef struct x2ap_handover_req_s {
int source_rnti; /* TODO: to be fixed/remove */
int source_x2id; /* TODO: to be fixed/remove */
PhysCellId_t target_physCellId;
/* TODO: this parameter has to be removed */
int target_mod_id;
} x2ap_handover_req_t;
typedef struct x2ap_handover_resp_s {
int source_rnti; /* TODO: to be fixed/remove */
int source_x2id; /* TODO: to be fixed/remove */
/* TODO: this parameter has to be removed */
int target_mod_id;
} x2ap_handover_resp_t;
#endif /* X2AP_MESSAGES_TYPES_H_ */
...@@ -48,7 +48,11 @@ ...@@ -48,7 +48,11 @@
# include "sctp_eNB_task.h" # include "sctp_eNB_task.h"
# include "gtpv1u_eNB_task.h" # include "gtpv1u_eNB_task.h"
# endif # endif
# if defined(ENABLE_USE_X2)
# include "x2ap_eNB.h"
//# include "sctp_eNB_task.h"
//# include "gtpv1u_eNB_task.h"
#endif
#if defined(FLEXRAN_AGENT_SB_IF) #if defined(FLEXRAN_AGENT_SB_IF)
# include "flexran_agent.h" # include "flexran_agent.h"
#endif #endif
...@@ -63,6 +67,10 @@ extern unsigned char NB_eNB_INST; ...@@ -63,6 +67,10 @@ extern unsigned char NB_eNB_INST;
# define ENB_REGISTER_RETRY_DELAY 10 # define ENB_REGISTER_RETRY_DELAY 10
# endif # endif
# if defined(ENABLE_USE_X2)
# define X2AP_ENB_REGISTER_RETRY_DELAY 10
#endif
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
static void configure_phy(module_id_t enb_id, const Enb_properties_array_t* enb_properties) static void configure_phy(module_id_t enb_id, const Enb_properties_array_t* enb_properties)
{ {
...@@ -193,7 +201,7 @@ static void configure_rrc(uint32_t enb_id, const Enb_properties_array_t *enb_pro ...@@ -193,7 +201,7 @@ static void configure_rrc(uint32_t enb_id, const Enb_properties_array_t *enb_pro
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
# if defined(ENABLE_USE_MME) # if defined(ENABLE_USE_MME)
static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end, const Enb_properties_array_t *enb_properties) static uint32_t eNB_app_register_s1(uint32_t enb_id_start, uint32_t enb_id_end, const Enb_properties_array_t *enb_properties)
{ {
uint32_t enb_id; uint32_t enb_id;
uint32_t mme_id; uint32_t mme_id;
...@@ -265,6 +273,87 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end, con ...@@ -265,6 +273,87 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end, con
return register_enb_pending; return register_enb_pending;
} }
# endif # endif
/*------------------------------------------------------------------------------*/
# if defined(ENABLE_USE_X2)
static uint32_t eNB_app_register_x2(uint32_t enb_id_start, uint32_t enb_id_end,
const Enb_properties_array_t *enb_properties)
{
uint32_t enb_id;
uint32_t x2_id;
MessageDef *msg_p;
uint32_t register_enb_x2_pending = 0;
char *str = NULL;
struct in_addr addr;
# if defined(OAI_EMU)
# endif
for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) {
# if defined(OAI_EMU)
if (oai_emulation.info.cli_start_enb[enb_id] == 1)
# endif
{
x2ap_register_enb_req_t *x2ap_register_eNB;
msg_p = itti_alloc_new_message (TASK_ENB_APP, X2AP_REGISTER_ENB_REQ);
x2ap_register_eNB = &X2AP_REGISTER_ENB_REQ(msg_p);
/* Some default/random parameters */
x2ap_register_eNB->eNB_id = enb_properties->properties[enb_id]->eNB_id;
x2ap_register_eNB->cell_type = enb_properties->properties[enb_id]->cell_type;
x2ap_register_eNB->eNB_name = enb_properties->properties[enb_id]->eNB_name;
x2ap_register_eNB->tac = enb_properties->properties[enb_id]->tac;
x2ap_register_eNB->mcc = enb_properties->properties[enb_id]->mcc;
x2ap_register_eNB->mnc = enb_properties->properties[enb_id]->mnc;
x2ap_register_eNB->mnc_digit_length = enb_properties->properties[enb_id]->mnc_digit_length;
x2ap_register_eNB->nb_x2 = enb_properties->properties[enb_id]->nb_x2;
AssertFatal (x2ap_register_eNB->nb_x2 <= X2AP_MAX_NB_ENB_IP_ADDRESS,
"Too many X2 interfaces for eNB %d (%d/%d)!",
enb_id, x2ap_register_eNB->nb_x2,
X2AP_MAX_NB_ENB_IP_ADDRESS);
for (x2_id = 0; x2_id < x2ap_register_eNB->nb_x2; x2_id++) {
x2ap_register_eNB->target_enb_x2_ip_address[x2_id].ipv4 = enb_properties->properties[enb_id]->target_enb_x2_ip_address[x2_id].ipv4;
x2ap_register_eNB->target_enb_x2_ip_address[x2_id].ipv6 = enb_properties->properties[enb_id]->target_enb_x2_ip_address[x2_id].ipv6;
strncpy (x2ap_register_eNB->target_enb_x2_ip_address[x2_id].ipv4_address,
enb_properties->properties[enb_id]->target_enb_x2_ip_address[x2_id].ipv4_address,
sizeof(x2ap_register_eNB->target_enb_x2_ip_address[0].ipv4_address));
strncpy (x2ap_register_eNB->target_enb_x2_ip_address[x2_id].ipv6_address,
enb_properties->properties[enb_id]->target_enb_x2_ip_address[x2_id].ipv6_address,
sizeof(x2ap_register_eNB->target_enb_x2_ip_address[0].ipv6_address));
// this is used to identify whether this eNb is acting as an initiator (client) or listener (server)
x2ap_register_eNB->target_enb_x2_ip_address[x2_id].active = enb_properties->properties[enb_id]->target_enb_x2_ip_address[x2_id].active;
}
x2ap_register_eNB->sctp_in_streams = enb_properties->properties[enb_id]->sctp_in_streams;
x2ap_register_eNB->sctp_out_streams = enb_properties->properties[enb_id]->sctp_out_streams;
x2ap_register_eNB->enb_x2_ip_address.ipv6 = 0;
x2ap_register_eNB->enb_x2_ip_address.ipv4 = 1;
addr.s_addr = enb_properties->properties[enb_id]->enb_ipv4_address_for_X2C;
str = inet_ntoa(addr);
strcpy(x2ap_register_eNB->enb_x2_ip_address.ipv4_address, str);
itti_send_msg_to_task (TASK_X2AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
register_enb_x2_pending++;
}
}
return register_enb_x2_pending;
}
# endif
#endif #endif
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
...@@ -276,9 +365,14 @@ void *eNB_app_task(void *args_p) ...@@ -276,9 +365,14 @@ void *eNB_app_task(void *args_p)
uint32_t enb_id_start = 0; uint32_t enb_id_start = 0;
uint32_t enb_id_end = enb_id_start + enb_nb; uint32_t enb_id_end = enb_id_start + enb_nb;
# if defined(ENABLE_USE_MME) # if defined(ENABLE_USE_MME)
uint32_t register_enb_pending; uint32_t register_enb_pending; // s1ap
uint32_t registered_enb; uint32_t registered_enb;
long enb_register_retry_timer_id; long enb_register_retry_timer_id;
# endif
# if defined(ENABLE_USE_X2)
uint32_t x2_register_enb_pending;
uint32_t x2_registered_enb;
long x2_enb_register_retry_timer_id;
# endif # endif
uint32_t enb_id; uint32_t enb_id;
MessageDef *msg_p = NULL; MessageDef *msg_p = NULL;
...@@ -332,6 +426,19 @@ void *eNB_app_task(void *args_p) ...@@ -332,6 +426,19 @@ void *eNB_app_task(void *args_p)
itti_send_msg_to_task(TASK_L2L1, INSTANCE_DEFAULT, msg_p); itti_send_msg_to_task(TASK_L2L1, INSTANCE_DEFAULT, msg_p);
# endif # endif
# if defined(ENABLE_USE_X2)
enb_nb = oai_emulation.info.nb_enb_local;
enb_id_start = oai_emulation.info.first_enb_local;
enb_id_end = oai_emulation.info.first_enb_local + enb_nb;
/* Try to register each eNB with each other */
x2_registered_enb = 0;
x2_register_enb_pending = eNB_app_register_x2 (enb_id_start, enb_id_end, enb_properties_p);
# else
# endif
do { do {
// Wait for a message // Wait for a message
itti_receive_msg (TASK_ENB_APP, &msg_p); itti_receive_msg (TASK_ENB_APP, &msg_p);
...@@ -395,7 +502,7 @@ void *eNB_app_task(void *args_p) ...@@ -395,7 +502,7 @@ void *eNB_app_task(void *args_p)
sleep(ENB_REGISTER_RETRY_DELAY); sleep(ENB_REGISTER_RETRY_DELAY);
/* Restart the registration process */ /* Restart the registration process */
registered_enb = 0; registered_enb = 0;
register_enb_pending = eNB_app_register (enb_id_start, enb_id_end, enb_properties_p); register_enb_pending = eNB_app_register_s1 (enb_id_start, enb_id_end, enb_properties_p);
} }
} }
} }
...@@ -415,12 +522,60 @@ void *eNB_app_task(void *args_p) ...@@ -415,12 +522,60 @@ void *eNB_app_task(void *args_p)
if (TIMER_HAS_EXPIRED (msg_p).timer_id == enb_register_retry_timer_id) { if (TIMER_HAS_EXPIRED (msg_p).timer_id == enb_register_retry_timer_id) {
/* Restart the registration process */ /* Restart the registration process */
registered_enb = 0; registered_enb = 0;
register_enb_pending = eNB_app_register (enb_id_start, enb_id_end, enb_properties_p); register_enb_pending = eNB_app_register_s1 (enb_id_start, enb_id_end, enb_properties_p);
}
break;
# endif
#ifdef ENABLE_USE_X2
case X2AP_DEREGISTERED_ENB_IND:
LOG_W(ENB_APP, "[eNB %d] Received %s: associated eNB %d\n", instance, msg_name,
X2AP_DEREGISTERED_ENB_IND(msg_p).nb_x2);
/* TODO handle recovering of registration */
break;
case X2AP_REGISTER_ENB_CNF:
LOG_I(ENB_APP, "[eNB %d] Received %s: associated eNB %d\n", instance, msg_name,
X2AP_REGISTER_ENB_CNF(msg_p).nb_x2);
DevAssert(x2_register_enb_pending > 0);
x2_register_enb_pending--;
/* Check if at least eNB is registered with one target eNB */
if (X2AP_REGISTER_ENB_CNF(msg_p).nb_x2 > 0) {
x2_registered_enb++;
}
/* Check if all register eNB requests have been processed */
if (x2_register_enb_pending == 0) {
if (x2_registered_enb == enb_nb) {
/* If all eNB are registered, start RRC HO task */
}else {
uint32_t x2_not_associated = enb_nb - x2_registered_enb;
LOG_W(ENB_APP, " %d eNB %s not associated with the target\n",
x2_not_associated, x2_not_associated > 1 ? "are" : "is");
// timer to retry
/* Restart the eNB registration process in ENB_REGISTER_RETRY_DELAY seconds */
if (timer_setup (X2AP_ENB_REGISTER_RETRY_DELAY, 0, TASK_ENB_APP,
INSTANCE_DEFAULT, TIMER_ONE_SHOT, NULL,
&x2_enb_register_retry_timer_id) < 0) {
LOG_E(ENB_APP, " Can not start eNB X2AP register: retry timer, use \"sleep\" instead!\n");
sleep(X2AP_ENB_REGISTER_RETRY_DELAY);
/* Restart the registration process */
x2_registered_enb = 0;
x2_register_enb_pending = eNB_app_register_x2 (enb_id_start, enb_id_end, enb_properties_p);
}
}
} }
break; break;
# endif
#endif
default: default:
LOG_E(ENB_APP, "Received unexpected message %s\n", msg_name); LOG_E(ENB_APP, "Received unexpected message %s\n", msg_name);
break; break;
......
This diff is collapsed.
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "PHY/impl_defs_lte.h" #include "PHY/impl_defs_lte.h"
#include "PHY/defs.h" #include "PHY/defs.h"
#include "s1ap_messages_types.h" #include "s1ap_messages_types.h"
#include "x2ap_messages_types.h"
#ifdef CMAKER #ifdef CMAKER
#include "SystemInformationBlockType2.h" #include "SystemInformationBlockType2.h"
#include "rrc_messages_types.h" #include "rrc_messages_types.h"
...@@ -73,6 +74,14 @@ typedef struct mme_ip_address_s { ...@@ -73,6 +74,14 @@ typedef struct mme_ip_address_s {
char *ipv6_address; char *ipv6_address;
} mme_ip_address_t; } mme_ip_address_t;
typedef struct x2_enb_ip_address_s {
unsigned ipv4:1;
unsigned ipv6:1;
unsigned active:1;
char *ipv4_address;
char *ipv6_address;
} x2_enb_ip_address_t;
typedef struct rrh_gw_config_s { typedef struct rrh_gw_config_s {
unsigned udp:1; unsigned udp:1;
unsigned raw:1; unsigned raw:1;
...@@ -219,6 +228,11 @@ typedef struct Enb_properties_s { ...@@ -219,6 +228,11 @@ typedef struct Enb_properties_s {
/* List of MME to connect to */ /* List of MME to connect to */
mme_ip_address_t mme_ip_address[S1AP_MAX_NB_MME_IP_ADDRESS]; mme_ip_address_t mme_ip_address[S1AP_MAX_NB_MME_IP_ADDRESS];
/* Nb of X2 to connect to */
uint8_t nb_x2;
/* List of X2 to connect to */
x2_enb_ip_address_t target_enb_x2_ip_address[X2AP_MAX_NB_ENB_IP_ADDRESS];
int sctp_in_streams; int sctp_in_streams;
int sctp_out_streams; int sctp_out_streams;
...@@ -229,6 +243,14 @@ typedef struct Enb_properties_s { ...@@ -229,6 +243,14 @@ typedef struct Enb_properties_s {
char *enb_interface_name_for_S1_MME; char *enb_interface_name_for_S1_MME;
in_addr_t enb_ipv4_address_for_S1_MME; in_addr_t enb_ipv4_address_for_S1_MME;
char *enb_interface_name_for_X2U;
in_addr_t enb_ipv4_address_for_X2U;
tcp_udp_port_t enb_port_for_X2U;
char *enb_interface_name_for_X2C;
in_addr_t enb_ipv4_address_for_X2C;
tcp_udp_port_t enb_port_for_X2C;
char *flexran_agent_interface_name; char *flexran_agent_interface_name;
in_addr_t flexran_agent_ipv4_address; in_addr_t flexran_agent_ipv4_address;
tcp_udp_port_t flexran_agent_port; tcp_udp_port_t flexran_agent_port;
......
...@@ -567,6 +567,10 @@ rrc_mac_config_req( ...@@ -567,6 +567,10 @@ rrc_mac_config_req(
return(0); return(0);
} }
// Assign the new c-rnti in the UE context (during HO)
void rrc_mac_get_new_crnti(protocol_ctxt_t* ctxt_pP,uint8_t eNB_index){
PROTOCOL_CTXT_SET_BY_MODULE_ID(ctxt_pP, ctxt_pP->module_id, ENB_FLAG_NO,UE_mac_inst[ctxt_pP->module_id].crnti, ctxt_pP->frame, ctxt_pP->subframe, eNB_index);
}
#ifdef LOCALIZATION #ifdef LOCALIZATION
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
double double
......
...@@ -298,12 +298,17 @@ printf("MAC: new UE id %d rnti %x\n", i, rntiP); ...@@ -298,12 +298,17 @@ printf("MAC: new UE id %d rnti %x\n", i, rntiP);
return(UE_id); return(UE_id);
} }
printf("MAC: cannot add new UE for rnti %x\n", rntiP); printf("MAC: cannot add new UE for rnti %x\n", rntiP);
LOG_E(MAC,"error in add_new_ue(), could not find space in UE_list, Dumping UE list\n"); LOG_E(MAC,"error in add_new_ue(), could not find space in UE_list, Dumping UE list\n");
dump_ue_list(UE_list,0); dump_ue_list(UE_list,0);
return(-1); return(-1);
} }
int add_new_ue_phy(module_id_t mod_idP, rnti_t rntiP){
int ret = mac_xface->add_ue(rntiP,PHY_vars_eNB_g[mod_idP][0]);
return (ret > 0) ? 0: -1;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP) int rrc_mac_remove_ue(module_id_t mod_idP,rnti_t rntiP)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -429,6 +429,8 @@ void mac_top_cleanup(void) ...@@ -429,6 +429,8 @@ void mac_top_cleanup(void)
free(eNB_mac_inst); free(eNB_mac_inst);
} }
rrc_top_cleanup();
free( Mac_rlc_xface); free( Mac_rlc_xface);
} }
...@@ -474,6 +476,7 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer,ui ...@@ -474,6 +476,7 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer,ui
mac_xface->ra_failed = ra_failed; mac_xface->ra_failed = ra_failed;
mac_xface->ra_succeeded = ra_succeeded; mac_xface->ra_succeeded = ra_succeeded;
mac_xface->mac_phy_remove_ue = mac_phy_remove_ue; mac_xface->mac_phy_remove_ue = mac_phy_remove_ue;
mac_xface->add_ue = add_ue;
LOG_I(MAC,"[MAIN] init UE MAC functions \n"); LOG_I(MAC,"[MAIN] init UE MAC functions \n");
mac_xface->ue_decode_si = ue_decode_si; mac_xface->ue_decode_si = ue_decode_si;
...@@ -500,6 +503,7 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer,ui ...@@ -500,6 +503,7 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer,ui
mac_xface->get_RSRQ = get_RSRQ; mac_xface->get_RSRQ = get_RSRQ;
mac_xface->get_RSSI = get_RSSI; mac_xface->get_RSSI = get_RSSI;
mac_xface->get_n_adj_cells = get_n_adj_cells; mac_xface->get_n_adj_cells = get_n_adj_cells;
mac_xface->get_nid_cell = get_nid_cell;
mac_xface->get_rx_total_gain_dB = get_rx_total_gain_dB; mac_xface->get_rx_total_gain_dB = get_rx_total_gain_dB;
mac_xface->get_Po_NOMINAL_PUSCH = get_Po_NOMINAL_PUSCH; mac_xface->get_Po_NOMINAL_PUSCH = get_Po_NOMINAL_PUSCH;
mac_xface->get_num_prach_tdd = get_num_prach_tdd; mac_xface->get_num_prach_tdd = get_num_prach_tdd;
......
...@@ -466,7 +466,8 @@ ue_process_rar( ...@@ -466,7 +466,8 @@ ue_process_rar(
uint8_t * const dlsch_buffer, uint8_t * const dlsch_buffer,
rnti_t * const t_crnti, rnti_t * const t_crnti,
const uint8_t preamble_index, const uint8_t preamble_index,
uint8_t* selected_rar_buffer uint8_t* selected_rar_buffer,
uint8_t prach_state
); );
...@@ -521,6 +522,7 @@ uint8_t *parse_ulsch_header(uint8_t *mac_header, ...@@ -521,6 +522,7 @@ uint8_t *parse_ulsch_header(uint8_t *mac_header,
int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active); int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active);
int mac_init(void); int mac_init(void);
int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti,int harq_pid); int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti,int harq_pid);
int add_new_ue_phy(module_id_t Mod_id, rnti_t rnti);
int rrc_mac_remove_ue(module_id_t Mod_id, rnti_t rntiP); int rrc_mac_remove_ue(module_id_t Mod_id, rnti_t rntiP);
...@@ -666,7 +668,7 @@ void update_phr (module_id_t module_idP,int CC_id); ...@@ -666,7 +668,7 @@ void update_phr (module_id_t module_idP,int CC_id);
\param[in] Mod_id Instance index of UE \param[in] Mod_id Instance index of UE
\param[in] eNB_id Index of eNB \param[in] eNB_id Index of eNB
*/ */
void Msg3_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP,uint8_t eNB_id); void Msg3_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP,uint8_t eNB_id,UE_MODE_t UE_mode);
/*! \brief Function to indicate the transmission of msg1/rach /*! \brief Function to indicate the transmission of msg1/rach
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include "COMMON/mac_rrc_primitives.h" #include "COMMON/mac_rrc_primitives.h"
#include "RRC/LITE/extern.h" #include "RRC/LITE/extern.h"
#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" #include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
#include "RRC/LITE/proto.h"
#include "UTIL/LOG/log.h" #include "UTIL/LOG/log.h"
#include "UTIL/OPT/opt.h" #include "UTIL/OPT/opt.h"
#include "OCG.h" #include "OCG.h"
...@@ -280,7 +281,7 @@ void Msg1_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id ...@@ -280,7 +281,7 @@ void Msg1_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id
} }
void Msg3_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id) void Msg3_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id, UE_MODE_t UE_mode)
{ {
if (CC_id>0) { if (CC_id>0) {
...@@ -292,8 +293,13 @@ void Msg3_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id ...@@ -292,8 +293,13 @@ void Msg3_tx(module_id_t module_idP,uint8_t CC_id,frame_t frameP, uint8_t eNB_id
// start contention resolution timer // start contention resolution timer
LOG_D(MAC,"[UE %d][RAPROC] Frame %d : Msg3_tx: Setting contention resolution timer\n",module_idP,frameP); LOG_D(MAC,"[UE %d][RAPROC] Frame %d : Msg3_tx: Setting contention resolution timer\n",module_idP,frameP);
UE_mac_inst[module_idP].RA_contention_resolution_cnt = 0; UE_mac_inst[module_idP].RA_contention_resolution_cnt = 0;
UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 1; if(UE_mode==PUSCH){
// Call rrc to update the HO status
rrc_lite_ue_update_ho_status (module_idP);
}
else{
UE_mac_inst[module_idP].RA_contention_resolution_timer_active = 1;
}
if (opt_enabled) { // msg3 if (opt_enabled) { // msg3
trace_pdu(0, &UE_mac_inst[module_idP].CCCH_pdu.payload[0], UE_mac_inst[module_idP].RA_Msg3_size, trace_pdu(0, &UE_mac_inst[module_idP].CCCH_pdu.payload[0], UE_mac_inst[module_idP].RA_Msg3_size,
module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, 0, 0); module_idP, 3, UE_mac_inst[module_idP].crnti, UE_mac_inst[module_idP].txFrame, UE_mac_inst[module_idP].txSubframe, 0, 0);
...@@ -398,6 +404,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP, ...@@ -398,6 +404,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,
DCCH, DCCH,
6); 6);
if (rlc_status.bytes_in_buffer == 0) abort();
if (UE_mac_inst[module_idP].crnti_before_ho) if (UE_mac_inst[module_idP].crnti_before_ho)
LOG_D(MAC, LOG_D(MAC,
"[UE %d] Frame %d : UL-DCCH -> ULSCH, HO RRCConnectionReconfigurationComplete (%x, %x), RRC message has %d bytes to send throug PRACH (mac header len %d)\n", "[UE %d] Frame %d : UL-DCCH -> ULSCH, HO RRCConnectionReconfigurationComplete (%x, %x), RRC message has %d bytes to send throug PRACH (mac header len %d)\n",
...@@ -410,7 +417,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP, ...@@ -410,7 +417,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,
eNB_indexP, frameP,ENB_FLAG_NO, MBMS_FLAG_NO, eNB_indexP, frameP,ENB_FLAG_NO, MBMS_FLAG_NO,
DCCH, DCCH,
6, //not used 6, //not used
(char *)&ulsch_buff[0]); (char *)&ulsch_buff[0]); // (char *)&ulsch_buff[4]);
LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]); LOG_D(MAC,"[UE %d] TX Got %d bytes for DCCH\n",module_idP,sdu_lengths[0]);
update_bsr(module_idP, frameP, subframeP,eNB_indexP); update_bsr(module_idP, frameP, subframeP,eNB_indexP);
...@@ -444,6 +451,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP, ...@@ -444,6 +451,7 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,
UE_mac_inst[module_idP].RA_backoff_subframe = subframeP; UE_mac_inst[module_idP].RA_backoff_subframe = subframeP;
// Fill in preamble and PRACH resource // Fill in preamble and PRACH resource
get_prach_resources(module_idP,CC_id,eNB_indexP,subframeP,1,NULL); get_prach_resources(module_idP,CC_id,eNB_indexP,subframeP,1,NULL);
lcid = DCCH;
generate_ulsch_header((uint8_t*)ulsch_buff, // mac header generate_ulsch_header((uint8_t*)ulsch_buff, // mac header
1, // num sdus 1, // num sdus
0, // short pading 0, // short pading
...@@ -455,7 +463,15 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP, ...@@ -455,7 +463,15 @@ PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP,int CC_id,frame_t frameP,
NULL, // short bsr NULL, // short bsr
NULL, // long_bsr NULL, // long_bsr
0); //post_padding 0); //post_padding
#ifdef DEBUG_ULSCH
printf("length %d\n", sdu_lengths[0]);
{
int i;
for (i = 0; i < 13; i++)
printf("%2.2x ", (unsigned int)ulsch_buff[i]);
printf("\n");
}
#endif
return(&UE_mac_inst[module_idP].RA_prach_resources); return(&UE_mac_inst[module_idP].RA_prach_resources);
} }
} else { // RACH is active } else { // RACH is active
......
...@@ -137,7 +137,8 @@ ue_process_rar( ...@@ -137,7 +137,8 @@ ue_process_rar(
uint8_t* const dlsch_buffer, uint8_t* const dlsch_buffer,
rnti_t* const t_crnti, rnti_t* const t_crnti,
const uint8_t preamble_index, const uint8_t preamble_index,
uint8_t* selected_rar_buffer // output argument for storing the selected RAR header and RAR payload uint8_t* selected_rar_buffer,
uint8_t prach_state// output argument for storing the selected RAR header and RAR payload
) )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
...@@ -210,9 +211,12 @@ ue_process_rar( ...@@ -210,9 +211,12 @@ ue_process_rar(
} }
if (preamble_index == rarh->RAPID) { if (preamble_index == rarh->RAPID) {
*t_crnti = (uint16_t)rar[5]+(rar[4]<<8);//rar->t_crnti; if(prach_state==0){
UE_mac_inst[module_idP].crnti = *t_crnti;//rar->t_crnti; *t_crnti = (uint16_t)rar[5]+(rar[4]<<8);//rar->t_crnti;
//return(rar->Timing_Advance_Command); UE_mac_inst[module_idP].crnti = *t_crnti;//rar->t_crnti;
LOG_D(MAC,"Update the c-rnti (not HO case)\n");
}
//return(rar->Timing_Advance_Command);
ret = ((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4)); ret = ((((uint16_t)(rar[0]&0x7f))<<4) + (rar[1]>>4));
} else { } else {
UE_mac_inst[module_idP].crnti=0; UE_mac_inst[module_idP].crnti=0;
......
...@@ -137,6 +137,9 @@ typedef struct { ...@@ -137,6 +137,9 @@ typedef struct {
int16_t (*estimate_ue_tx_power)(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs); int16_t (*estimate_ue_tx_power)(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs);
int (*mac_phy_remove_ue)(module_id_t Mod_idP,rnti_t rntiP); int (*mac_phy_remove_ue)(module_id_t Mod_idP,rnti_t rntiP);
int (*add_ue)(int16_t rnti, PHY_VARS_eNB *eNB);
/// UE functions /// UE functions
/// reset the ue phy /// reset the ue phy
...@@ -170,7 +173,7 @@ typedef struct { ...@@ -170,7 +173,7 @@ typedef struct {
PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t Msg3_flag,sub_frame_t subframe); PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t Msg3_flag,sub_frame_t subframe);
/// Process Random-Access Response /// Process Random-Access Response
uint16_t (*ue_process_rar)(module_id_t Mod_id,int CC_id,frame_t frameP, uint16_t ra_rnti, uint8_t *dlsch_buffer, uint16_t *t_crnti,uint8_t preamble_index, uint8_t* selected_rar_buffer); uint16_t (*ue_process_rar)(module_id_t Mod_id,int CC_id,frame_t frameP, uint16_t ra_rnti, uint8_t *dlsch_buffer, uint16_t *t_crnti,uint8_t preamble_index, uint8_t* selected_rar_buffer, uint8_t prach_state);
/// Get SR payload (0,1) from UE MAC /// Get SR payload (0,1) from UE MAC
uint32_t (*ue_get_SR)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,sub_frame_t subframe); uint32_t (*ue_get_SR)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,sub_frame_t subframe);
...@@ -216,7 +219,7 @@ typedef struct { ...@@ -216,7 +219,7 @@ typedef struct {
void (*phy_config_afterHO_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index, void (*phy_config_afterHO_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
MobilityControlInfo_t *mobilityControlInfo, MobilityControlInfo_t *mobilityControlInfo,
uint8_t ho_failed); uint8_t ho_failed);
void (*phy_config_ue_state_ho)(uint8_t Mod_id,uint8_t CC_id,uint16_t rnti);
/// Function to indicate failure of contention resolution or RA procedure /// Function to indicate failure of contention resolution or RA procedure
void (*ra_failed)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index); void (*ra_failed)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index);
...@@ -227,7 +230,7 @@ typedef struct { ...@@ -227,7 +230,7 @@ typedef struct {
void (*Msg1_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id); void (*Msg1_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id);
/// Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer /// Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer
void (*Msg3_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id); void (*Msg3_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id, UE_MODE_t UE_mode);
/// Function to pass inter-cell measurement parameters to PHY (cell Ids) /// Function to pass inter-cell measurement parameters to PHY (cell Ids)
void (*phy_config_meas_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,uint32_t *adj_cell_id); void (*phy_config_meas_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,uint32_t *adj_cell_id);
...@@ -296,6 +299,9 @@ typedef struct { ...@@ -296,6 +299,9 @@ typedef struct {
/// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements /// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements
uint8_t (*set_RSRQ_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp); uint8_t (*set_RSRQ_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp);
// Function to get the Nid cell
uint16_t (*get_nid_cell) (uint8_t Mod_id,uint8_t CC_id);
/// Function for UE/eNB MAC to retrieve number of PRACH in TDD /// Function for UE/eNB MAC to retrieve number of PRACH in TDD
uint8_t (*get_num_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms); uint8_t (*get_num_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms);
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
#include "rrc_L2_proto.h" #include "rrc_L2_proto.h"
#else #else
#include "RRC/LITE/defs.h" #include "RRC/LITE/defs.h"
#include "RRC/LITE/proto.h"
#endif //CELLULAR #endif //CELLULAR
#include "COMMON/mac_rrc_primitives.h" #include "COMMON/mac_rrc_primitives.h"
#include "openair_rrc_L2_interface.h" #include "openair_rrc_L2_interface.h"
...@@ -280,3 +281,7 @@ openair_rrc_eNB_init( ...@@ -280,3 +281,7 @@ openair_rrc_eNB_init(
{ {
return openair_rrc_lite_eNB_init(module_idP); return openair_rrc_lite_eNB_init(module_idP);
} }
//------------------------------------------------------------------------------
void mac_rrc_ue_update_ho_status(module_id_t module_idP){
return (rrc_lite_ue_update_ho_status(module_idP));
}
...@@ -130,4 +130,7 @@ void mac_in_sync_ind( ...@@ -130,4 +130,7 @@ void mac_in_sync_ind(
const frame_t frameP, const frame_t frameP,
const uint16_t eNB_indexP); const uint16_t eNB_indexP);
void mac_rrc_ue_update_ho_status(
module_id_t module_idP);
#endif #endif
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include "rrc_eNB_UE_context.h" #include "rrc_eNB_UE_context.h"
#include "pdcp.h" #include "pdcp.h"
#include "msc.h" #include "msc.h"
#include "proto.h"
#ifdef PHY_EMUL #ifdef PHY_EMUL
#include "SIMULATION/simulation_defs.h" #include "SIMULATION/simulation_defs.h"
...@@ -787,3 +788,13 @@ int mac_ue_ccch_success_ind(module_id_t Mod_idP, uint8_t eNB_index) ...@@ -787,3 +788,13 @@ int mac_ue_ccch_success_ind(module_id_t Mod_idP, uint8_t eNB_index)
#endif #endif
return 0; return 0;
} }
void rrc_lite_ue_update_ho_status(module_id_t Mod_idP){
// Handover is done
LOG_D(RRC,"Reset HO timer in RRC\n");
UE_rrc_inst[Mod_idP].Info[0].T304_active = 0; // Stop the timer (MAC procedure was successful)
//UE_rrc_inst[Mod_idP].HandoverInfoUe.measFlag = 0; // Stop the measurements
UE_mac_inst[Mod_idP].RA_active = 0;
UE_rrc_inst[Mod_idP].Info[0].State = RRC_RECONFIGURED;
LOG_D(RRC,"UE is updated: Mod_id: %d/State: %d\n",Mod_idP,UE_rrc_inst[Mod_idP].Info[0].State);
}
...@@ -113,7 +113,7 @@ extern uint8_t usim_test; ...@@ -113,7 +113,7 @@ extern uint8_t usim_test;
uint16_t two_tier_hexagonal_cellIds[7] = {0,1,2,4,5,7,8}; uint16_t two_tier_hexagonal_cellIds[7] = {0,1,2,4,5,7,8};
uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8}, // CellId 0 uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8}, // CellId 0
{11,18,2,0,8,15}, // CellId 1 {11,0,2,18,8,15}, // CellId 1
{18,13,3,4,0,1}, // CellId 2 {18,13,3,4,0,1}, // CellId 2
{2,3,14,6,5,0}, // CellId 4 {2,3,14,6,5,0}, // CellId 4
{0,4,6,16,9,7}, // CellId 5 {0,4,6,16,9,7}, // CellId 5
...@@ -2494,6 +2494,12 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ ...@@ -2494,6 +2494,12 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA=*(measResultListEUTRA2); measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA=*(measResultListEUTRA2);
#ifdef Rel10
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.ext1=NULL;
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.ext2=NULL;
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message,
(void*)&ul_dcch_msg, (void*)&ul_dcch_msg,
buffer, buffer,
......
...@@ -216,7 +216,11 @@ typedef enum HO_STATE_e { ...@@ -216,7 +216,11 @@ typedef enum HO_STATE_e {
HO_MEASURMENT, HO_MEASURMENT,
HO_PREPARE, HO_PREPARE,
HO_CMD, // initiated by the src eNB HO_CMD, // initiated by the src eNB
HO_COMPLETE // initiated by the target eNB HO_COMPLETE, // initiated by the target eNB
HO_REQUEST,
HO_ACK,
HO_CONFIGURED,
} HO_STATE_t; } HO_STATE_t;
//#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG //#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG
...@@ -232,7 +236,7 @@ typedef enum HO_STATE_e { ...@@ -232,7 +236,7 @@ typedef enum HO_STATE_e {
#define PAYLOAD_SIZE_MAX 1024 #define PAYLOAD_SIZE_MAX 1024
#define RRC_BUF_SIZE 255 #define RRC_BUF_SIZE 255
#define UNDEF_SECURITY_MODE 0xff #define UNDEF_SECURITY_MODE 0xff
#define NO_SECURITY_MODE 0x20 #define NO_SECURITY_MODE 0x20 // 0x33
#define CBA_OFFSET 0xfff4 #define CBA_OFFSET 0xfff4
// #define NUM_MAX_CBA_GROUP 4 // in the platform_constants // #define NUM_MAX_CBA_GROUP 4 // in the platform_constants
...@@ -291,14 +295,17 @@ typedef struct e_rab_param_s { ...@@ -291,14 +295,17 @@ typedef struct e_rab_param_s {
typedef struct HANDOVER_INFO_s { typedef struct HANDOVER_INFO_s {
uint8_t ho_prepare; uint8_t ho_prepare;
uint8_t ho_complete; uint8_t ho_complete;
HO_STATE_t state; //current state of handover
uint8_t modid_s; //module_idP of serving cell uint8_t modid_s; //module_idP of serving cell
uint8_t modid_t; //module_idP of target cell uint8_t modid_t; //module_idP of target cell
uint8_t ueid_s; //UE index in serving cell uint16_t ueid_s; //UE index in serving cell
uint8_t ueid_t; //UE index in target cell uint16_t ueid_t; //UE index in target cell
AS_Config_t as_config; /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */ AS_Config_t as_config; /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */
AS_Context_t as_context; /* They are mandatory for HO */ AS_Context_t as_context; /* They are mandatory for HO */
uint8_t buf[RRC_BUF_SIZE]; /* ASN.1 encoded handoverCommandMessage */ uint8_t buf[RRC_BUF_SIZE]; /* ASN.1 encoded handoverCommandMessage */
int size; /* size of above message in bytes */ int size; /* size of above message in bytes */
/* TODO: to remove or not? */
int source_x2id;
} HANDOVER_INFO; } HANDOVER_INFO;
#define RRC_HEADER_SIZE_MAX 64 #define RRC_HEADER_SIZE_MAX 64
...@@ -491,7 +498,6 @@ typedef struct eNB_RRC_INST_s { ...@@ -491,7 +498,6 @@ typedef struct eNB_RRC_INST_s {
/// localization list for aggregated measurements from PHY /// localization list for aggregated measurements from PHY
struct list loc_list; struct list loc_list;
#endif #endif
//RRC configuration //RRC configuration
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
RrcConfigurationReq configuration; RrcConfigurationReq configuration;
...@@ -588,6 +594,13 @@ typedef struct UE_RRC_INST_s { ...@@ -588,6 +594,13 @@ typedef struct UE_RRC_INST_s {
/* Used integrity/ciphering algorithms */ /* Used integrity/ciphering algorithms */
CipheringAlgorithm_r12_t ciphering_algorithm; CipheringAlgorithm_r12_t ciphering_algorithm;
e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm;
// X2 HO stats and measurements
uint8_t rrc_ue_do_meas; // flag to start the meas only once
uint32_t rrc_ue_x2_src_enb_ms; // form connected to idle : include x2 delay
struct list rrc_ue_x2_src_enb_list;
uint32_t rrc_ue_x2_target_enb_ms; // from idle to connected
struct list rrc_ue_x2_target_enb_list;
} UE_RRC_INST; } UE_RRC_INST;
#include "proto.h" #include "proto.h"
......
...@@ -287,6 +287,10 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( ...@@ -287,6 +287,10 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover(
const uint32_t nas_length const uint32_t nas_length
); );
void rrc_eNB_configure_rbs_handover(struct rrc_eNB_ue_context_s* ue_context_p, protocol_ctxt_t* const ctxt_pP);
void rrc_eNB_target_add_ue_handover(protocol_ctxt_t* const ctxt_pP);
//L2_interface.c //L2_interface.c
int8_t int8_t
mac_rrc_data_req( mac_rrc_data_req(
...@@ -381,6 +385,8 @@ ue_measurement_report_triggering( ...@@ -381,6 +385,8 @@ ue_measurement_report_triggering(
const uint8_t eNB_index const uint8_t eNB_index
); );
void rrc_lite_ue_update_ho_status(module_id_t Mod_idP);
int int
mac_eNB_get_rrc_status( mac_eNB_get_rrc_status(
const module_id_t Mod_idP, const module_id_t Mod_idP,
...@@ -454,7 +460,7 @@ rrc_eNB_free_mem_UE_context( ...@@ -454,7 +460,7 @@ rrc_eNB_free_mem_UE_context(
void void
rrc_eNB_free_UE( rrc_eNB_free_UE(
const module_id_t enb_mod_idP, const module_id_t enb_mod_idP,
const struct rrc_eNB_ue_context_s* const ue_context_pP struct rrc_eNB_ue_context_s* ue_context_pP
); );
long binary_search_int(int elements[], long numElem, int value); long binary_search_int(int elements[], long numElem, int value);
......
...@@ -2097,6 +2097,7 @@ rrc_ue_process_mobilityControlInfo( ...@@ -2097,6 +2097,7 @@ rrc_ue_process_mobilityControlInfo(
// rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
// rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
// rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DTCH,RADIO_ACCESS_BEARER,Rlc_info_um); // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DTCH,RADIO_ACCESS_BEARER,Rlc_info_um);
//rrc_mac_get_new_crnti(ctxt_pP,eNB_index);
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_SI_RECEIVED; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_SI_RECEIVED;
} }
...@@ -2268,12 +2269,27 @@ rrc_ue_decode_dcch( ...@@ -2268,12 +2269,27 @@ rrc_ue_decode_dcch(
eNB_indexP); eNB_indexP);
if (target_eNB_index != 0xFF) { if (target_eNB_index != 0xFF) {
UE_rrc_inst[ctxt_pP->module_id].rrc_ue_do_meas=0;
// Stop to measure (delay to the UE-->source)
//stop_meas(&UE_rrc_inst[ctxt_pP->module_id].rrc_ue_x2_src_enb);
//double t_x2_src_enb = (double)UE_rrc_inst[ctxt_pP->module_id].rrc_ue_x2_src_enb.p_time/get_cpu_freq_GHz()/1000.0;
double t_x2_src_enb = (double)ctxt_pP->frame*10+ctxt_pP->subframe - UE_rrc_inst[ctxt_pP->module_id].rrc_ue_x2_src_enb_ms;
push_front(&UE_rrc_inst[ctxt_pP->module_id].rrc_ue_x2_src_enb_list, t_x2_src_enb);
LOG_D(RRC,"UE-Stop-Time-debug: %d/%lf/%d/%d\n", ctxt_pP->frame*10+ctxt_pP->subframe, (double) UE_rrc_inst[ctxt_pP->module_id].rrc_ue_x2_src_enb_ms,ctxt_pP->frame,ctxt_pP->subframe);
// Start to measure (delay to the UE-->target)
//start_meas(&UE_rrc_inst[ctxt_pP->module_id].rrc_ue_x2_target_enb);
UE_rrc_inst[ctxt_pP->module_id].rrc_ue_x2_target_enb_ms = ctxt_pP->frame*10+ctxt_pP->subframe;
LOG_D(RRC,"UE-Start-Time-debug: %lf/%d/%d\n", (double) UE_rrc_inst[ctxt_pP->module_id].rrc_ue_x2_target_enb_ms,ctxt_pP->frame,ctxt_pP->subframe);
init_meas_timers(ctxt_pP); // Initialize handover measurement timers
rrc_ue_generate_RRCConnectionReconfigurationComplete( rrc_ue_generate_RRCConnectionReconfigurationComplete(
ctxt_pP, ctxt_pP,
target_eNB_index, target_eNB_index,
dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.rrc_TransactionIdentifier); dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.rrc_TransactionIdentifier);
UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State = RRC_HO_EXECUTION; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State = RRC_HO_EXECUTION;
UE_rrc_inst[ctxt_pP->module_id].Info[target_eNB_index].State = RRC_RECONFIGURED; if(eNB_indexP!=target_eNB_index){
UE_rrc_inst[ctxt_pP->module_id].Info[target_eNB_index].State = RRC_RECONFIGURED;
}
LOG_I(RRC, "[UE %d] State = RRC_RECONFIGURED during HO (eNB %d)\n", LOG_I(RRC, "[UE %d] State = RRC_RECONFIGURED during HO (eNB %d)\n",
ctxt_pP->module_id, target_eNB_index); ctxt_pP->module_id, target_eNB_index);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
...@@ -4012,10 +4028,18 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint ...@@ -4012,10 +4028,18 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint
UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->measId = UE_rrc_inst[ctxt_pP->module_id].MeasId[i][j]->measId; UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->measId = UE_rrc_inst[ctxt_pP->module_id].MeasId[i][j]->measId;
UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->numberOfReportsSent = 0; UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->numberOfReportsSent = 0;
rrc_ue_generate_MeasurementReport(
ctxt_pP, if (UE_rrc_inst[ctxt_pP->module_id].rrc_ue_do_meas == 0 ){
eNB_index); UE_rrc_inst[ctxt_pP->module_id].rrc_ue_do_meas = 1;
UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1; // Start to measure (delay to the UE-->source)
//start_meas(&UE_rrc_inst[ctxt_pP->module_id].rrc_ue_x2_src_enb);
UE_rrc_inst[ctxt_pP->module_id].rrc_ue_x2_src_enb_ms = ctxt_pP->frame*10+ctxt_pP->subframe;
LOG_D(RRC,"UE-Start-Time-debug: %lf/%d/%d\n", (double) UE_rrc_inst[ctxt_pP->module_id].rrc_ue_x2_src_enb_ms,ctxt_pP->frame,ctxt_pP->subframe);
}
rrc_ue_generate_MeasurementReport(
ctxt_pP,
eNB_index);
//UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1;
LOG_I(RRC,"[UE %d] Frame %d: A3 event detected, state: %d \n", LOG_I(RRC,"[UE %d] Frame %d: A3 event detected, state: %d \n",
ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[0].State); ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[0].State);
} else { } else {
...@@ -4097,10 +4121,10 @@ static uint8_t check_trigger_meas_event( ...@@ -4097,10 +4121,10 @@ static uint8_t check_trigger_meas_event(
} }
if (UE_rrc_inst->measTimer[ue_cnx_index][meas_index][tmp_offset] >= ttt) { if (UE_rrc_inst->measTimer[ue_cnx_index][meas_index][tmp_offset] >= ttt) {
UE_rrc_inst->HandoverInfoUe.targetCellId = get_adjacent_cell_id(ue_mod_idP,tmp_offset); //WARNING!!!...check this! UE_rrc_inst->HandoverInfoUe.targetCellId = get_adjacent_cell_id(currentCellIndex,tmp_offset); //WARNING!!!...check this!
LOG_D(RRC,"[UE %d] Frame %d eNB %d: Handover triggered: targetCellId: %ld currentCellId: %d eNB_offset: %d rsrp source: %3.1f rsrp target: %3.1f\n", \ LOG_D(RRC,"[UE %d] Frame %d eNB %d: Handover triggered: targetCellId: %ld currentCellId: %d eNB_offset: %d rsrp source: %3.1f rsrp target: %3.1f\n", \
ue_mod_idP, frameP, eNB_index, ue_mod_idP, frameP, eNB_index,
UE_rrc_inst->HandoverInfoUe.targetCellId,ue_cnx_index,eNB_offset, UE_rrc_inst->HandoverInfoUe.targetCellId,currentCellIndex,eNB_offset,
(dB_fixed_times10(UE_rrc_inst[ue_mod_idP].rsrp_db[0])/10.0)-mac_xface->get_rx_total_gain_dB(ue_mod_idP,0)-dB_fixed(mac_xface->frame_parms->N_RB_DL*12), (dB_fixed_times10(UE_rrc_inst[ue_mod_idP].rsrp_db[0])/10.0)-mac_xface->get_rx_total_gain_dB(ue_mod_idP,0)-dB_fixed(mac_xface->frame_parms->N_RB_DL*12),
(dB_fixed_times10(UE_rrc_inst[ue_mod_idP].rsrp_db[eNB_offset])/10.0)-mac_xface->get_rx_total_gain_dB(ue_mod_idP, (dB_fixed_times10(UE_rrc_inst[ue_mod_idP].rsrp_db[eNB_offset])/10.0)-mac_xface->get_rx_total_gain_dB(ue_mod_idP,
0)-dB_fixed(mac_xface->frame_parms->N_RB_DL*12)); 0)-dB_fixed(mac_xface->frame_parms->N_RB_DL*12));
...@@ -4117,6 +4141,18 @@ static uint8_t check_trigger_meas_event( ...@@ -4117,6 +4141,18 @@ static uint8_t check_trigger_meas_event(
return 0; return 0;
} }
// Initialize the handover measurement timers
void init_meas_timers(const protocol_ctxt_t* const ctxt_pP){
uint8_t i,j,eNB_offset;
for(i=0 ; i<NB_CNX_UE ; i++) {
for(j=0 ; j<MAX_MEAS_ID ; j++) {
for (eNB_offset = 0; eNB_offset<1+mac_xface->get_n_adj_cells(ctxt_pP->module_id,0); eNB_offset++) {
UE_rrc_inst->measTimer[i][j][eNB_offset]=0;
}
}
}
}
#if defined(Rel10) || defined(Rel14) #if defined(Rel10) || defined(Rel14)
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
......
...@@ -507,6 +507,7 @@ rrc_rx_tx( ...@@ -507,6 +507,7 @@ rrc_rx_tx(
if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION) && 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].HandoverInfoUe.targetCellId != 0xFF)) {
UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0;
UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE; 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); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT);
return(RRC_HO_STARTED); return(RRC_HO_STARTED);
......
This diff is collapsed.
...@@ -33,26 +33,35 @@ def printDebug(string): ...@@ -33,26 +33,35 @@ def printDebug(string):
def outputHeaderToFile(f, filename): def outputHeaderToFile(f, filename):
now = datetime.datetime.now() now = datetime.datetime.now()
f.write("""/* f.write("""/*******************************************************************************
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with Eurecom OpenAirInterface
* this work for additional information regarding copyright ownership. Copyright(c) 1999 - 2013 Eurecom
* 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 This program is free software; you can redistribute it and/or modify it
* except in compliance with the License. under the terms and conditions of the GNU General Public License,
* You may obtain a copy of the License at version 2, as published by the Free Software Foundation.
*
* http://www.openairinterface.org/?page_id=698 This program is distributed in the hope it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* Unless required by applicable law or agreed to in writing, software FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* distributed under the License is distributed on an "AS IS" BASIS, more details.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and You should have received a copy of the GNU General Public License along with
* limitations under the License. this program; if not, write to the Free Software Foundation, Inc.,
*------------------------------------------------------------------------------- 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org The full GNU General Public License is included in this distribution in
*/ the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fr/openairinterface
Address : EURECOM, Campus SophiaTech, 450 Route des Chappes
06410 Biot FRANCE
*******************************************************************************/
""") """)
f.write("/*******************************************************************************\n") f.write("/*******************************************************************************\n")
......
/*
* 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
*/
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "intertask_interface.h"
#include "x2ap.h"
#include "assertions.h"
#include "conversions.h"
void *x2ap_task(void *arg)
{
MessageDef *received_msg = NULL;
int result;
X2AP_DEBUG("Starting X2AP layer\n");
x2ap_prepare_internal_data();
itti_mark_task_ready(TASK_X2AP);
while (1) {
itti_receive_msg(TASK_X2AP, &received_msg);
switch (ITTI_MSG_ID(received_msg)) {
case TERMINATE_MESSAGE:
itti_exit_task();
break;
default:
X2AP_ERROR("Received unhandled message: %d:%s\n",
ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg));
break;
}
result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg);
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
received_msg = NULL;
}
return NULL;
}
/*
* 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
*/
#include <stdio.h>
#include <stdint.h>
/** @defgroup _x2ap_impl_ X2AP Layer Reference Implementation
* @ingroup _ref_implementation_
* @{
*/
#ifndef X2AP_H_
#define X2AP_H_
typedef struct x2ap_config_s {
} x2ap_config_t;
#if defined(OAI_EMU)
#else
extern x2ap_config_t x2ap_config;
#endif
void *x2ap_task(void *arg);
#endif /* X2AP_H_ */
/**
* @}
*/
/* /*******************************************************************************
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more OpenAirInterface
* contributor license agreements. See the NOTICE file distributed with Copyright(c) 1999 - 2014 Eurecom
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under OpenAirInterface is free software: you can redistribute it and/or modify
* the OAI Public License, Version 1.0 (the "License"); you may not use this file it under the terms of the GNU General Public License as published by
* except in compliance with the License. the Free Software Foundation, either version 3 of the License, or
* You may obtain a copy of the License at (at your option) any later version.
*
* http://www.openairinterface.org/?page_id=698
* OpenAirInterface is distributed in the hope that it will be useful,
* Unless required by applicable law or agreed to in writing, software but WITHOUT ANY WARRANTY; without even the implied warranty of
* distributed under the License is distributed on an "AS IS" BASIS, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. GNU General Public License for more details.
* See the License for the specific language governing permissions and
* limitations under the License. You should have received a copy of the GNU General Public License
*------------------------------------------------------------------------------- along with OpenAirInterface.The full GNU General Public License is
* For more information about the OpenAirInterface (OAI) Software Alliance: included in this distribution in the file called "COPYING". If not,
* contact@openairinterface.org see <http://www.gnu.org/licenses/>.
*/
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
/*! \file x2ap_common.c /*! \file x2ap_common.c
* \brief x2ap procedures for both eNB and MME * \brief x2ap procedures for both eNB and MME
......
/* /*******************************************************************************
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more OpenAirInterface
* contributor license agreements. See the NOTICE file distributed with Copyright(c) 1999 - 2014 Eurecom
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under OpenAirInterface is free software: you can redistribute it and/or modify
* the OAI Public License, Version 1.0 (the "License"); you may not use this file it under the terms of the GNU General Public License as published by
* except in compliance with the License. the Free Software Foundation, either version 3 of the License, or
* You may obtain a copy of the License at (at your option) any later version.
*
* http://www.openairinterface.org/?page_id=698
* OpenAirInterface is distributed in the hope that it will be useful,
* Unless required by applicable law or agreed to in writing, software but WITHOUT ANY WARRANTY; without even the implied warranty of
* distributed under the License is distributed on an "AS IS" BASIS, MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. GNU General Public License for more details.
* See the License for the specific language governing permissions and
* limitations under the License. You should have received a copy of the GNU General Public License
*------------------------------------------------------------------------------- along with OpenAirInterface.The full GNU General Public License is
* For more information about the OpenAirInterface (OAI) Software Alliance: included in this distribution in the file called "COPYING". If not,
* contact@openairinterface.org see <http://www.gnu.org/licenses/>.
*/
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#if HAVE_CONFIG_H_ #if HAVE_CONFIG_H_
# include "config.h" # include "config.h"
...@@ -284,6 +292,8 @@ ...@@ -284,6 +292,8 @@
#ifndef TRUE #ifndef TRUE
#define TRUE 1 #define TRUE 1
#endif
#ifndef FALSE
#define FALSE 0 #define FALSE 0
#endif #endif
...@@ -292,10 +302,12 @@ extern int asn1_xer_print; ...@@ -292,10 +302,12 @@ extern int asn1_xer_print;
#if defined(ENB_MODE) #if defined(ENB_MODE)
# include "log.h" # include "log.h"
# define X2AP_INFO(x, args...) LOG_I(X2AP, x, ##args)
# define X2AP_ERROR(x, args...) LOG_E(X2AP, x, ##args) # define X2AP_ERROR(x, args...) LOG_E(X2AP, x, ##args)
# define X2AP_WARN(x, args...) LOG_W(X2AP, x, ##args) # define X2AP_WARN(x, args...) LOG_W(X2AP, x, ##args)
# define X2AP_DEBUG(x, args...) LOG_D(X2AP, x, ##args) # define X2AP_DEBUG(x, args...) LOG_D(X2AP, x, ##args)
#else #else
# define X2AP_INFO(x, args...) do { fprintf(stdout, "[X2AP][I]"x, ##args); } while(0)
# define X2AP_ERROR(x, args...) do { fprintf(stdout, "[X2AP][E]"x, ##args); } while(0) # define X2AP_ERROR(x, args...) do { fprintf(stdout, "[X2AP][E]"x, ##args); } while(0)
# define X2AP_WARN(x, args...) do { fprintf(stdout, "[X2AP][W]"x, ##args); } while(0) # define X2AP_WARN(x, args...) do { fprintf(stdout, "[X2AP][W]"x, ##args); } while(0)
# define X2AP_DEBUG(x, args...) do { fprintf(stdout, "[X2AP][D]"x, ##args); } while(0) # define X2AP_DEBUG(x, args...) do { fprintf(stdout, "[X2AP][D]"x, ##args); } while(0)
......
This diff is collapsed.
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/
#include <stdio.h>
#include <stdint.h>
/** @defgroup _x2ap_impl_ X2AP Layer Reference Implementation
* @ingroup _ref_implementation_
* @{
*/
#ifndef X2AP_ENB_H_
#define X2AP_ENB_H_
#define X2AP_PORT_NUMBER (36422) ///< X2AP SCTP IANA ASSIGNED Port Number
#define X2AP_SCTP_PPID (27) ///< X2AP SCTP Payload Protocol Identifier (PPID)
typedef struct x2ap_config_s {
} x2ap_config_t;
#if defined(OAI_EMU)
#else
extern x2ap_config_t x2ap_config;
#endif
void *x2ap_task(void *arg);
#endif /* X2AP_H_ */
/**
* @}
*/
This diff is collapsed.
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2015 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file x2ap_eNB_decoder.c
* \brief x2ap pdu decode procedures for eNB
* \author Navid Nikaein
* \date 2015- 2016
* \version 0.1
*/
#include "x2ap_common.h"
#include "x2ap_ies_defs.h"
#ifndef X2AP_ENB_DECODER_H_
#define X2AP_ENB_DECODER_H_
int x2ap_eNB_decode_pdu(x2ap_message *x2ap_message, const uint8_t * const buffer, uint32_t len);
#endif /* X2AP_ENB_DECODER_H_ */
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
#include <stdint.h>
#include "queue.h"
#include "tree.h"
#include "sctp_eNB_defs.h"
#ifndef X2AP_ENB_DEFS_H_
#define X2AP_ENB_DEFS_H_
#define X2AP_ENB_NAME_LENGTH_MAX (150)
typedef enum {
/* Disconnected state: initial state for any association. */
X2AP_ENB_STATE_DISCONNECTED = 0x0,
/* State waiting for x2 Setup response message if the target eNB accepts or
* X2 Setup failure if rejects the eNB.
*/
X2AP_ENB_STATE_WAITING = 0x1,
/* The eNB is successfully connected to another eNB. */
X2AP_ENB_STATE_CONNECTED = 0x2,
/* X2AP is ready, and the eNB is successfully connected to another eNB. */
X2AP_ENB_STATE_READY = 0x3,
/*
*/
X2AP_ENB_STATE_OVERLOAD = 0x4,
X2AP_ENB_STATE_RESETTING = 0x5,
/* Max number of states available */
X2AP_ENB_STATE_MAX,
} x2ap_eNB_state_t;
/* Served PLMN identity element */
struct plmn_identity_s {
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
STAILQ_ENTRY(plmn_identity_s) next;
};
/* Served group id element */
struct served_group_id_s {
uint16_t enb_group_id;
STAILQ_ENTRY(served_group_id_s) next;
};
/* Served enn code for a particular eNB */
struct enb_code_s {
uint8_t enb_code;
STAILQ_ENTRY(enb_code_s) next;
};
struct x2ap_eNB_instance_s;
/* This structure describes association of a eNB to another eNB */
typedef struct x2ap_eNB_data_s {
/* eNB descriptors tree, ordered by sctp assoc id */
RB_ENTRY(x2ap_eNB_data_s) entry;
/* This is the optional name provided by the MME */
char *eNB_name;
/* target eNB ID */
uint32_t eNB_id;
/* Current eNB load information (if any). */
//x2ap_load_state_t overload_state;
/* Current eNB->eNB X2AP association state */
x2ap_eNB_state_t state;
/* Next usable stream for UE signalling */
int32_t nextstream;
/* Number of input/ouput streams */
uint16_t in_streams;
uint16_t out_streams;
/* Connexion id used between SCTP/X2AP */
uint16_t cnx_id;
/* SCTP association id */
int32_t assoc_id;
/* Only meaningfull in virtual mode */
struct x2ap_eNB_instance_s *x2ap_eNB_instance;
} x2ap_eNB_data_t;
typedef struct x2ap_eNB_instance_s {
/* used in simulation to store multiple eNB instances*/
STAILQ_ENTRY(x2ap_eNB_instance_s) x2ap_eNB_entries;
/* Number of target eNBs requested by eNB (tree size) */
uint32_t x2_target_enb_nb;
/* Number of target eNBs for which association is pending */
uint32_t x2_target_enb_pending_nb;
/* Number of target eNB successfully associated to eNB */
uint32_t x2_target_enb_associated_nb;
/* Tree of X2AP eNB associations ordered by association ID */
RB_HEAD(x2ap_enb_map, x2ap_eNB_data_s) x2ap_enb_head;
/* Tree of UE ordered by eNB_ue_x2ap_id's */
// RB_HEAD(x2ap_ue_map, x2ap_eNB_ue_context_s) x2ap_ue_head;
/* For virtual mode, mod_id as defined in the rest of the L1/L2 stack */
instance_t instance;
/* Displayable name of eNB */
char *eNB_name;
/* Unique eNB_id to identify the eNB within EPC.
* In our case the eNB is a macro eNB so the id will be 20 bits long.
* For Home eNB id, this field should be 28 bits long.
*/
uint32_t eNB_id;
/* The type of the cell */
cell_type_t cell_type;
/* Tracking area code */
uint16_t tac;
/* Mobile Country Code
* Mobile Network Code
*/
uint16_t mcc;
uint16_t mnc;
uint8_t mnc_digit_length;
} x2ap_eNB_instance_t;
typedef struct {
/* List of served eNBs
* Only used for virtual mode
*/
STAILQ_HEAD(x2ap_eNB_instances_head_s, x2ap_eNB_instance_s) x2ap_eNB_instances_head;
/* Nb of registered eNBs */
uint8_t nb_registered_eNBs;
/* Generate a unique connexion id used between X2AP and SCTP */
uint16_t global_cnx_id;
} x2ap_eNB_internal_data_t;
int x2ap_eNB_compare_assoc_id(struct x2ap_eNB_data_s *p1, struct x2ap_eNB_data_s *p2);
/* Generate the tree management functions */
struct x2ap_eNB_map;
struct x2ap_eNB_data_s;
RB_PROTOTYPE(x2ap_eNB_map, x2ap_eNB_data_s, entry, x2ap_eNB_compare_assoc_id);
#endif /* X2AP_ENB_DEFS_H_ */
This diff is collapsed.
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
#ifndef X2AP_ENB_ENCODER_H_
#define X2AP_ENB_ENCODER_H_
#include "x2ap_common.h"
#include "x2ap_ies_defs.h"
int x2ap_eNB_encode_pdu(x2ap_message *x2ap_message_p, uint8_t **buffer, uint32_t *len)
__attribute__ ((warn_unused_result));
#endif /* X2AP_ENB_ENCODER_H_ */
This diff is collapsed.
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
#ifndef X2AP_ENB_GENERATE_MESSAGES_H_
#define X2AP_ENB_GENERATE_MESSAGES_H_
#include "x2ap_eNB_defs.h"
#include "x2ap_ies_defs.h"
int x2ap_eNB_generate_x2_setup_request(x2ap_eNB_instance_t *instance_p,
x2ap_eNB_data_t *x2ap_enb_data_p);
int
x2ap_generate_x2_setup_response (x2ap_eNB_data_t * eNB_association);
int x2ap_eNB_generate_x2_setup_failure ( uint32_t assoc_id,
X2ap_Cause_PR cause_type,
long cause_value,
long time_to_waitx);
int x2ap_eNB_generate_x2_handover_request(x2ap_eNB_instance_t *instance_p,
x2ap_eNB_data_t *x2ap_enb_data_p,
int source_x2id);
int x2ap_eNB_generate_x2_handover_response(x2ap_eNB_instance_t *instance_p,
x2ap_eNB_data_t *x2ap_enb_data_p,
int source_x2id);
#endif /* X2AP_ENB_GENERATE_MESSAGES_H_ */
This diff is collapsed.
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
#ifndef X2AP_ENB_HANDLERS_H_
#define X2AP_ENB_HANDLERS_H_
#include "x2ap_eNB_defs.h"
void x2ap_handle_x2_setup_message(x2ap_eNB_data_t *mme_desc_p, int sctp_shutdown);
int x2ap_eNB_handle_message(uint32_t assoc_id, int32_t stream,
const uint8_t * const data, const uint32_t data_length);
#endif /* X2AP_ENB_HANDLERS_H_ */
/*******************************************************************************
OpenAirInterface
Copyright(c) 1999 - 2014 Eurecom
OpenAirInterface is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenAirInterface is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OpenAirInterface.The full GNU General Public License is
included in this distribution in the file called "COPYING". If not,
see <http://www.gnu.org/licenses/>.
Contact Information
OpenAirInterface Admin: openair_admin@eurecom.fr
OpenAirInterface Tech : openair_tech@eurecom.fr
OpenAirInterface Dev : openair4g-devel@lists.eurecom.fr
Address : Eurecom, Compus SophiaTech 450, route des chappes, 06451 Biot, France.
*******************************************************************************/
/*! \file x2ap_eNB_itti_messaging.c
* \brief itti interface between x2ap and sctp
* \author Navid Nikaein
* \date 2016
* \version 0.1
*/
#include "intertask_interface.h"
#include "x2ap_eNB_itti_messaging.h"
void x2ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,
uint32_t buffer_length, uint16_t stream)
{
MessageDef *message_p;
sctp_data_req_t *sctp_data_req;
message_p = itti_alloc_new_message(TASK_X2AP, SCTP_DATA_REQ);
sctp_data_req = &message_p->ittiMsg.sctp_data_req;
sctp_data_req->assoc_id = assoc_id;
sctp_data_req->buffer = buffer;
sctp_data_req->buffer_length = buffer_length;
sctp_data_req->stream = stream;
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
void x2ap_eNB_itti_send_sctp_close_association(instance_t instance, int32_t assoc_id)
{
MessageDef *message_p = NULL;
sctp_close_association_t *sctp_close_association_p = NULL;
message_p = itti_alloc_new_message(TASK_X2AP, SCTP_CLOSE_ASSOCIATION);
sctp_close_association_p = &message_p->ittiMsg.sctp_close_association;
sctp_close_association_p->assoc_id = assoc_id;
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -67,4 +67,6 @@ int init_slot_isr(void); ...@@ -67,4 +67,6 @@ int init_slot_isr(void);
void wait_for_slot_isr(void); void wait_for_slot_isr(void);
int user_control_interface(int);
#endif /* OAISIM_FUNCTIONS_H_ */ #endif /* OAISIM_FUNCTIONS_H_ */
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