diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 0ebaf2abba..85688732ad 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -1076,6 +1076,7 @@ add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGE #add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues") #add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver") #add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)") +add_compile_definitions(NEW_GTPU) ########################## # RRC LAYER OPTIONS @@ -2829,7 +2830,7 @@ add_dependencies(lte-softmodem rrc_flag s1ap_flag x2_flag oai_iqplayer) target_link_libraries (lte-softmodem -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB NR_GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U_OCP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} -Wl,--end-group z dl) @@ -2872,7 +2873,7 @@ add_dependencies(ocp-enb rrc_flag s1ap_flag x2_flag oai_iqplayer coding params_l target_link_libraries (ocp-enb -Wl,--start-group - RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB NR_GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB + RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB GTPV1U_OCP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 L2_LTE NFAPI_COMMON_LIB NFAPI_LIB MISC_NFAPI_LTE_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB LFDS7 SIMU_COMMON ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} ${FSPT_MSG_LIB} ${PROTO_AGENT_LIB} -Wl,--end-group z dl) @@ -2969,7 +2970,7 @@ target_link_libraries (lte-uesoftmodem -Wl,--start-group RRC_LIB NR_RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP F1AP_LIB - NR_GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON + GTPV1U_OCP SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE L2_LTE LFDS7 SIMU_COMMON SIMU NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB MISC_NFAPI_LTE_LIB ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ITTI ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${ATLAS_LIBRARIES} -Wl,--end-group z dl) @@ -3367,7 +3368,7 @@ add_executable(test_epc_generate_scenario ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h ) target_link_libraries (test_epc_generate_scenario - -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP NR_GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ITTI ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB X2AP_ENB M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U_OCP LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY LFDS ITTI ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) add_executable(test_epc_play_scenario @@ -3386,7 +3387,7 @@ add_executable(test_epc_play_scenario ) target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) target_link_libraries (test_epc_play_scenario - -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP NR_GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ITTI ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} + -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB X2AP_ENB M3AP_LIB M3AP_ENB F1AP_LIB F1AP GTPV1U_OCP LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT MME_APP UDP SCHED_LIB PHY_NR_COMMON PHY_COMMON PHY PHY_UE LFDS ITTI ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${CONFIG_LIB} ) @@ -3432,7 +3433,7 @@ if (${T_TRACER}) NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_VNF_LIB NFAPI_USER_LIB PHY_COMMON PHY PHY_UE PHY_NR PHY_NR_COMMON PHY_NR_UE PHY_RU PHY_MEX L2 L2_LTE L2_NR L2_LTE_NR L2_UE NR_L2_UE L2_UE_LTE_NR MAC_NR_COMMON MAC_NR MAC_UE_NR NGAP_GNB - CN_UTILS NR_GTPV1U GTPV1U_OCP SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB + CN_UTILS GTPV1U_OCP GTPV1U_OCP SCTP_CLIENT MME_APP UDP LIB_NAS_UE NB_IoT LFDS LFDS7 SIMU_COMMON SIMU SIMU_ETH OPENAIR0_LIB ldpc_orig ldpc_optim ldpc_optim8seg ldpc PROTO_AGENT dfts) if (TARGET ${i}) add_dependencies(${i} generate_T) diff --git a/openair1/SIMULATION/LTE_PHY/common_sim.h b/openair1/SIMULATION/LTE_PHY/common_sim.h index 5e0be3de89..5625cf8e2f 100644 --- a/openair1/SIMULATION/LTE_PHY/common_sim.h +++ b/openair1/SIMULATION/LTE_PHY/common_sim.h @@ -134,16 +134,16 @@ struct option * parse_oai_options(paramdef_t *options) { void display_options_values(paramdef_t *options, int verbose) { for(paramdef_t * ptr=options; ptr->optname[0]!=0; ptr++) { - char varText[256]="need specific display"; + char varText[256]={0}; if (ptr->voidptr != NULL) { if ( (ptr->paramflags & PARAMFLAG_BOOL) ) strcpy(varText, *(bool *)ptr->iptr ? "True": "False" ); else switch (ptr->type) { - case TYPE_INT: - sprintf(varText,"%d",*ptr->iptr); - break; - + case TYPE_INT: + sprintf(varText,"%d",*ptr->iptr); + break; + case TYPE_DOUBLE: sprintf(varText,"%.2f",*ptr->dblptr); break; @@ -157,6 +157,7 @@ void display_options_values(paramdef_t *options, int verbose) { break; default: + strcpy(varText,"Need specific display"); printf("not decoded type\n"); exit(1); } diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index 9a9ccaf1f7..3a34efbb93 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -634,7 +634,7 @@ int main(int argc, char **argv) { // num_layers = 1; perfect_ce = 0; static paramdef_t options[] = { - { "awgn", "Use AWGN channel and not multipath", PARAMFLAG_BOOL, strptr:NULL, defintval:0, TYPE_INT, 0, NULL, NULL }, + { "awgn", "Use AWGN channel and not multipath", PARAMFLAG_BOOL, iptr:&awgn_flag, defintval:0, TYPE_INT, 0, NULL, NULL }, { "Abstx", "Turns on calibration mode for abstraction.", PARAMFLAG_BOOL, iptr:&abstx, defintval:0, TYPE_INT, 0 }, { "bTDD", "Set the tdd configuration mode",0, iptr:&tdd_config, defintval:3, TYPE_INT, 0 }, { "BnbRBs", "The LTE bandwith in RBs (100 is 20MHz)",0, iptr:&N_RB_DL, defintval:25, TYPE_INT, 0 }, diff --git a/openair1/SIMULATION/NR_PHY/dlsim.c b/openair1/SIMULATION/NR_PHY/dlsim.c index 5df03a903b..9c81443e0f 100644 --- a/openair1/SIMULATION/NR_PHY/dlsim.c +++ b/openair1/SIMULATION/NR_PHY/dlsim.c @@ -70,6 +70,7 @@ #include #include +#include LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC; rlc_info_t Rlc_info_um,Rlc_info_am_config; @@ -88,6 +89,13 @@ uint64_t downlink_frequency[MAX_NUM_CCs][4]; THREAD_STRUCT thread_struct; nfapi_ue_release_request_body_t release_rntis; uint32_t N_RB_DL = 106; +//Fixme: Uniq dirty DU instance, by global var, datamodel need better management +instance_t DUuniqInstance=0; +instance_t CUuniqInstance=0; +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, + transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { +return 0; +} // dummy functions int dummy_nr_ue_ul_indication(nr_uplink_indication_t *ul_info) { return(0); } @@ -130,12 +138,6 @@ rrc_data_ind( { } -int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, - const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, - gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { - return 0; -} - int gtpv1u_create_s1u_tunnel( const instance_t instanceP, diff --git a/openair1/SIMULATION/NR_PHY/prachsim.c b/openair1/SIMULATION/NR_PHY/prachsim.c index 6167c809ff..96f6fe4990 100644 --- a/openair1/SIMULATION/NR_PHY/prachsim.c +++ b/openair1/SIMULATION/NR_PHY/prachsim.c @@ -51,6 +51,7 @@ #include #include //#include "openair1/SIMULATION/NR_PHY/nr_dummy_functions.c" +#include #define NR_PRACH_DEBUG 1 #define PRACH_WRITE_OUTPUT_DEBUG 1 @@ -87,6 +88,13 @@ int oai_nfapi_nr_crc_indication(nfapi_nr_crc_indication_t *ind) { return(0); } int oai_nfapi_nr_srs_indication(nfapi_nr_srs_indication_t *ind) { return(0); } int oai_nfapi_nr_uci_indication(nfapi_nr_uci_indication_t *ind) { return(0); } int oai_nfapi_nr_rach_indication(nfapi_nr_rach_indication_t *ind) { return(0); } +//Fixme: Uniq dirty DU instance, by global var, datamodel need better management +instance_t DUuniqInstance=0; +instance_t CUuniqInstance=0; +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, + transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { +return 0; +} void rrc_data_ind( @@ -98,12 +106,6 @@ rrc_data_ind( { } -int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, - const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, - gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { - return 0; -} - int gtpv1u_create_s1u_tunnel( const instance_t instanceP, diff --git a/openair1/SIMULATION/NR_PHY/ulsim.c b/openair1/SIMULATION/NR_PHY/ulsim.c index e267c8b6d7..4a87f9f17c 100644 --- a/openair1/SIMULATION/NR_PHY/ulsim.c +++ b/openair1/SIMULATION/NR_PHY/ulsim.c @@ -65,6 +65,7 @@ #include #include "PHY/NR_REFSIG/ul_ref_seq_nr.h" +#include //#define DEBUG_ULSIM LCHAN_DESC DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC; @@ -85,6 +86,13 @@ THREAD_STRUCT thread_struct; nfapi_ue_release_request_body_t release_rntis; uint32_t N_RB_DL = 106; +//Fixme: Uniq dirty DU instance, by global var, datamodel need better management +instance_t DUuniqInstance=0; +instance_t CUuniqInstance=0; +teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, + transport_layer_addr_t remoteAddr, int port, gtpCallback callBack) { +return 0; +} extern void fix_scd(NR_ServingCellConfig_t *scd);// forward declaration int8_t nr_mac_rrc_data_ind_ue(const module_id_t module_id, @@ -120,11 +128,6 @@ rrc_data_ind( { } -int ocp_gtpv1u_create_s1u_tunnel(instance_t instance, - const gtpv1u_enb_create_tunnel_req_t *create_tunnel_req, - gtpv1u_enb_create_tunnel_resp_t *create_tunnel_resp) { - return 0; -} int gtpv1u_create_s1u_tunnel( diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c index 7fac0bdfca..090cf9531b 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.c +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.c @@ -140,6 +140,22 @@ extern volatile int oai_exit; pthread_t pdcp_stats_thread_desc; +// will be called when 4G F1 implementation will use GTP-U instead of protobuf +boolean_t cu_f1u_data_req( + protocol_ctxt_t *ctxt_pP, + const srb_flag_t srb_flagP, + const rb_id_t rb_id, + const mui_t muiP, + const confirm_t confirmP, + const sdu_size_t sdu_buffer_size, + unsigned char *const sdu_buffer, + const pdcp_transmission_mode_t mode, + const uint32_t *const sourceL2Id, + const uint32_t *const destinationL2Id + ) +{ + return true; +} void *pdcp_stats_thread(void *param) { FILE *fd; diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h index 94d19e9c01..2d11fc6613 100644 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp.h +++ b/openair2/LAYER2/PDCP_v10.1.0/pdcp.h @@ -264,11 +264,9 @@ boolean_t cu_f1u_data_req( const confirm_t confirmP, const sdu_size_t sdu_buffer_size, unsigned char *const sdu_buffer, - const pdcp_transmission_mode_t mode -#if (LTE_RRC_VERSION >= MAKE_VERSION(14, 0, 0)) - ,const uint32_t *const sourceL2Id - ,const uint32_t *const destinationL2Id -#endif + const pdcp_transmission_mode_t mode, + const uint32_t *const sourceL2Id, + const uint32_t *const destinationL2Id ); /*! \fn boolean_t pdcp_data_ind(const protocol_ctxt_t* const, srb_flag_t, MBMS_flag_t, rb_id_t, sdu_size_t, mem_block_t*, boolean_t) diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitive.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitive.c deleted file mode 100644 index c2736ddd84..0000000000 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitive.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.1 (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 - */ - -/*************************************************************************** - pdcp_control_primitives.c - ------------------- - begin : Mon Dec 10 2001 - email : Lionel.Gauthier@eurecom.fr - ------------------- - description - This file contains the functions used for configuration of pdcp - - ***************************************************************************/ -#include "rtos_header.h" -#include "platform.h" -#include "protocol_vars_extern.h" -//----------------------------------------------------------------------------- -#include "rlc.h" -#include "pdcp.h" -#include "debug_l2.h" -//----------------------------------------------------------------------------- -void -configure_pdcp_req (struct pdcp_entity *pdcpP, void *rlcP, uint8_t rlc_sap_typeP, uint8_t header_compression_typeP) -{ - //----------------------------------------------------------------------------- - mem_block *mb; - - mb = get_free_mem_block (sizeof (struct cpdcp_primitive), __func__); - if(mb==NULL) return; - ((struct cpdcp_primitive *) mb->data)->type = CPDCP_CONFIG_REQ; - ((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_sap = rlcP; - ((struct cpdcp_primitive *) mb->data)->primitive.config_req.rlc_type_sap = rlc_sap_typeP; - ((struct cpdcp_primitive *) mb->data)->primitive.config_req.header_compression_type = header_compression_typeP; - send_pdcp_control_primitive (pdcpP, mb); -} diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitives_proto_extern.h b/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitives_proto_extern.h deleted file mode 100644 index 6226dccc33..0000000000 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_control_primitives_proto_extern.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.1 (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 - */ - -/*************************************************************************** - pdcp_control_primitives_proto_extern.h - ------------------- - begin : Mon Dec 10 2001 - email : Lionel.Gauthier@eurecom.fr - ------------------- - description - This file contains the prototypes of functions used for configuration of pdcp - - ***************************************************************************/ -#ifndef PDCP_CONTROL_PRIMITIVES_PROTO_EXTERN_H -# define PDCP_CONTROL_PRIMITIVES_PROTO_EXTERN_H -# include "pdcp.h" -void rrc_configure_pdcp (struct pdcp_entity *pdcpP, void *rlcP, uint8_t rlc_sap_typeP, uint8_t header_compression_typeP); -#endif diff --git a/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c b/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c deleted file mode 100644 index f1f6ebb794..0000000000 --- a/openair2/LAYER2/PDCP_v10.1.0/pdcp_thread.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file pdcp_thread.c - * \brief - * \author F. Kaltenberger - * \date 2013 - * \version 0.1 - * \company Eurecom - * \email: florian.kaltenberger@eurecom.fr - * \note - * \warning - */ -#include -//#include - -#include "pdcp.h" -#include "PHY/extern.h" //for PHY_vars -#include "UTIL/LOG/log.h" -#include "UTIL/LOG/vcd_signal_dumper.h" -#include "msc.h" - -#define OPENAIR_THREAD_STACK_SIZE 8192 -#define OPENAIR_THREAD_PRIORITY 255 - -extern int oai_exit; -extern char UE_flag; - -pthread_t pdcp_thread; -pthread_mutex_t pdcp_mutex; -pthread_cond_t pdcp_cond; -int pdcp_instance_cnt; - -static void *pdcp_thread_main(void* param); - -static void *pdcp_thread_main(void* param) -{ - uint8_t eNB_flag = !UE_flag; - - LOG_I(PDCP,"This is pdcp_thread eNB_flag = %d\n",eNB_flag); - MSC_START_USE(); - - while (!oai_exit) { - - if (pthread_mutex_lock(&pdcp_mutex) != 0) { - LOG_E(PDCP,"Error locking mutex.\n"); - } else { - while (pdcp_instance_cnt < 0) { - pthread_cond_wait(&pdcp_cond,&pdcp_mutex); - } - - if (pthread_mutex_unlock(&pdcp_mutex) != 0) { - LOG_E(PDCP,"Error unlocking mutex.\n"); - } - } - - if (oai_exit) break; - - if (eNB_flag) { - pdcp_run(PHY_vars_eNB_g[0]->frame, eNB_flag, PHY_vars_eNB_g[0]->Mod_id, 0); - LOG_D(PDCP,"Calling pdcp_run (eNB) for frame %d\n",PHY_vars_eNB_g[0]->frame); - } else { - pdcp_run(PHY_vars_UE_g[0]->frame, eNB_flag, 0, PHY_vars_UE_g[0]->Mod_id); - LOG_D(PDCP,"Calling pdcp_run (UE) for frame %d\n",PHY_vars_UE_g[0]->frame); - } - - if (pthread_mutex_lock(&pdcp_mutex) != 0) { - LOG_E(PDCP,"Error locking mutex.\n"); - } else { - pdcp_instance_cnt--; - - if (pthread_mutex_unlock(&pdcp_mutex) != 0) { - LOG_E(PDCP,"Error unlocking mutex.\n"); - } - } - } - - return(NULL); -} - - -int init_pdcp_thread(void) -{ - - pthread_mutex_init(&pdcp_mutex,NULL); - pthread_cond_init(&pdcp_cond,NULL); - - pdcp_instance_cnt = -1; - LOG_I(PDCP,"Allocating PDCP thread\n"); - threadCreate(&pdcp_thread, pdcp_thread_main, (void*)NULL, "PDCP", -1, OAI_PRIORITY_RT); - - return(0); -} - - -void cleanup_pdcp_thread(void) -{ - void *status_p = NULL; - - LOG_I(PDCP,"Scheduling PDCP thread to exit\n"); - - pdcp_instance_cnt = 0; - - if (pthread_cond_signal(&pdcp_cond) != 0) { - LOG_I(PDCP,"ERROR pthread_cond_signal\n"); - } else { - LOG_I(PDCP,"Signalled PDCP thread to exit\n"); - } - - pthread_join(pdcp_thread,&status_p); - LOG_I(PDCP,"PDCP thread exited\n"); - pthread_cond_destroy(&pdcp_cond); - pthread_mutex_destroy(&pdcp_mutex); -} diff --git a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c b/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c deleted file mode 100644 index c64fd09bfc..0000000000 --- a/openair2/RRC/L2_INTERFACE/openair_rrc_L2_interface.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * 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.1 (the "License"); you may not use this file - * except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.openairinterface.org/?page_id=698 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - *------------------------------------------------------------------------------- - * For more information about the OpenAirInterface (OAI) Software Alliance: - * contact@openairinterface.org - */ - -/*! \file l2_interface.c -* \brief layer 2 interface -* \author Navid Nikaein and Raymond Knopp -* \date 2011 -* \version 1.0 -* \company Eurecom -* \email: navid.nikaein@eurecom.fr -*/ - -#include -#include -#include - -#include "platform_types.h" -#include "openair_defs.h" - -#ifdef CELLULAR -#include "rrc_L2_proto.h" -#else -#include "RRC/LTE/defs.h" -#endif //CELLULAR -#include "COMMON/mac_rrc_primitives.h" -#include "openair_rrc_L2_interface.h" - -//------------------------------------------------------------------------------ -int8_t -mac_rrc_data_req( - const module_id_t module_idP, - const int CC_idP, - const frame_t frameP, - const rb_id_t srb_idP, - const uint8_t nb_tbP, - uint8_t* const buffer_pP, - const eNB_flag_t eNB_flagP, - const uint8_t eNB_indexP, - const uint8_t mbsfn_sync_areaP -) -//------------------------------------------------------------------------------ -{ - return(mac_rrc_lite_data_req( - module_idP, - CC_idP, - frameP, - srb_idP, - nb_tbP, - buffer_pP, - eNB_flagP, - eNB_indexP, - mbsfn_sync_areaP) - ); -} - -//------------------------------------------------------------------------------ -/*int8_t -mac_rrc_data_ind( - const module_id_t module_idP, - const int CC_idP, - const frame_t frameP, - const sub_frame_t subframeP, - const rnti_t rntiP, - const rb_id_t srb_idP, - const uint8_t *sduP, - const sdu_size_t sdu_lenP, - const eNB_flag_t eNB_flagP, - const mac_enb_index_t eNB_indexP, - const uint8_t mbsfn_sync_area -) -//------------------------------------------------------------------------------ -{ - return(mac_rrc_lite_data_ind( - module_idP, - CC_idP, - frameP,subframeP, - rntiP, - srb_idP, - sduP, - sdu_lenP, - eNB_flagP, - eNB_indexP, - mbsfn_sync_area) - ); -}*/ - -//------------------------------------------------------------------------------ -void -rlcrrc_data_ind( - const protocol_ctxt_t* const ctxt_pP, - const rb_id_t srb_idP, - const sdu_size_t sdu_lenP, - const uint8_t * const buffer_pP -) -//------------------------------------------------------------------------------ -{ - rrc_data_ind(ctxt_pP, - srb_idP, - sdu_lenP, - buffer_pP); -} - -//------------------------------------------------------------------------------ -uint8_t -pdcp_rrc_data_req( - const protocol_ctxt_t* const ctxt_pP, - const rb_id_t rb_idP, - const mui_t muiP, - const confirm_t confirmP, - const sdu_size_t sdu_buffer_sizeP, - uint8_t* const sdu_buffer_pP, - const pdcp_transmission_mode_t modeP -) -//------------------------------------------------------------------------------ -{ - return rrc_lite_data_req ( - ctxt_pP, - rb_idP, - muiP, - confirmP, - sdu_buffer_sizeP, - sdu_buffer_pP, - modeP); -} - -//------------------------------------------------------------------------------ -void -pdcp_rrc_data_ind( - const protocol_ctxt_t* const ctxt_pP, - const rb_id_t srb_idP, - const sdu_size_t sdu_sizeP, - uint8_t * const buffer_pP -) -//------------------------------------------------------------------------------ -{ - rrc_lite_data_ind( - ctxt_pP, - srb_idP, - sdu_sizeP, - buffer_pP); -} - -//------------------------------------------------------------------------------ -void -mac_rrc_meas_ind( - const module_id_t module_idP, - MAC_MEAS_REQ_ENTRY * const Meas_entry_pP -) -//------------------------------------------------------------------------------ -{ - // mac_rrc_meas_ind(module_idP,Meas_entry_pP); -} - -//------------------------------------------------------------------------------ -void -mac_sync_ind( - const module_id_t module_idP, - const uint8_t Status -) -//------------------------------------------------------------------------------ -{ - mac_lite_sync_ind(module_idP,Status); -} - -//------------------------------------------------------------------------------ -void -mac_in_sync_ind( - const module_id_t module_idP, - const frame_t frameP, - const uint16_t eNB_indexP -) -//------------------------------------------------------------------------------ -{ - rrc_lite_in_sync_ind(module_idP,frameP,eNB_indexP); -} - -//------------------------------------------------------------------------------ -void -mac_out_of_sync_ind( - const module_id_t module_idP, - const frame_t frameP, - const uint16_t eNB_indexP -) -//------------------------------------------------------------------------------ -{ - rrc_lite_out_of_sync_ind(module_idP,frameP,eNB_indexP); -} - -//------------------------------------------------------------------------------ -int -mac_eNB_get_rrc_status( - const module_id_t module_idP, - const rnti_t rntiP -) -//------------------------------------------------------------------------------ -{ - return mac_eNB_get_rrc_lite_status(module_idP, rntiP); -} -//------------------------------------------------------------------------------ -int -mac_UE_get_rrc_status( - const module_id_t module_idP, - const uint8_t sig_indexP -) -//------------------------------------------------------------------------------ -{ - return mac_UE_get_rrc_lite_status(module_idP, sig_indexP); -} - -//------------------------------------------------------------------------------ -char -openair_rrc_ue_init( - const module_id_t module_idP, - const unsigned char eNB_indexP -) -//------------------------------------------------------------------------------ -{ - return openair_rrc_lite_ue_init(module_idP, eNB_indexP); -} - -//------------------------------------------------------------------------------ -char -openair_rrc_eNB_init( - const module_id_t module_idP -) -//------------------------------------------------------------------------------ -{ - return openair_rrc_lite_eNB_init(module_idP); -} diff --git a/openair2/UTIL/OPT/vars.h b/openair2/UTIL/OPT/vars.h deleted file mode 100644 index 0da315aa8b..0000000000 --- a/openair2/UTIL/OPT/vars.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.1 (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 - */ - -/*____________________________OPT/var.h___________________________ -Authors: Navid NIKAIEN -Company: EURECOM -Emails: -*/ -extern mac_lte_tap_info *WS_mac_lte_tap_info; -extern mac_lte_info *WS_mac_lte_info; diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index 3dff973f1c..8db7cafb7a 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -121,8 +121,10 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te msgHdr->version=1; msgHdr->msgType=GTP_GPDU; msgHdr->msgLength=htons(msgLen); + if ( seqNumFlag || extHdrFlag || npduNumFlag) msgHdr->msgLength+=4; + msgHdr->teid=htonl(teid); if(seqNumFlag || extHdrFlag || npduNumFlag) { @@ -138,8 +140,8 @@ static int gtpv1uCreateAndSendMsg(int h, uint32_t peerIp, uint16_t peerPort, te to.sin_port = htons(peerPort); to.sin_addr.s_addr = peerIp ; LOG_D(GTPU,"sending packet size: %d to %s\n",fullSize, inet_ntoa(to.sin_addr) ); - int ret; + if ((ret=sendto(h, (void *)buffer, (size_t)fullSize, 0,(struct sockaddr *)&to, sizeof(to) )) != fullSize ) { LOG_E(GTPU, "[SD %d] Failed to send data to " IPV4_ADDR " on port %d, buffer size %u, ret: %d, errno: %d\n", h, IPV4_ADDR_FORMAT(peerIp), peerPort, fullSize, ret, errno); @@ -166,24 +168,25 @@ static void gtpv1uSend(instance_t instance, gtpv1u_enb_tunnel_data_req_t *req, b return; } - auto ptr=ptrRnti->second.bearers; + map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); - if ( ptr.find(rab_id) == ptr.end() ) { + if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %x/%x\n", rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; - } else - LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", - rnti, rab_id,ptr[rab_id].teid_outgoing,length, ptr[rab_id].seqNum,ptr[rab_id].npduNum ); + } + + LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", + rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); if(seqNumFlag) - ptr[rab_id].seqNum++; + ptr2->second.seqNum++; if(npduNumFlag) - ptr[rab_id].npduNum++; + ptr2->second.npduNum++; - - ocp_gtpv1u_bearer_t tmp=ptr[rab_id]; + // copy to release the mutex + ocp_gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1uCreateAndSendMsg(compatInst(instance), tmp.outgoing_ip_addr, @@ -207,24 +210,25 @@ static void gtpv1uSend2(instance_t instance, gtpv1u_gnb_tunnel_data_req_t *req, return; } - auto ptr=ptrRnti->second.bearers; + map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); - if ( ptr.find(rab_id) == ptr.end() ) { + if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %x/%x\n", rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; - } else - LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", - rnti, rab_id,ptr[rab_id].teid_outgoing,length, ptr[rab_id].seqNum,ptr[rab_id].npduNum ); + } + + LOG_D(GTPU,"sending a packet to RNTI:RAB:teid %x/%x/%x, len %lu, oldseq %d, oldnum %d\n", + rnti, rab_id,ptr2->second.teid_outgoing,length, ptr2->second.seqNum,ptr2->second.npduNum ); if(seqNumFlag) - ptr[rab_id].seqNum++; + ptr2->second.seqNum++; if(npduNumFlag) - ptr[rab_id].npduNum++; + ptr2->second.npduNum++; - // We will release the lock, let's copy data before - ocp_gtpv1u_bearer_t tmp=ptr[rab_id]; + // copy to release the mutex + ocp_gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); gtpv1uCreateAndSendMsg(compatInst(instance), tmp.outgoing_ip_addr, @@ -246,17 +250,17 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r return; } - auto ptr=ptrRnti->second.bearers; + map::iterator ptr2=ptrRnti->second.bearers.find(rab_id); - if ( ptr.find(rab_id) == ptr.end() ) { + if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"sending a packet to a non existant RNTI:RAB: %x/%x\n", rnti, rab_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; - } else - LOG_D(GTPU,"sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n", - rnti, rab_id,ptr[rab_id].teid_outgoing); + } - ocp_gtpv1u_bearer_t tmp=ptr[rab_id]; + LOG_D(GTPU,"sending a end packet packet to RNTI:RAB:teid %x/%x/%x\n", + rnti, rab_id,ptr2->second.teid_outgoing); + ocp_gtpv1u_bearer_t tmp=ptr2->second; pthread_mutex_unlock(&globGtp.gtp_lock); Gtpv1uMsgHeaderT msgHdr; // N should be 0 for us (it was used only in 2G and 3G) @@ -275,7 +279,6 @@ static void gtpv1uEndTunnel(instance_t instance, gtpv1u_enb_tunnel_data_req_t *r to.sin_family = AF_INET; to.sin_port = htons(tmp.outgoing_port); to.sin_addr.s_addr = tmp.outgoing_ip_addr; - char ip4[INET_ADDRSTRLEN]; //char ip6[INET6_ADDRSTRLEN]; LOG_D(GTPU,"sending end packet to %s\n", inet_ntoa(to.sin_addr) ); @@ -391,22 +394,25 @@ void GtpuUpdateTunnelOutgoingTeid(instance_t instance, rnti_t rnti, ebi_t bearer pthread_mutex_lock(&globGtp.gtp_lock); auto inst=&globGtp.instances[compatInst(instance)]; auto ptrRnti=inst->ue2te_mapping.find(rnti); + if ( ptrRnti == inst->ue2te_mapping.end() ) { LOG_E(GTPU,"Update tunnel for a not existing rnti %x\n", rnti); pthread_mutex_unlock(&globGtp.gtp_lock); return; } - auto tmp=&ptrRnti->second.bearers; - auto ptrBearer=tmp->find(bearer_id); - if ( ptrBearer == tmp->end() ) { + + map::iterator ptr2=ptrRnti->second.bearers.find(bearer_id); + + if ( ptr2 == ptrRnti->second.bearers.end() ) { LOG_E(GTPU,"Update tunnel for a existing rnti %x, but wrong bearer_id %u\n", rnti, bearer_id); pthread_mutex_unlock(&globGtp.gtp_lock); return; - } //AssertFatal(ptrBearer.second.teid_outgoing == oldOutGoingTeid, ""); - ptrBearer->second.teid_outgoing = newOutgoingTeid; - LOG_I(GTPU, "Tunnel Outgoing TEID updated to %d \n", ptrBearer->second.teid_outgoing); - pthread_mutex_unlock(&globGtp.gtp_lock); - return; + } + + ptr2->second.teid_outgoing = newOutgoingTeid; + LOG_I(GTPU, "Tunnel Outgoing TEID updated to %d \n", ptr2->second.teid_outgoing); + pthread_mutex_unlock(&globGtp.gtp_lock); + return; } teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer_id, int outgoing_bearer_id, teid_t outgoing_teid, @@ -434,7 +440,7 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer inst->te2ue_mapping[incoming_teid].callBack=callBack; - auto tmp=&inst->ue2te_mapping[rnti].bearers[outgoing_bearer_id]; + ocp_gtpv1u_bearer_t *tmp=&inst->ue2te_mapping[rnti].bearers[outgoing_bearer_id]; int addrs_length_in_bytes = remoteAddr.length / 8; @@ -464,14 +470,12 @@ teid_t newGtpuCreateTunnel(instance_t instance, rnti_t rnti, int incoming_bearer pthread_mutex_unlock(&globGtp.gtp_lock); char ip4[INET_ADDRSTRLEN]; char ip6[INET6_ADDRSTRLEN]; - LOG_I(GTPU, "Created tunnel for RNTI %x, teid for DL: %u, teid for UL %u to remote IPv4: %s, IPv6 %s\n", rnti, tmp->teid_incoming, tmp->teid_outgoing, - inet_ntop(AF_INET,(void*)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ), - inet_ntop(AF_INET6,(void*)&tmp->outgoing_ip6_addr.s6_addr, ip6, INET6_ADDRSTRLEN)); - + inet_ntop(AF_INET,(void *)&tmp->outgoing_ip_addr, ip4,INET_ADDRSTRLEN ), + inet_ntop(AF_INET6,(void *)&tmp->outgoing_ip6_addr.s6_addr, ip6, INET6_ADDRSTRLEN)); return incoming_teid; } @@ -862,7 +866,7 @@ void *ocp_gtpv1uTask(void *args) { case GTPV1U_GNB_TUNNEL_DATA_REQ: { gtpv1uSend2(compatInst(ITTI_MSG_DESTINATION_INSTANCE(message_p)), >PV1U_GNB_TUNNEL_DATA_REQ(message_p), false, false); - } + } break; case TERMINATE_MESSAGE: