From c4e3c774ce0f1d3c35ecbbaf3449707913177202 Mon Sep 17 00:00:00 2001 From: Navid Nikaein <navid.nikaein@eurecom.fr> Date: Mon, 24 Mar 2014 09:47:24 +0000 Subject: [PATCH] *updates for OAI E-UTRAN and LTEBox EPC IOT git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5209 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair-cn/GTPV1-U/gtpv1u.h | 5 +- openair-cn/GTPV1-U/gtpv1u_eNB.c | 7 +- openair-cn/S1AP/s1ap_common.h | 4 +- openair-cn/S1AP/s1ap_eNB_decoder.c | 4 +- openair-cn/S1AP/s1ap_eNB_nas_procedures.c | 8 +- openair-cn/SCTP/sctp_common.h | 2 +- openair-cn/SCTP/sctp_eNB_task.c | 6 +- openair-cn/UDP/udp_eNB_task.c | 280 +++++++++++++++------- openair1/SCHED/phy_procedures_lte_eNb.c | 10 +- openair1/SIMULATION/LTE_PHY/dlsim.c | 4 +- openair2/ENB_APP/Makefile.inc | 7 +- openair2/ENB_APP/enb_app.c | 90 +++---- openair2/ENB_APP/enb_app.h | 65 ++--- openair2/LAYER2/MAC/defs.h | 6 +- openair2/LAYER2/MAC/eNB_scheduler.c | 5 +- openair2/LAYER2/Makefile.inc | 3 + openair2/RRC/LITE/MESSAGES/asn1_msg.c | 15 +- openair2/RRC/LITE/rrc_eNB.c | 8 +- openair2/RRC/LITE/rrc_eNB_S1AP.c | 175 ++++++++------ targets/COMMON/create_tasks.c | 7 + targets/TEST/OAI/case12.py | 9 +- 21 files changed, 451 insertions(+), 269 deletions(-) diff --git a/openair-cn/GTPV1-U/gtpv1u.h b/openair-cn/GTPV1-U/gtpv1u.h index 06825b5f13..5d2fe202e5 100644 --- a/openair-cn/GTPV1-U/gtpv1u.h +++ b/openair-cn/GTPV1-U/gtpv1u.h @@ -42,8 +42,9 @@ Address : EURECOM, /* When gtpv1u is compiled for eNB use MACRO from UTILS/log.h, * otherwise use standard fprintf as logger. */ -#if defined(ENB_MODE) -# define GTPU_DEBUG(x, args...) LOG_D(GTPU, x, ##args) +//#if defined(ENB_MODE) +#if 0 +# define GTPU_DEBUG(x, args...) LOG_I(GTPU, x, ##args) # define GTPU_INFO(x, args...) LOG_I(GTPU, x, ##args) # define GTPU_WARN(x, args...) LOG_W(GTPU, x, ##args) # define GTPU_ERROR(x, args...) LOG_E(GTPU, x, ##args) diff --git a/openair-cn/GTPV1-U/gtpv1u_eNB.c b/openair-cn/GTPV1-U/gtpv1u_eNB.c index 2ee4f71a1d..20f40135f5 100644 --- a/openair-cn/GTPV1-U/gtpv1u_eNB.c +++ b/openair-cn/GTPV1-U/gtpv1u_eNB.c @@ -483,7 +483,7 @@ gtpv1u_new_data_req( bearer_p->state); #warning LG: HACK WHILE WAITING FOR NAS, normally return -1 if (bearer_p->state != BEARER_IN_CONFIG) - return -1; + return -1; } memset(&stack_req, 0, sizeof(NwGtpv1uUlpApiT)); @@ -492,6 +492,7 @@ gtpv1u_new_data_req( stack_req.apiInfo.sendtoInfo.teid = bearer_p->teid_sgw; stack_req.apiInfo.sendtoInfo.ipAddr = bearer_p->sgw_ip_addr; + LOG_W(GTPU, "TX TO TEID %u addr 0x%x\n",bearer_p->teid_sgw, bearer_p->sgw_ip_addr); rc = nwGtpv1uGpduMsgNew(gtpv1u_data_p->gtpv1u_stack, bearer_p->teid_sgw, NW_FALSE, @@ -533,6 +534,7 @@ static int gtpv1u_create_s1u_tunnel(gtpv1u_enb_create_tunnel_req_t *create_tunne hashtable_rc_t hash_rc = HASH_TABLE_KEY_NOT_EXISTS; int i; ebi_t eps_bearer_id = 0; + int ipv4_addr = 0; message_p = itti_alloc_new_message(TASK_GTPV1_U, GTPV1U_ENB_CREATE_TUNNEL_RESP); GTPV1U_ENB_CREATE_TUNNEL_RESP(message_p).ue_index = create_tunnel_req_pP->ue_index; @@ -576,7 +578,8 @@ static int gtpv1u_create_s1u_tunnel(gtpv1u_enb_create_tunnel_req_t *create_tunne } else if (hash_rc == HASH_TABLE_OK) { gtpv1u_ue_data_p->ue_id = create_tunnel_req_pP->ue_index; gtpv1u_ue_data_p->instance_id = 0; // TO DO -#warning "TO DO TO DO gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr" + ipv4_addr = +#warning "TO DO TO DO gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].sgw_ip_addr = (uint32_t)(create_tunnel_req_pP->sgw_addr[i].buffer;" gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].state = BEARER_IN_CONFIG; gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_eNB = s1u_teid; gtpv1u_ue_data_p->bearers[eps_bearer_id - GTPV1U_BEARER_OFFSET].teid_sgw = create_tunnel_req_pP->sgw_S1u_teid[i]; diff --git a/openair-cn/S1AP/s1ap_common.h b/openair-cn/S1AP/s1ap_common.h index 362b9f9b22..4840702a3d 100644 --- a/openair-cn/S1AP/s1ap_common.h +++ b/openair-cn/S1AP/s1ap_common.h @@ -406,9 +406,9 @@ extern int asn1_xer_print; # include "s1ap_eNB_default_values.h" # define S1AP_ERROR(x, args...) LOG_E(S1AP, x, ##args) # define S1AP_WARN(x, args...) LOG_W(S1AP, x, ##args) -# define S1AP_TRAF(x, args...) LOG_T(S1AP, x, ##args) +# define S1AP_TRAF(x, args...) LOG_I(S1AP, x, ##args) # define S1AP_INFO(x, args...) LOG_I(S1AP, x, ##args) -# define S1AP_DEBUG(x, args...) LOG_D(S1AP, x, ##args) +# define S1AP_DEBUG(x, args...) LOG_I(S1AP, x, ##args) #else # include "mme_default_values.h" # define S1AP_ERROR(x, args...) do { fprintf(stdout, "[S1AP][E]"x, ##args); } while(0) diff --git a/openair-cn/S1AP/s1ap_eNB_decoder.c b/openair-cn/S1AP/s1ap_eNB_decoder.c index d3ce2c1fcf..edd4b768fa 100644 --- a/openair-cn/S1AP/s1ap_eNB_decoder.c +++ b/openair-cn/S1AP/s1ap_eNB_decoder.c @@ -82,8 +82,8 @@ static int s1ap_eNB_decode_initiating_message(s1ap_message *message, default: S1AP_ERROR("Unknown procedure ID (%d) for initiating message\n", (int)initiating_p->procedureCode); - AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n", - (int)initiating_p->procedureCode); + //AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n", + // (int)initiating_p->procedureCode); return -1; } diff --git a/openair-cn/S1AP/s1ap_eNB_nas_procedures.c b/openair-cn/S1AP/s1ap_eNB_nas_procedures.c index 410a5ccac2..dd228ddf95 100644 --- a/openair-cn/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair-cn/S1AP/s1ap_eNB_nas_procedures.c @@ -402,14 +402,14 @@ void s1ap_eNB_nas_non_delivery_ind(instance_t instance, int s1ap_eNB_initial_ctxt_resp( instance_t instance, s1ap_initial_context_setup_resp_t *initial_ctxt_resp_p) { - s1ap_eNB_instance_t *s1ap_eNB_instance_p; - struct s1ap_eNB_ue_context_s *ue_context_p; + s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; + struct s1ap_eNB_ue_context_s *ue_context_p = NULL; - S1ap_InitialContextSetupResponseIEs_t *initial_ies_p; + S1ap_InitialContextSetupResponseIEs_t *initial_ies_p = NULL; s1ap_message message; - uint8_t *buffer; + uint8_t *buffer = NULL; uint32_t length; int ret = -1; int i; diff --git a/openair-cn/SCTP/sctp_common.h b/openair-cn/SCTP/sctp_common.h index c636c683ce..6053e6b15f 100644 --- a/openair-cn/SCTP/sctp_common.h +++ b/openair-cn/SCTP/sctp_common.h @@ -47,7 +47,7 @@ # include "UTIL/LOG/log.h" # define SCTP_ERROR(x, args...) LOG_E(SCTP, x, ##args) # define SCTP_WARN(x, args...) LOG_W(SCTP, x, ##args) -# define SCTP_DEBUG(x, args...) LOG_D(SCTP, x, ##args) +# define SCTP_DEBUG(x, args...) LOG_I(SCTP, x, ##args) #else # define SCTP_ERROR(x, args...) do { fprintf(stderr, "[SCTP][E]"x, ##args); } while(0) # define SCTP_DEBUG(x, args...) do { fprintf(stdout, "[SCTP][D]"x, ##args); } while(0) diff --git a/openair-cn/SCTP/sctp_eNB_task.c b/openair-cn/SCTP/sctp_eNB_task.c index 4455d0208e..9488057966 100644 --- a/openair-cn/SCTP/sctp_eNB_task.c +++ b/openair-cn/SCTP/sctp_eNB_task.c @@ -549,17 +549,17 @@ inline void sctp_eNB_read_from_socket(struct sctp_cnx_list_elm_s *sctp_cnx) } else { sctp_cnx->nb_messages++; - if (sinfo.sinfo_ppid != sctp_cnx->ppid) { + if (ntohl(sinfo.sinfo_ppid) != sctp_cnx->ppid) { /* Mismatch in Payload Protocol Identifier, * may be we received unsollicited traffic from stack other than S1AP. */ SCTP_ERROR("Received data from peer with unsollicited PPID %d, expecting %d\n", - sinfo.sinfo_ppid, sctp_cnx->ppid); + ntohl(sinfo.sinfo_ppid), sctp_cnx->ppid); } SCTP_DEBUG("[%d][%d] Msg of length %d received from port %u, on stream %d, PPID %d\n", sinfo.sinfo_assoc_id, sctp_cnx->sd, n, ntohs(addr.sin_port), - sinfo.sinfo_stream, sinfo.sinfo_ppid); + sinfo.sinfo_stream, ntohl(sinfo.sinfo_ppid)); sctp_itti_send_new_message_ind(sctp_cnx->task_id, sinfo.sinfo_assoc_id, diff --git a/openair-cn/UDP/udp_eNB_task.c b/openair-cn/UDP/udp_eNB_task.c index 2c4461db4f..59a1a83fba 100644 --- a/openair-cn/UDP/udp_eNB_task.c +++ b/openair-cn/UDP/udp_eNB_task.c @@ -1,32 +1,40 @@ /******************************************************************************* - - Eurecom OpenAirInterface - Copyright(c) 1999 - 2014 Eurecom - - This program is free software; you can redistribute it and/or modify it - under the terms and conditions of the GNU General Public License, - version 2, as published by the Free Software Foundation. - - This program is distributed in the hope 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 - this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - - 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 - +Eurecom OpenAirInterface core network +Copyright(c) 1999 - 2014 Eurecom + +This program is free software; you can redistribute it and/or modify it +under the terms and conditions of the GNU General Public License, +version 2, as published by the Free Software Foundation. + +This program is distributed in the hope 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 +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + +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.fsr/openairinterface +Address : EURECOM, + Campus SophiaTech, + 450 Route des Chappes, + CS 50193 + 06904 Biot Sophia Antipolis cedex, + FRANCE *******************************************************************************/ +/*! \file udp_eNB_task.c +* \brief +* \author Sebastien ROUX, Lionel Gauthier +* \company Eurecom +* \email: lionel.gauthier@eurecom.fr +*/ #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -53,7 +61,6 @@ (uint8_t)(((aDDRESS) & 0x00ff0000) >> 16), \ (uint8_t)(((aDDRESS) & 0xff000000) >> 24) -static void *udp_receiver_thread(void *arg_p); struct udp_socket_desc_s { int sd; /* Socket descriptor to use */ @@ -72,10 +79,38 @@ static STAILQ_HEAD(udp_socket_list_s, udp_socket_desc_s) udp_socket_list; static pthread_mutex_t udp_socket_list_mutex = PTHREAD_MUTEX_INITIALIZER; +static +struct udp_socket_desc_s * +udp_eNB_get_socket_desc(task_id_t task_id); + +void udp_eNB_process_file_descriptors( + struct epoll_event *events, + int nb_events); + +static +int +udp_eNB_create_socket( + int port, + char *ip_addr, + task_id_t task_id); + +int +udp_eNB_send_to( + int sd, + uint16_t port, + uint32_t address, + const uint8_t *buffer, + uint32_t length); + +void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP); + +void *udp_eNB_task(void *args_p); + +int udp_enb_init(const Enb_properties_t *enb_config_p); /* @brief Retrieve the descriptor associated with the task_id */ static -struct udp_socket_desc_s *udp_get_socket_desc(task_id_t task_id) +struct udp_socket_desc_s *udp_eNB_get_socket_desc(task_id_t task_id) { struct udp_socket_desc_s *udp_sock_p = NULL; @@ -90,11 +125,31 @@ struct udp_socket_desc_s *udp_get_socket_desc(task_id_t task_id) return udp_sock_p; } +void udp_eNB_process_file_descriptors(struct epoll_event *events, int nb_events) +{ + int i; + struct udp_socket_desc_s *udp_sock_p = NULL; + + if (events == NULL) { + return; + } + + for (i = 0; i < nb_events; i++) { + STAILQ_FOREACH(udp_sock_p, &udp_socket_list, entries) { + if (udp_sock_p->sd == events[i].data.fd) { + LOG_D(UDP_, "Found matching task desc\n"); + udp_eNB_receiver(udp_sock_p); + break; + } + } + } +} + static -int udp_create_socket(int port, char *ip_addr, task_id_t task_id) +int udp_eNB_create_socket(int port, char *ip_addr, task_id_t task_id) { - struct udp_socket_desc_s *thread_arg; + struct udp_socket_desc_s *udp_socket_desc_p = NULL; int sd, rc; struct sockaddr_in sin; @@ -118,53 +173,83 @@ int udp_create_socket(int port, char *ip_addr, task_id_t task_id) } /* Create a new descriptor for this connection */ - thread_arg = calloc(1, sizeof(struct udp_socket_desc_s)); + udp_socket_desc_p = calloc(1, sizeof(struct udp_socket_desc_s)); - DevAssert(thread_arg != NULL); + DevAssert(udp_socket_desc_p != NULL); - thread_arg->sd = sd; - thread_arg->local_address = ip_addr; - thread_arg->local_port = port; - thread_arg->task_id = task_id; + udp_socket_desc_p->sd = sd; + udp_socket_desc_p->local_address = ip_addr; + udp_socket_desc_p->local_port = port; + udp_socket_desc_p->task_id = task_id; - if (pthread_create(&thread_arg->listener_thread, NULL, - &udp_receiver_thread, (void *)thread_arg) < 0) { - LOG_E(UDP_, "Pthred_create failed (%s)\n", strerror(errno)); - return -1; - } + LOG_I(UDP_, "Inserting new descriptor for task %d, sd %d\n", udp_socket_desc_p->task_id, udp_socket_desc_p->sd); + pthread_mutex_lock(&udp_socket_list_mutex); + STAILQ_INSERT_TAIL(&udp_socket_list, udp_socket_desc_p, entries); + pthread_mutex_unlock(&udp_socket_list_mutex); + + itti_subscribe_event_fd(TASK_UDP, sd); LOG_I(UDP_, "Initializing UDP for local address %s with port %d: DONE\n", ip_addr, port); return sd; } -static void *udp_receiver_thread(void *arg_p) +int +udp_eNB_send_to( + int sd, + uint16_t port, + uint32_t address, + const uint8_t *buffer, + uint32_t length) { - struct udp_socket_desc_s *udp_sock_p; - uint8_t buffer[2048]; + struct sockaddr_in to; + socklen_t to_length; - udp_sock_p = (struct udp_socket_desc_s *)arg_p; - LOG_D(UDP_, "Inserting new descriptor for task %d, sd %d\n", udp_sock_p->task_id, udp_sock_p->sd); - pthread_mutex_lock(&udp_socket_list_mutex); - STAILQ_INSERT_TAIL(&udp_socket_list, udp_sock_p, entries); - pthread_mutex_unlock(&udp_socket_list_mutex); + if (sd <= 0 || ((buffer == NULL) && (length > 0))) { + LOG_E(UDP_, "udp_send_to: bad param\n"); + return -1; + } - while (1) { + memset(&to, 0, sizeof(struct sockaddr_in)); + to_length = sizeof(to); + + to.sin_family = AF_INET; + to.sin_port = htons(port); + to.sin_addr.s_addr = address; + + if (sendto(sd, (void *)buffer, (size_t)length, 0, (struct sockaddr *)&to, + to_length) < 0) { + LOG_E(UDP_, + "[SD %d] Failed to send data to "IPV4_ADDR" on port %d, buffer size %u\n", + sd, IPV4_ADDR_FORMAT(address), port, length); + return -1; + } + LOG_I(UDP_, "[SD %d] Successfully sent to "IPV4_ADDR + " on port %d, buffer size %u, buffer address %x\n", + sd, IPV4_ADDR_FORMAT(address), port, length, buffer); + return 0; +} + + +void udp_eNB_receiver(struct udp_socket_desc_s *udp_sock_pP) +{ + uint8_t l_buffer[2048]; int n; socklen_t from_len; struct sockaddr_in addr; + MessageDef *message_p = NULL; + udp_data_ind_t *udp_data_ind_p = NULL; + uint8_t *forwarded_buffer = NULL; + while (1) { from_len = (socklen_t)sizeof(struct sockaddr_in); - if ((n = recvfrom(udp_sock_p->sd, buffer, sizeof(buffer), 0, + LOG_I(UDP_, "before recvfrom sd %d\n", udp_sock_pP->sd); + if ((n = recvfrom(udp_sock_pP->sd, l_buffer, sizeof(l_buffer), 0, (struct sockaddr *)&addr, &from_len)) < 0) { LOG_E(UDP_, "Recvfrom failed %s\n", strerror(errno)); break; } else { - MessageDef *message_p = NULL; - udp_data_ind_t *udp_data_ind_p; - uint8_t *forwarded_buffer = NULL; - forwarded_buffer = calloc(n, sizeof(uint8_t)); - memcpy(forwarded_buffer, buffer, n); + memcpy(forwarded_buffer, l_buffer, n); message_p = itti_alloc_new_message(TASK_UDP, UDP_DATA_IND); DevAssert(message_p != NULL); udp_data_ind_p = &message_p->ittiMsg.udp_data_ind; @@ -173,42 +258,53 @@ static void *udp_receiver_thread(void *arg_p) udp_data_ind_p->peer_port = htons(addr.sin_port); udp_data_ind_p->peer_address = addr.sin_addr.s_addr; - LOG_D(UDP_, "Msg of length %d received from %s:%u\n", + LOG_I(UDP_, "Msg of length %d received from %s:%u\n", n, inet_ntoa(addr.sin_addr), ntohs(addr.sin_port)); - if (itti_send_msg_to_task(udp_sock_p->task_id, INSTANCE_DEFAULT, message_p) < 0) { - LOG_D(UDP_, "Failed to send message %d to task %d\n", - UDP_DATA_IND, udp_sock_p->task_id); + if (itti_send_msg_to_task(udp_sock_pP->task_id, INSTANCE_DEFAULT, message_p) < 0) { + LOG_I(UDP_, "Failed to send message %d to task %d\n", + UDP_DATA_IND, + udp_sock_pP->task_id); break; } } } - close(udp_sock_p->sd); - udp_sock_p->sd = -1; + //close(udp_sock_p->sd); + //udp_sock_p->sd = -1; - pthread_mutex_lock(&udp_socket_list_mutex); - STAILQ_REMOVE(&udp_socket_list, udp_sock_p, udp_socket_desc_s, entries); - pthread_mutex_unlock(&udp_socket_list_mutex); - - return NULL; + //pthread_mutex_lock(&udp_socket_list_mutex); + //STAILQ_REMOVE(&udp_socket_list, udp_sock_p, udp_socket_desc_s, entries); + //pthread_mutex_unlock(&udp_socket_list_mutex); } void *udp_eNB_task(void *args_p) { + int nb_events; + struct epoll_event *events; + MessageDef *received_message_p = NULL; + const char *msg_name = NULL; + instance_t instance = 0; + udp_enb_init(NULL); + itti_mark_task_ready(TASK_UDP); while(1) { - MessageDef *received_message_p = NULL; itti_receive_msg(TASK_UDP, &received_message_p); - DevAssert(received_message_p != NULL); + if (received_message_p != NULL) { + + msg_name = ITTI_MSG_NAME (received_message_p); + instance = ITTI_MSG_INSTANCE (received_message_p); switch (ITTI_MSG_ID(received_message_p)) { case UDP_INIT: { udp_init_t *udp_init_p; udp_init_p = &received_message_p->ittiMsg.udp_init; - udp_create_socket(udp_init_p->port, udp_init_p->address, - ITTI_MSG_ORIGIN_ID(received_message_p)); + udp_eNB_create_socket( + udp_init_p->port, + udp_init_p->address, + ITTI_MSG_ORIGIN_ID(received_message_p)); } break; + case UDP_DATA_REQ: { int udp_sd = -1; ssize_t bytes_written; @@ -226,11 +322,13 @@ void *udp_eNB_task(void *args_p) peer_addr.sin_addr.s_addr = udp_data_req_p->peer_address; pthread_mutex_lock(&udp_socket_list_mutex); - udp_sock_p = udp_get_socket_desc(ITTI_MSG_ORIGIN_ID(received_message_p)); + udp_sock_p = udp_eNB_get_socket_desc(ITTI_MSG_ORIGIN_ID(received_message_p)); if (udp_sock_p == NULL) { - LOG_E(UDP_, "Failed to retrieve the udp socket descriptor " - "associated with task %d\n", ITTI_MSG_ORIGIN_ID(received_message_p)); + LOG_E(UDP_, + "Failed to retrieve the udp socket descriptor " + "associated with task %d\n", + ITTI_MSG_ORIGIN_ID(received_message_p)); pthread_mutex_unlock(&udp_socket_list_mutex); if (udp_data_req_p->buffer) { free(udp_data_req_p->buffer); @@ -240,13 +338,17 @@ void *udp_eNB_task(void *args_p) udp_sd = udp_sock_p->sd; pthread_mutex_unlock(&udp_socket_list_mutex); - LOG_D(UDP_, "[%d] Sending message of size %u to "IPV4_ADDR" and port %u\n", - udp_sd, udp_data_req_p->buffer_length, + LOG_I(UDP_, "[%d] Sending message of size %u to "IPV4_ADDR" and port %u\n", + udp_sd, + udp_data_req_p->buffer_length, IPV4_ADDR_FORMAT(udp_data_req_p->peer_address), udp_data_req_p->peer_port); - bytes_written = sendto(udp_sd, udp_data_req_p->buffer, - udp_data_req_p->buffer_length, 0, + bytes_written = sendto( + udp_sd, + udp_data_req_p->buffer, + udp_data_req_p->buffer_length, + 0, (struct sockaddr *)&peer_addr, sizeof(struct sockaddr_in)); @@ -255,27 +357,37 @@ void *udp_eNB_task(void *args_p) "(%d:%s)\n", errno, strerror(errno)); } } break; + case TERMINATE_MESSAGE: { itti_exit_task(); } break; + case MESSAGE_TEST: { } break; + default: { - LOG_D(UDP_, "Unkwnon message ID %d:%s\n", - ITTI_MSG_ID(received_message_p), ITTI_MSG_NAME(received_message_p)); + LOG_I(UDP_, "Unkwnon message ID %d:%s\n", + ITTI_MSG_ID(received_message_p), + ITTI_MSG_NAME(received_message_p)); } break; } on_error: - free(received_message_p); + itti_free (ITTI_MSG_ORIGIN_ID(received_message_p), received_message_p); received_message_p = NULL; + } + nb_events = itti_get_events(TASK_UDP, &events); + /* Now handle notifications for other sockets */ + if (nb_events > 0) { + udp_eNB_process_file_descriptors(events, nb_events); + } } return NULL; } int udp_enb_init(const Enb_properties_t *enb_config_p) { - LOG_D(UDP_, "Initializing UDP task interface\n"); + LOG_I(UDP_, "Initializing UDP task interface\n"); STAILQ_INIT(&udp_socket_list); - LOG_D(UDP_, "Initializing UDP task interface: DONE\n"); + LOG_I(UDP_, "Initializing UDP task interface: DONE\n"); return 0; } diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 7a2e8ef624..40e7557892 100755 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -2943,7 +2943,7 @@ void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,ui phy_vars_eNB->eNB_UE_stats[i].UL_rssi[j] = dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[i]->ulsch_power[j]) - phy_vars_eNB->rx_total_gain_eNB_dB; #ifdef DEBUG_PHY_PROC - LOG_D(PHY,"[eNB %d] Frame %d subframe %d: ULSCH %d RX power (%d,%d) dB\n", + LOG_I(PHY,"[eNB %d] Frame %d subframe %d: ULSCH %d RX power (%d,%d) dB\n", phy_vars_eNB->Mod_id,frame,last_slot>>1,i, dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[i]->ulsch_power[0]), dB_fixed(phy_vars_eNB->lte_eNB_pusch_vars[i]->ulsch_power[1])); @@ -3058,9 +3058,10 @@ void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,ui } // If we've dropped the UE, go back to PRACH mode for this UE - if (phy_vars_eNB->eNB_UE_stats[i].ulsch_consecutive_errors[harq_pid] == 20) { - LOG_I(PHY,"[eNB %d] frame %d, subframe %d, UE %d: ULSCH consecutive error count reached, removing UE\n", - phy_vars_eNB->Mod_id,frame,last_slot>>1, i); +#if !defined(EXMIMO_IOT) + if (phy_vars_eNB->eNB_UE_stats[i].ulsch_consecutive_errors[harq_pid] == 20) { + LOG_I(PHY,"[eNB %d] frame %d, subframe %d, UE %d: ULSCH consecutive error count reached %u, removing UE\n", + phy_vars_eNB->Mod_id,frame,last_slot>>1, i, phy_vars_eNB->eNB_UE_stats[i].ulsch_consecutive_errors[harq_pid]); phy_vars_eNB->eNB_UE_stats[i].mode = PRACH; #ifdef OPENAIR2 mac_xface->cancel_ra_proc(phy_vars_eNB->Mod_id, @@ -3070,6 +3071,7 @@ void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,ui remove_ue(phy_vars_eNB->eNB_UE_stats[i].crnti,phy_vars_eNB,abstraction_flag); phy_vars_eNB->eNB_UE_stats[i].ulsch_consecutive_errors[harq_pid]=0; } +#endif } } // ulsch in error else { diff --git a/openair1/SIMULATION/LTE_PHY/dlsim.c b/openair1/SIMULATION/LTE_PHY/dlsim.c index a261c1b27c..2d53d11291 100644 --- a/openair1/SIMULATION/LTE_PHY/dlsim.c +++ b/openair1/SIMULATION/LTE_PHY/dlsim.c @@ -2468,8 +2468,8 @@ int main(int argc, char **argv) { } //ABStraction if ( (test_perf != 0) && (100 * effective_rate > test_perf )) { - fprintf(bler_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3; dci_err\n"); - fprintf(bler_fd,"%f;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d\n", + fprintf(time_meas_fd,"SNR; MCS; TBS; rate; err0; trials0; err1; trials1; err2; trials2; err3; trials3; dci_err\n"); + fprintf(time_meas_fd,"%f;%d;%d;%f;%d;%d;%d;%d;%d;%d;%d;%d;%d\n", SNR, mcs, PHY_vars_eNB->dlsch_eNB[0][0]->harq_processes[0]->TBS, diff --git a/openair2/ENB_APP/Makefile.inc b/openair2/ENB_APP/Makefile.inc index 7bb09035cd..cb31d32c13 100644 --- a/openair2/ENB_APP/Makefile.inc +++ b/openair2/ENB_APP/Makefile.inc @@ -1,6 +1,7 @@ ENB_APP_DIR = $(OPENAIR2_TOP)/ENB_APP -ENB_APP_OBJS = $(ENB_APP_DIR)/enb_app.o $(ENB_APP_DIR)/enb_config.o - +ENB_APP_OBJS = $(ENB_APP_DIR)/enb_app.o \ + $(ENB_APP_DIR)/enb_config.o ENB_APP_incl = \ - -I$(ENB_APP_DIR) + -I$(ENB_APP_DIR) + \ No newline at end of file diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index e04da1da30..7dc1329f5a 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -1,32 +1,41 @@ /******************************************************************************* - - Eurecom OpenAirInterface - Copyright(c) 1999 - 2012 Eurecom - - This program is free software; you can redistribute it and/or modify it - under the terms and conditions of the GNU General Public License, - version 2, as published by the Free Software Foundation. - - This program is distributed in the hope 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 - this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - - 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 - - *******************************************************************************/ +Eurecom OpenAirInterface 2 +Copyright(c) 1999 - 2014 Eurecom + +This program is free software; you can redistribute it and/or modify it +under the terms and conditions of the GNU General Public License, +version 2, as published by the Free Software Foundation. + +This program is distributed in the hope 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 +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + +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.fsr/openairinterface +Address : EURECOM, + Campus SophiaTech, + 450 Route des Chappes, + CS 50193 + 06904 Biot Sophia Antipolis cedex, + FRANCE +*******************************************************************************/ +/* + enb_app.c + ------------------- + AUTHOR : Laurent Winckel, Sebastien ROUX, Lionel GAUTHIER + COMPANY : EURECOM + EMAIL : Lionel.Gauthier@eurecom.fr +*/ #include <string.h> #include <stdio.h> @@ -47,9 +56,7 @@ # if defined(ENABLE_USE_MME) # include "s1ap_eNB.h" # include "sctp_eNB_task.h" -# if defined(LINK_PDCP_TO_GTPV1U) -# include "gtpv1u_eNB_defs.h" -# endif +# include "gtpv1u_eNB_task.h" # endif extern unsigned char NB_eNB_INST; @@ -169,7 +176,7 @@ static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end, con /*------------------------------------------------------------------------------*/ void *eNB_app_task(void *args_p) { - const Enb_properties_array_t *enb_properties = NULL; + const Enb_properties_array_t *enb_properties_p = NULL; #if defined(ENABLE_ITTI) uint32_t enb_nb = 1; /* Default number of eNB is 1 */ uint32_t enb_id_start = 0; @@ -199,25 +206,22 @@ void *eNB_app_task(void *args_p) # endif # endif - enb_properties = enb_config_get(); + enb_properties_p = enb_config_get(); - AssertFatal (enb_nb <= enb_properties->number, + AssertFatal (enb_nb <= enb_properties_p->number, "Number of eNB is greater than eNB defined in configuration file (%d/%d)!", - enb_nb, enb_properties->number); + enb_nb, enb_properties_p->number); for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { - configure_phy(enb_id, enb_properties); - configure_rrc(enb_id, enb_properties); + configure_phy(enb_id, enb_properties_p); + configure_rrc(enb_id, enb_properties_p); } # if defined(ENABLE_USE_MME) -# if defined(LINK_PDCP_TO_GTPV1U) - gtpv1u_eNB_init(enb_properties->properties[0]); -# endif /* Try to register each eNB */ registered_enb = 0; - register_enb_pending = eNB_app_register (enb_id_start, enb_id_end, enb_properties); + register_enb_pending = eNB_app_register (enb_id_start, enb_id_end, enb_properties_p); # else /* Start L2L1 task */ msg_p = itti_alloc_new_message(TASK_ENB_APP, INITIALIZE_MESSAGE); @@ -293,7 +297,7 @@ void *eNB_app_task(void *args_p) sleep(ENB_REGISTER_RETRY_DELAY); /* Restart the registration process */ registered_enb = 0; - register_enb_pending = eNB_app_register (enb_id_start, enb_id_end, enb_properties); + register_enb_pending = eNB_app_register (enb_id_start, enb_id_end, enb_properties_p); } } } @@ -313,7 +317,7 @@ void *eNB_app_task(void *args_p) { /* Restart the registration process */ registered_enb = 0; - register_enb_pending = eNB_app_register (enb_id_start, enb_id_end, enb_properties); + register_enb_pending = eNB_app_register (enb_id_start, enb_id_end, enb_properties_p); } break; # endif diff --git a/openair2/ENB_APP/enb_app.h b/openair2/ENB_APP/enb_app.h index fea50a0ad9..fdae8befd4 100644 --- a/openair2/ENB_APP/enb_app.h +++ b/openair2/ENB_APP/enb_app.h @@ -1,36 +1,47 @@ /******************************************************************************* - - Eurecom OpenAirInterface - Copyright(c) 1999 - 2012 Eurecom - - This program is free software; you can redistribute it and/or modify it - under the terms and conditions of the GNU General Public License, - version 2, as published by the Free Software Foundation. - - This program is distributed in the hope 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 - this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - - 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 - +Eurecom OpenAirInterface 2 +Copyright(c) 1999 - 2014 Eurecom + +This program is free software; you can redistribute it and/or modify it +under the terms and conditions of the GNU General Public License, +version 2, as published by the Free Software Foundation. + +This program is distributed in the hope 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 +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + +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.fsr/openairinterface +Address : EURECOM, + Campus SophiaTech, + 450 Route des Chappes, + CS 50193 + 06904 Biot Sophia Antipolis cedex, + FRANCE *******************************************************************************/ +/* + enb_app.h + ------------------- + AUTHOR : Laurent Winckel, Sebastien ROUX, Lionel GAUTHIER + COMPANY : EURECOM + EMAIL : Lionel.Gauthier@eurecom.fr +*/ #ifndef ENB_APP_H_ #define ENB_APP_H_ + + void *eNB_app_task(void *args_p); #endif /* ENB_APP_H_ */ diff --git a/openair2/LAYER2/MAC/defs.h b/openair2/LAYER2/MAC/defs.h index bd4bf4b670..4b83ba577a 100644 --- a/openair2/LAYER2/MAC/defs.h +++ b/openair2/LAYER2/MAC/defs.h @@ -84,8 +84,12 @@ #define CCCH 0 // srb0 #define DCCH 1 // srb1 #define DCCH1 2 // srb2 -#define DTCH 3 // DTCH + lcid < 11 +#ifdef EXMIMO_IOT +#define DTCH 5 // DTCH + lcid < 11 +#else +#define DTCH 3 +#endif #define MCCH 4 // MCCH #define MTCH 1 // MTCH diff --git a/openair2/LAYER2/MAC/eNB_scheduler.c b/openair2/LAYER2/MAC/eNB_scheduler.c index 423861e09c..0a2218fecd 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler.c +++ b/openair2/LAYER2/MAC/eNB_scheduler.c @@ -2259,14 +2259,11 @@ void schedule_ulsch_rnti(module_id_t module_idP, status = mac_get_rrc_status(module_idP,1,next_ue); -#ifndef EXMIMO_IOT if (status < RRC_CONNECTED) cqi_req = 0; else cqi_req = 1; -#else - cqi_req = 0; -#endif + if (round > 0) { ndi = eNB_mac_inst[module_idP].UE_template[ue_mod_id].oldNDI_UL[harq_pid]; diff --git a/openair2/LAYER2/Makefile.inc b/openair2/LAYER2/Makefile.inc index 1176e0abfc..ebc7f1700d 100644 --- a/openair2/LAYER2/Makefile.inc +++ b/openair2/LAYER2/Makefile.inc @@ -77,6 +77,9 @@ endif RRC_OBJS += $(RRC_DIR)/rrc_eNB.o RRC_OBJS += $(RRC_DIR)/rrc_eNB_S1AP.o +ifdef USE_MME +RRC_OBJS += $(RRC_DIR)/rrc_eNB_GTPV1U.o +endif RRC_OBJS += $(RRC_DIR)/rrc_common.o RRC_OBJS += $(RRC_DIR)/L2_interface.o diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index 73e3608eab..45e906c6e4 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -663,7 +663,7 @@ uint8_t do_SIB2_AT4(uint8_t Mod_id, (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset = 0; // PDSCH-Config - (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower=24; + (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower=-24; (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b=0; // PUSCH-Config @@ -1489,7 +1489,7 @@ uint8_t do_RRCConnectionSetup(uint8_t Mod_id, physicalConfigDedicated2->uplinkPowerControlDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated)); physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); - physicalConfigDedicated2->cqi_ReportConfig = NULL;//CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL;//CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); @@ -1544,11 +1544,16 @@ uint8_t do_RRCConnectionSetup(uint8_t Mod_id, physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused=0; // CQI ReportConfig - /* + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); - assign_enum(physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic, - CQI_ReportConfig__cqi_ReportModeAperiodic_rm30); // HLC CQI, no PMI +#ifdef Rel10 + *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic= CQI_ReportModeAperiodic_rm30; +#else + *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CQI_ReportConfig__cqi_ReportModeAperiodic_rm30; // HLC CQI, no PMI +#endif physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=NULL; +/* physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 405537ee16..b325558718 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -74,6 +74,7 @@ #if defined(ENABLE_USE_MME) # include "rrc_eNB_S1AP.h" +# include "rrc_eNB_GTPV1U.h" # if defined(ENABLE_ITTI) # else # include "../../S1AP/s1ap_eNB.h" @@ -709,7 +710,7 @@ static void rrc_eNB_generate_defaultRRCConnectionReconfiguration( // NN: this is the 1st DRB for this ue, so set it to 1 DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32 DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); - *(DRB_config->logicalChannelIdentity) = (long)3; + *(DRB_config->logicalChannelIdentity) = (long)5; DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); DRB_config->rlc_Config = DRB_rlc_config; @@ -3094,6 +3095,11 @@ void *rrc_enb_task( case S1AP_UE_CONTEXT_RELEASE_REQ: rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance); break; + + case GTPV1U_ENB_CREATE_TUNNEL_RESP: + rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP(msg_p, msg_name_p, instance); + break; + # endif /* Messages from eNB app */ diff --git a/openair2/RRC/LITE/rrc_eNB_S1AP.c b/openair2/RRC/LITE/rrc_eNB_S1AP.c index 318de543a6..bca5fdb2ba 100644 --- a/openair2/RRC/LITE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LITE/rrc_eNB_S1AP.c @@ -1,31 +1,34 @@ /******************************************************************************* - - Eurecom OpenAirInterface 2 - Copyright(c) 1999 - 2010 Eurecom - - This program is free software; you can redistribute it and/or modify it - under the terms and conditions of the GNU General Public License, - version 2, as published by the Free Software Foundation. - - This program is distributed in the hope 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 - this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. - - 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.fsr/openairinterface - Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France - - *******************************************************************************/ +Eurecom OpenAirInterface 2 +Copyright(c) 1999 - 2014 Eurecom + +This program is free software; you can redistribute it and/or modify it +under the terms and conditions of the GNU General Public License, +version 2, as published by the Free Software Foundation. + +This program is distributed in the hope 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 +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. + +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.fsr/openairinterface +Address : EURECOM, + Campus SophiaTech, + 450 Route des Chappes, + CS 50193 + 06904 Biot Sophia Antipolis cedex, + FRANCE +*******************************************************************************/ /*! \file rrc_eNB_S1AP.c * \brief rrc S1AP procedures for eNB @@ -263,7 +266,7 @@ static void process_eNB_security_key (uint8_t mod_id, uint8_t ue_index, uint8_t /*------------------------------------------------------------------------------*/ void rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(uint8_t mod_id, uint8_t ue_index) { eNB_RRC_UE_INFO *UE_info = &eNB_rrc_inst[mod_id].Info.UE[ue_index]; - MessageDef *msg_p; + MessageDef *msg_p = NULL; int e_rab; int e_rabs_done = 0; int e_rabs_failed = 0; @@ -275,6 +278,11 @@ void rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(uint8_t mod_id, uint8_t ue_ind e_rabs_done++; S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].e_rab_id = UE_info->e_rab[e_rab].param.e_rab_id; // TODO add other information from S1-U when it will be integrated + S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].gtp_teid = UE_info->enb_gtp_teid[e_rab]; +#warning "hardcoded address of S1U enb" + //S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr = UE_info->enb_gtp_addrs[e_rab]; + inet_aton("192.168.13.10", S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr.buffer); + S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr.length = 4; } else { e_rabs_failed++; @@ -497,72 +505,87 @@ int rrc_eNB_process_S1AP_DOWNLINK_NAS(MessageDef *msg_p, const char *msg_name, i /*------------------------------------------------------------------------------*/ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance) { - uint16_t ue_initial_id; - uint32_t eNB_ue_s1ap_id; - uint8_t ue_index; + uint16_t ue_initial_id; + uint32_t eNB_ue_s1ap_id; + uint8_t ue_index; + MessageDef *message_gtpv1u_p = NULL; - ue_initial_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).ue_initial_id; - eNB_ue_s1ap_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).eNB_ue_s1ap_id; - ue_index = get_UE_index_from_s1ap_ids (instance, ue_initial_id, eNB_ue_s1ap_id); + ue_initial_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).ue_initial_id; + eNB_ue_s1ap_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).eNB_ue_s1ap_id; + ue_index = get_UE_index_from_s1ap_ids (instance, ue_initial_id, eNB_ue_s1ap_id); - LOG_I(RRC, "[eNB %d] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d, nb_of_e_rabs %d, ue_index %d\n", + LOG_I(RRC, "[eNB %d] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d, nb_of_e_rabs %d, ue_index %d\n", instance, msg_name, ue_initial_id, eNB_ue_s1ap_id, S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs, ue_index); - if (ue_index == UE_INDEX_INVALID) { - /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ - MessageDef *msg_fail_p; + if (ue_index == UE_INDEX_INVALID) { + /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ + MessageDef *msg_fail_p = NULL; - LOG_W(RRC, "[eNB %d] In S1AP_INITIAL_CONTEXT_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); + LOG_W(RRC, "[eNB %d] In S1AP_INITIAL_CONTEXT_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_INITIAL_CONTEXT_SETUP_FAIL); - S1AP_INITIAL_CONTEXT_SETUP_FAIL (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; + msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_INITIAL_CONTEXT_SETUP_FAIL); + S1AP_INITIAL_CONTEXT_SETUP_FAIL (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - // TODO add failure cause when defined! + // TODO add failure cause when defined! - itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); + itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); - return (-1); - } - else { - eNB_rrc_inst[instance].Info.UE[ue_index].eNB_ue_s1ap_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).eNB_ue_s1ap_id; + return (-1); + } + else { - /* Save e RAB information for later */ - { - int i; + eNB_rrc_inst[instance].Info.UE[ue_index].eNB_ue_s1ap_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).eNB_ue_s1ap_id; - eNB_rrc_inst[instance].Info.UE[ue_index].nb_of_e_rabs = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs; - for (i = 0; i < eNB_rrc_inst[instance].Info.UE[ue_index].nb_of_e_rabs; i++) { - eNB_rrc_inst[instance].Info.UE[ue_index].e_rab[i].status = E_RAB_STATUS_NEW; - eNB_rrc_inst[instance].Info.UE[ue_index].e_rab[i].param = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i]; - } - } + /* Save e RAB information for later */ + { + int i; - /* TODO parameters yet to process ... */ - { - S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_ambr; - } + message_gtpv1u_p = itti_alloc_new_message(TASK_S1AP, GTPV1U_ENB_CREATE_TUNNEL_REQ); - rrc_eNB_process_security (instance, ue_index, &S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).security_capabilities); + eNB_rrc_inst[instance].Info.UE[ue_index].nb_of_e_rabs = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs; + for (i = 0; i < eNB_rrc_inst[instance].Info.UE[ue_index].nb_of_e_rabs; i++) { + eNB_rrc_inst[instance].Info.UE[ue_index].e_rab[i].status = E_RAB_STATUS_NEW; + eNB_rrc_inst[instance].Info.UE[ue_index].e_rab[i].param = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i]; - process_eNB_security_key (instance, ue_index, S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).security_key); - { - uint8_t send_security_mode_command = TRUE; + GTPV1U_ENB_CREATE_TUNNEL_REQ(message_gtpv1u_p).eps_bearer_id[i] = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].e_rab_id; + GTPV1U_ENB_CREATE_TUNNEL_REQ(message_gtpv1u_p).sgw_S1u_teid[i] = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].gtp_teid; + memcpy(>PV1U_ENB_CREATE_TUNNEL_REQ(message_gtpv1u_p).sgw_addr[i], + &S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].sgw_addr, + sizeof(transport_layer_addr_t)); + } + GTPV1U_ENB_CREATE_TUNNEL_REQ(message_gtpv1u_p).ue_index = ue_index; // warning put zero above + GTPV1U_ENB_CREATE_TUNNEL_REQ(message_gtpv1u_p).num_tunnels = i; - if ((eNB_rrc_inst[instance].ciphering_algorithm[ue_index] == SecurityAlgorithmConfig__cipheringAlgorithm_eea0) - && (eNB_rrc_inst[instance].integrity_algorithm[ue_index] == INTEGRITY_ALGORITHM_NONE)) { - send_security_mode_command = FALSE; - } + itti_send_msg_to_task(TASK_GTPV1_U, INSTANCE_DEFAULT, message_gtpv1u_p); + } - if (send_security_mode_command) { - rrc_eNB_generate_SecurityModeCommand (instance, 0 /* TODO put frame number ! */, ue_index); - } - else { - rrc_eNB_generate_UECapabilityEnquiry (instance, 0 /* TODO put frame number ! */, ue_index); - } + /* TODO parameters yet to process ... */ + { + S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_ambr; + } + + rrc_eNB_process_security (instance, ue_index, &S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).security_capabilities); + + process_eNB_security_key (instance, ue_index, S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).security_key); + + { + uint8_t send_security_mode_command = TRUE; + + if ((eNB_rrc_inst[instance].ciphering_algorithm[ue_index] == SecurityAlgorithmConfig__cipheringAlgorithm_eea0) + && (eNB_rrc_inst[instance].integrity_algorithm[ue_index] == INTEGRITY_ALGORITHM_NONE)) { + send_security_mode_command = FALSE; + } + + if (send_security_mode_command) { + rrc_eNB_generate_SecurityModeCommand (instance, 0 /* TODO put frame number ! */, ue_index); + } + else { + rrc_eNB_generate_UECapabilityEnquiry (instance, 0 /* TODO put frame number ! */, ue_index); + } + } + return (0); } - return (0); - } } /*------------------------------------------------------------------------------*/ diff --git a/targets/COMMON/create_tasks.c b/targets/COMMON/create_tasks.c index 6c672c402a..694a625d59 100644 --- a/targets/COMMON/create_tasks.c +++ b/targets/COMMON/create_tasks.c @@ -39,6 +39,7 @@ # include "s1ap_eNB.h" # include "nas_ue_task.h" # include "udp_eNB_task.h" +# include "gtpv1u_eNB_task.h" # endif # if defined(ENABLE_RAL) # include "lteRALue.h" @@ -74,6 +75,12 @@ int create_tasks(uint32_t enb_nb, uint32_t ue_nb) LOG_E(EMU, "Create task for UDP failed\n"); return -1; } + + if (itti_create_task (TASK_GTPV1_U, >pv1u_eNB_task, NULL) < 0) + { + LOG_E(EMU, "Create task for GTPV1U failed\n"); + return -1; + } } if (ue_nb > 0) diff --git a/targets/TEST/OAI/case12.py b/targets/TEST/OAI/case12.py index 5ae9f79e8e..965f2de835 100644 --- a/targets/TEST/OAI/case12.py +++ b/targets/TEST/OAI/case12.py @@ -94,7 +94,8 @@ def execute(oai, user, pw, logfile,logdir): name = 'Run oai.dlsim.perf.70%' diag = 'no diagnostic is available, check the log file' for i in range(len(PRB)): - for j in range(len(MCS)): + #for j in range(len(MCS)): + for j in range(0,28): for k in range(1,ANT_TX): for m in range (1,ANT_RX): for n in range(1,PDCCH): @@ -103,8 +104,10 @@ def execute(oai, user, pw, logfile,logdir): for q in range(MIN_SNR,MAX_SNR): #if if PRB[i] : - conf = '-B' + str(PRB[i]) + ' -m'+str(MCS[j]) + ' -y'+str(k) + ' -z'+str(m) +' -c'+str(n) + ' -g'+str(CHANNEL[o]) + ' -x'+str(p) + ' -s'+str(q) + ' -w1.0 -f.1 -n500 -P -O80' #+ OPT - trace = logdir + '/time_meas' + '_prb'+str(PRB[i])+'_mcs'+ str(MCS[j])+ '_anttx' + str(k)+ '_antrx' + str(m) + '_pdcch' + str(n) + '_channel' +str(CHANNEL[o]) + '_tx' +str(p) + '_snr' +str(q)+'.'+case+str(test)+ '.log' + #conf = '-B' + str(PRB[i]) + ' -m'+str(MCS[j]) + ' -y'+str(k) + ' -z'+str(m) +' -c'+str(n) + ' -g'+str(CHANNEL[o]) + ' -x'+str(p) + ' -s'+str(q) + ' -w1.0 -f.1 -n500 -P -O80' #+ OPT + #trace = logdir + '/time_meas' + '_prb'+str(PRB[i])+'_mcs'+ str(MCS[j])+ '_anttx' + str(k)+ '_antrx' + str(m) + '_pdcch' + str(n) + '_channel' +str(CHANNEL[o]) + '_tx' +str(p) + '_snr' +str(q)+'.'+case+str(test)+ '.log' + conf = '-B' + str(PRB[i]) + ' -m'+str(j) + ' -y'+str(k) + ' -z'+str(m) +' -c'+str(n) + ' -g'+str(CHANNEL[o]) + ' -x'+str(p) + ' -s'+str(q) + ' -w1.0 -f.1 -n500 -P -O80' #+ OPT + trace = logdir + '/time_meas' + '_prb'+str(PRB[i])+'_mcs'+ str(j)+ '_anttx' + str(k)+ '_antrx' + str(m) + '_pdcch' + str(n) + '_channel' +str(CHANNEL[o]) + '_tx' +str(p) + '_snr' +str(q)+'.'+case+str(test)+ '.log' tee = ' 2>&1 | tee ' + trace match = oai.send_expect_re('./dlsim.rel8 ' + conf + tee, 'passed', 0, 1000) #print conf -- GitLab